2 * Copyright (C) Aaron Holtzman - Aug 1999
3 * Strongly modified, most parts rewritten: A'rpi/ESP-team - 2000-2001
4 * (C) MPlayer developers
6 * This file is part of MPlayer.
8 * MPlayer is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * MPlayer is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef MPLAYER_VIDEO_OUT_H
24 #define MPLAYER_VIDEO_OUT_H
29 //#include "sub/font_load.h"
30 #include "../img_format.h"
31 //#include "vidix/vidix.h"
34 #define ROTATE(t, x, y) do { \
40 #define VO_EVENT_EXPOSE 1
41 #define VO_EVENT_RESIZE 2
42 #define VO_EVENT_KEYPRESS 4
43 #define VO_EVENT_REINIT 8
44 #define VO_EVENT_MOVE 16
45 #define VO_EVENT_MOUSE 32
47 /* Obsolete: VOCTRL_QUERY_VAA 1 */
48 /* does the device support the required format */
49 #define VOCTRL_QUERY_FORMAT 2
50 /* signal a device reset seek */
51 #define VOCTRL_RESET 3
52 /* true if vo driver can use GUI created windows */
53 #define VOCTRL_GUISUPPORT 4
54 /* used to switch to fullscreen */
55 #define VOCTRL_FULLSCREEN 5
56 /* signal a device pause */
57 #define VOCTRL_PAUSE 7
58 /* start/resume playback */
59 #define VOCTRL_RESUME 8
60 /* libmpcodecs direct rendering: */
61 #define VOCTRL_GET_IMAGE 9
62 #define VOCTRL_DRAW_IMAGE 13
63 #define VOCTRL_SET_SPU_PALETTE 14
65 #define VOCTRL_GET_NUM_FRAMES 10
66 #define VOCTRL_GET_FRAME_NUM 11
67 #define VOCTRL_SET_FRAME_NUM 12
68 #define VOCTRL_GET_PANSCAN 15
69 #define VOCTRL_SET_PANSCAN 16
70 /* equalizer controls */
71 #define VOCTRL_SET_EQUALIZER 17
72 #define VOCTRL_GET_EQUALIZER 18
73 /* Frame duplication */
74 #define VOCTRL_DUPLICATE_FRAME 20
76 #define VOCTRL_START_SLICE 21
78 #define VOCTRL_ONTOP 25
79 #define VOCTRL_ROOTWIN 26
80 #define VOCTRL_BORDER 27
81 #define VOCTRL_DRAW_EOSD 28
82 #define VOCTRL_GET_EOSD_RES 29
84 #define VOCTRL_SET_DEINTERLACE 30
85 #define VOCTRL_GET_DEINTERLACE 31
87 #define VOCTRL_UPDATE_SCREENINFO 32
89 // Vo can be used by xover
90 #define VOCTRL_XOVERLAY_SUPPORT 22
92 #define VOCTRL_XOVERLAY_SET_COLORKEY 24
94 uint32_t x11
; // The raw x11 color
98 #define VOCTRL_XOVERLAY_SET_WIN 23
107 #define VO_NOTAVAIL -2
108 #define VO_NOTIMPL -3
110 #define VOFLAG_FULLSCREEN 0x01
111 #define VOFLAG_MODESWITCHING 0x02
112 #define VOFLAG_SWSCALE 0x04
113 #define VOFLAG_FLIPPING 0x08
114 #define VOFLAG_HIDDEN 0x10 //< Use to create a hidden window
115 #define VOFLAG_STEREO 0x20 //< Use to create a stereo-capable window
116 #define VOFLAG_DEPTH 0x40 //< Request a depth buffer
117 #define VOFLAG_XOVERLAY_SUB_VO 0x10000
119 typedef struct vo_info_s
121 /* driver name ("Matrox Millennium G200/G400" */
123 /* short name (for config strings) ("mga") */
124 const char *short_name
;
125 /* author ("Aaron Holtzman <aholtzma@ess.engr.uvic.ca>") */
127 /* any additional comments */
131 typedef struct vo_functions_s
133 const vo_info_t
*info
;
135 * Preinitializes driver (real INITIALIZATION)
136 * arg - currently it's vo_subdevice
137 * returns: zero on successful initialization, non-zero on error.
139 int (*preinit
)(const char *arg
);
141 * Initialize (means CONFIGURE) the display driver.
143 * width,height: image source size
144 * d_width,d_height: size of the requested window size, just a hint
145 * fullscreen: flag, 0=windowd 1=fullscreen, just a hint
146 * title: window title, if available
147 * format: fourcc of pixel format
148 * returns : zero on successful initialization, non-zero on error.
150 int (*config
)(uint32_t width
, uint32_t height
, uint32_t d_width
,
151 uint32_t d_height
, uint32_t fullscreen
, char *title
,
157 int (*control
)(uint32_t request
, void *data
, ...);
160 * Display a new RGB/BGR frame of the video to the screen.
162 * src[0] - pointer to the image
164 int (*draw_frame
)(uint8_t *src
[]);
167 * Draw a planar YUV slice to the buffer:
169 * src[3] = source image planes (Y,U,V)
170 * stride[3] = source image planes line widths (in bytes)
171 * w,h = width*height of area to be copied (in Y pixels)
172 * x,y = position at the destination image (in Y pixels)
174 int (*draw_slice
)(uint8_t *src
[], int stride
[], int w
,int h
, int x
,int y
);
177 * Draws OSD to the screen buffer
179 void (*draw_osd
)(void);
182 * Blit/Flip buffer to the screen. Must be called after each frame!
184 void (*flip_page
)(void);
187 * This func is called after every frames to handle keyboard and
188 * other events. It's called in PAUSE mode too!
190 void (*check_events
)(void);
193 * Closes driver. Should restore the original state of the system.
195 void (*uninit
)(void);
198 const vo_functions_t
* init_best_video_out(char** vo_list
);
199 int config_video_out(const vo_functions_t
*vo
, uint32_t width
, uint32_t height
,
200 uint32_t d_width
, uint32_t d_height
, uint32_t flags
,
201 char *title
, uint32_t format
);
202 void list_video_out(void);
204 // NULL terminated array of all drivers
205 extern const vo_functions_t
* const video_out_drivers
[];
209 extern int vo_config_count
;
211 extern int xinerama_screen
;
212 extern int xinerama_x
;
213 extern int xinerama_y
;
215 // correct resolution/bpp on screen: (should be autodetected by vo_init())
216 extern int vo_depthonscreen
;
217 extern int vo_screenwidth
;
218 extern int vo_screenheight
;
220 // requested resolution/bpp: (-x -y -bpp options)
223 extern int vo_dwidth
;
224 extern int vo_dheight
;
227 extern int vo_grabpointer
;
228 extern int vo_doublebuffering
;
229 extern int vo_directrendering
;
231 extern int vo_fsmode
;
232 extern float vo_panscan
;
233 extern float vo_border_pos_x
;
234 extern float vo_border_pos_y
;
235 extern int vo_rotate
;
236 extern int vo_adapter_num
;
237 extern int vo_refresh_rate
;
238 extern int vo_keepaspect
;
239 extern int vo_rootwin
;
241 extern int vo_border
;
243 extern int vo_gamma_gamma
;
244 extern int vo_gamma_brightness
;
245 extern int vo_gamma_saturation
;
246 extern int vo_gamma_contrast
;
247 extern int vo_gamma_hue
;
248 extern int vo_gamma_red_intensity
;
249 extern int vo_gamma_green_intensity
;
250 extern int vo_gamma_blue_intensity
;
252 extern int vo_nomouse_input
;
253 extern int enable_mouse_movements
;
258 extern char *vo_subdevice
;
260 extern int vo_colorkey
;
262 extern char *vo_winname
;
263 extern char *vo_wintitle
;
265 extern int64_t WinID
;
272 float range_max(range_t
*r
);
273 int in_range(range_t
*r
, float f
);
274 range_t
*str2range(char *s
);
275 extern char *monitor_hfreq_str
;
276 extern char *monitor_vfreq_str
;
277 extern char *monitor_dotclock_str
;
283 int lookup_keymap_table(const struct mp_keymap
*map
, int key
);
285 int left
, right
, top
, bottom
, width
, height
;
287 void calc_src_dst_rects(int src_width
, int src_height
, struct vo_rect
*src
, struct vo_rect
*dst
,
288 struct vo_rect
*borders
, const struct vo_rect
*crop
);
289 void vo_mouse_movement(int posx
, int posy
);
291 static inline int apply_border_pos(int full
, int part
, float pos
) {
292 if (pos
>= 0.0 && pos
<= 1.0) {
293 return pos
*(full
- part
);
297 return full
- part
+ (pos
- 1) * part
;
300 #endif /* MPLAYER_VIDEO_OUT_H */