xine-lib 1.2.11
vo_scale.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2000-2020 the xine project
3 *
4 * This file is part of xine, a free video player.
5 *
6 * xine is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * xine is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 *
20 * vo_scale.h
21 *
22 * keeps video scaling information
23 */
24
25#ifndef HAVE_VO_SCALE_H
26#define HAVE_VO_SCALE_H
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#include <xine/configfile.h>
33
34typedef struct {
35 int x, y;
36 int w, h;
38
39struct vo_scale_s {
40
41 /* true if driver supports frame zooming */
43
44 /* forces direct mapping between frame pixels and screen pixels */
46
47 /* size / aspect ratio calculations */
48
49 /*
50 * "delivered" size:
51 * frame dimension / aspect as delivered by the decoder
52 * used (among other things) to detect frame size changes
53 * units: frame pixels
54 */
58
59 /*
60 * required cropping:
61 * units: frame pixels
62 */
67
68 /*
69 * displayed part of delivered images,
70 * taking zoom into account
71 * units: frame pixels
72 */
78
79 /*
80 * user's aspect selection
81 */
83
84 /*
85 * "gui" size / offset:
86 * what gui told us about where to display the video
87 * units: screen pixels
88 */
92
93 /* */
95
96 /*
97 * video + display pixel aspect
98 * One pixel of height 1 has this width
99 * This may be corrected by the driver in order to fit the video seamlessly
100 */
103
104 /*
105 * "output" size:
106 *
107 * this is finally the ideal size "fitted" into the
108 * gui size while maintaining the aspect ratio
109 * units: screen pixels
110 */
115
116
117 /* gui callbacks */
118
121 int video_width, int video_height,
122 double video_pixel_aspect,
123 int *dest_x, int *dest_y,
124 int *dest_width, int *dest_height,
125 double *dest_pixel_aspect,
126 int *win_x, int *win_y);
127
128 void (*dest_size_cb) (void *user_data,
129 int video_width, int video_height,
130 double video_pixel_aspect,
131 int *dest_width, int *dest_height,
132 double *dest_pixel_aspect);
133
134 /* borders */
136
137 /*
138 * border ratios to determine image position in the
139 * viewport; these are set by user config
140 */
143
144};
145
146typedef struct vo_scale_s vo_scale_t;
147
148
149/*
150 * convert delivered height/width to ideal width/height
151 * taking into account aspect ratio and zoom factor
152 */
153
155
156
157/*
158 * make ideal width/height "fit" into the gui
159 */
160
162
163/*
164 * return true if a redraw is needed due resizing, zooming,
165 * aspect ratio changing, etc.
166 */
167
169
170/*
171 *
172 */
173
175 int x, int y,
176 int *vid_x, int *vid_y) XINE_PROTECTED;
177
178typedef struct {
179 struct {
180 int x0, y0, x1, y1;
181 } in, out;
183
184typedef enum {
190
200
201/*
202 * Returns description of a given ratio code
203 */
204
206
207/*
208 * initialize rescaling struct
209 */
210
211void _x_vo_scale_init(vo_scale_t *self, int support_zoom,
212 int scaling_disabled, config_values_t *config ) XINE_PROTECTED;
213
215
216#ifdef __cplusplus
217}
218#endif
219
220#endif
#define XINE_PROTECTED
Definition: attributes.h:75
Definition: configfile.h:83
Definition: vo_scale.h:178
int x0
Definition: vo_scale.h:180
Definition: vo_scale.h:34
int h
Definition: vo_scale.h:36
int x
Definition: vo_scale.h:35
Definition: vo_scale.h:39
int displayed_width
Definition: vo_scale.h:75
double zoom_factor_x
Definition: vo_scale.h:77
int displayed_height
Definition: vo_scale.h:76
vo_scale_rect_t border[4]
Definition: vo_scale.h:135
int displayed_yoffset
Definition: vo_scale.h:74
int crop_left
Definition: vo_scale.h:63
void * user_data
Definition: vo_scale.h:119
int output_width
Definition: vo_scale.h:111
int gui_win_y
Definition: vo_scale.h:91
int displayed_xoffset
Definition: vo_scale.h:73
int scaling_disabled
Definition: vo_scale.h:45
void(* dest_size_cb)(void *user_data, int video_width, int video_height, double video_pixel_aspect, int *dest_width, int *dest_height, double *dest_pixel_aspect)
Definition: vo_scale.h:128
double output_horizontal_position
Definition: vo_scale.h:141
double video_pixel_aspect
Definition: vo_scale.h:102
double gui_pixel_aspect
Definition: vo_scale.h:101
int crop_right
Definition: vo_scale.h:64
int crop_bottom
Definition: vo_scale.h:66
int force_redraw
Definition: vo_scale.h:94
int gui_width
Definition: vo_scale.h:90
int output_yoffset
Definition: vo_scale.h:114
double output_vertical_position
Definition: vo_scale.h:142
double delivered_ratio
Definition: vo_scale.h:57
int delivered_height
Definition: vo_scale.h:56
int gui_win_x
Definition: vo_scale.h:91
int gui_x
Definition: vo_scale.h:89
int support_zoom
Definition: vo_scale.h:42
int gui_y
Definition: vo_scale.h:89
int user_ratio
Definition: vo_scale.h:82
int gui_height
Definition: vo_scale.h:90
int output_height
Definition: vo_scale.h:112
void(* frame_output_cb)(void *user_data, int video_width, int video_height, double video_pixel_aspect, int *dest_x, int *dest_y, int *dest_width, int *dest_height, double *dest_pixel_aspect, int *win_x, int *win_y)
Definition: vo_scale.h:120
int crop_top
Definition: vo_scale.h:65
int delivered_width
Definition: vo_scale.h:55
double zoom_factor_y
Definition: vo_scale.h:77
int output_xoffset
Definition: vo_scale.h:113
void _x_vo_scale_translate_gui2video(vo_scale_t *self, int x, int y, int *vid_x, int *vid_y)
Definition: vo_scale.c:312
const char _x_vo_scale_aspect_ratio_name_table[][8]
Definition: vo_scale.c:419
void _x_vo_scale_compute_ideal_size(vo_scale_t *self)
Definition: vo_scale.c:47
void _x_vo_scale_compute_output_size(vo_scale_t *self)
Definition: vo_scale.c:112
void _x_vo_scale_cleanup(vo_scale_t *self, config_values_t *config)
Definition: vo_scale.c:465
vo_scale_map_res_t
Definition: vo_scale.h:184
@ VO_SCALE_MAP_WRONG_ARGS
Definition: vo_scale.h:187
@ VO_SCALE_MAP_OK
Definition: vo_scale.h:185
@ VO_SCALE_MAP_OUTSIDE
Definition: vo_scale.h:186
@ VO_SCALE_MAP_ERROR
Definition: vo_scale.h:188
int _x_vo_scale_redraw_needed(vo_scale_t *self)
Definition: vo_scale.c:265
void _x_vo_scale_init(vo_scale_t *self, int support_zoom, int scaling_disabled, config_values_t *config)
Definition: vo_scale.c:469
vo_scale_map_res_t _x_vo_scale_map(vo_scale_t *self, vo_scale_map_t *map)
Map a rectangle to video out window.
Definition: vo_scale.c:342