xine-lib  1.2.10
vo_scale.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2000-2018 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
29 extern "C" {
30 #endif
31 
32 #include <xine/configfile.h>
33 
34 typedef struct {
35  int x, y;
36  int w, h;
38 
39 struct 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  */
63  int crop_left;
65  int crop_top;
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  */
89  int gui_x, gui_y;
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 
119  void *user_data;
120  void (*frame_output_cb) (void *user_data,
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 
146 typedef 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 
178 /*
179  * Returns description of a given ratio code
180  */
181 
183 
184 /*
185  * initialize rescaling struct
186  */
187 
190 
192 
193 #ifdef __cplusplus
194 }
195 #endif
196 
197 #endif
vo_scale_s::displayed_xoffset
int displayed_xoffset
Definition: vo_scale.h:73
_x_vo_scale_redraw_needed
int _x_vo_scale_redraw_needed(vo_scale_t *self)
Definition: vo_scale.c:265
_x_vo_scale_compute_ideal_size
void _x_vo_scale_compute_ideal_size(vo_scale_t *self)
Definition: vo_scale.c:47
vo_scale_rect_t
Definition: vo_scale.h:34
vo_scale_s::gui_x
int gui_x
Definition: vo_scale.h:89
vo_scale_s::output_vertical_position
double output_vertical_position
Definition: vo_scale.h:142
_x_vo_scale_translate_gui2video
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
_x_vo_scale_cleanup
void _x_vo_scale_cleanup(vo_scale_t *self, config_values_t *config)
Definition: vo_scale.c:394
vo_scale_s::support_zoom
int support_zoom
Definition: vo_scale.h:42
vo_scale_s::scaling_disabled
int scaling_disabled
Definition: vo_scale.h:45
vo_scale_s::dest_size_cb
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
vo_scale_s::force_redraw
int force_redraw
Definition: vo_scale.h:94
vo_scale_s
Definition: vo_scale.h:39
vo_scale_s::output_height
int output_height
Definition: vo_scale.h:112
vo_scale_s::gui_width
int gui_width
Definition: vo_scale.h:90
vo_scale_rect_t::y
int y
Definition: vo_scale.h:35
vo_scale_s::displayed_yoffset
int displayed_yoffset
Definition: vo_scale.h:74
vo_scale_s::output_width
int output_width
Definition: vo_scale.h:111
config_values_s
Definition: configfile.h:83
vo_scale_s::displayed_width
int displayed_width
Definition: vo_scale.h:75
vo_scale_s::crop_top
int crop_top
Definition: vo_scale.h:65
vo_scale_s::output_horizontal_position
double output_horizontal_position
Definition: vo_scale.h:141
vo_scale_s::delivered_ratio
double delivered_ratio
Definition: vo_scale.h:57
vo_scale_s::delivered_width
int delivered_width
Definition: vo_scale.h:55
vo_scale_s::gui_win_y
int gui_win_y
Definition: vo_scale.h:91
vo_scale_s::crop_bottom
int crop_bottom
Definition: vo_scale.h:66
vo_scale_s::user_data
void * user_data
Definition: vo_scale.h:119
vo_scale_s::crop_right
int crop_right
Definition: vo_scale.h:64
vo_scale_s::video_pixel_aspect
double video_pixel_aspect
Definition: vo_scale.h:102
vo_scale_s::crop_left
int crop_left
Definition: vo_scale.h:63
_x_vo_scale_aspect_ratio_name_table
const char _x_vo_scale_aspect_ratio_name_table[][8]
Definition: vo_scale.c:348
vo_scale_s::gui_y
int gui_y
Definition: vo_scale.h:89
vo_scale_s::frame_output_cb
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
vo_scale_s::gui_win_x
int gui_win_x
Definition: vo_scale.h:91
vo_scale_rect_t::w
int w
Definition: vo_scale.h:36
vo_scale_s::zoom_factor_x
double zoom_factor_x
Definition: vo_scale.h:77
vo_scale_s::gui_height
int gui_height
Definition: vo_scale.h:90
XINE_PROTECTED
#define XINE_PROTECTED
Definition: attributes.h:73
vo_scale_s::delivered_height
int delivered_height
Definition: vo_scale.h:56
vo_scale_s::user_ratio
int user_ratio
Definition: vo_scale.h:82
vo_scale_s::output_xoffset
int output_xoffset
Definition: vo_scale.h:113
configfile.h
vo_scale_s::output_yoffset
int output_yoffset
Definition: vo_scale.h:114
vo_scale_s::border
vo_scale_rect_t border[4]
Definition: vo_scale.h:135
vo_scale_s::gui_pixel_aspect
double gui_pixel_aspect
Definition: vo_scale.h:101
_x_vo_scale_init
void _x_vo_scale_init(vo_scale_t *self, int support_zoom, int scaling_disabled, config_values_t *config)
Definition: vo_scale.c:398
vo_scale_s::displayed_height
int displayed_height
Definition: vo_scale.h:76
_x_vo_scale_compute_output_size
void _x_vo_scale_compute_output_size(vo_scale_t *self)
Definition: vo_scale.c:112
vo_scale_s::zoom_factor_y
double zoom_factor_y
Definition: vo_scale.h:77