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"
33 #define VO_EVENT_EXPOSE 1
34 #define VO_EVENT_RESIZE 2
35 #define VO_EVENT_KEYPRESS 4
36 #define VO_EVENT_REINIT 8
37 #define VO_EVENT_MOVE 16
39 /* Obsolete: VOCTRL_QUERY_VAA 1 */
40 /* does the device support the required format */
41 #define VOCTRL_QUERY_FORMAT 2
42 /* signal a device reset seek */
43 #define VOCTRL_RESET 3
44 /* true if vo driver can use GUI created windows */
45 #define VOCTRL_GUISUPPORT 4
46 #define VOCTRL_GUI_NOWINDOW 19
47 /* used to switch to fullscreen */
48 #define VOCTRL_FULLSCREEN 5
49 /* signal a device pause */
50 #define VOCTRL_PAUSE 7
51 /* start/resume playback */
52 #define VOCTRL_RESUME 8
53 /* libmpcodecs direct rendering: */
54 #define VOCTRL_GET_IMAGE 9
55 #define VOCTRL_DRAW_IMAGE 13
56 #define VOCTRL_SET_SPU_PALETTE 14
58 #define VOCTRL_GET_NUM_FRAMES 10
59 #define VOCTRL_GET_FRAME_NUM 11
60 #define VOCTRL_SET_FRAME_NUM 12
61 #define VOCTRL_GET_PANSCAN 15
62 #define VOCTRL_SET_PANSCAN 16
63 /* equalizer controls */
64 #define VOCTRL_SET_EQUALIZER 17
65 #define VOCTRL_GET_EQUALIZER 18
66 //#define VOCTRL_GUI_NOWINDOW 19
67 /* Frame duplication */
68 #define VOCTRL_DUPLICATE_FRAME 20
70 #define VOCTRL_START_SLICE 21
72 #define VOCTRL_ONTOP 25
73 #define VOCTRL_ROOTWIN 26
74 #define VOCTRL_BORDER 27
75 #define VOCTRL_DRAW_EOSD 28
76 #define VOCTRL_GET_EOSD_RES 29
78 #define VOCTRL_SET_DEINTERLACE 30
79 #define VOCTRL_GET_DEINTERLACE 31
81 #define VOCTRL_UPDATE_SCREENINFO 32
83 // Vo can be used by xover
84 #define VOCTRL_XOVERLAY_SUPPORT 22
86 #define VOCTRL_XOVERLAY_SET_COLORKEY 24
88 uint32_t x11; // The raw x11 color
92 #define VOCTRL_XOVERLAY_SET_WIN 23
101 #define VO_NOTAVAIL -2
102 #define VO_NOTIMPL -3
104 #define VOFLAG_FULLSCREEN 0x01
105 #define VOFLAG_MODESWITCHING 0x02
106 #define VOFLAG_SWSCALE 0x04
107 #define VOFLAG_FLIPPING 0x08
108 #define VOFLAG_HIDDEN 0x10 //< Use to create a hidden window
109 #define VOFLAG_STEREO 0x20 //< Use to create a stereo-capable window
110 #define VOFLAG_XOVERLAY_SUB_VO 0x10000
112 typedef struct vo_info_s
114 /* driver name ("Matrox Millennium G200/G400" */
116 /* short name (for config strings) ("mga") */
117 const char *short_name;
118 /* author ("Aaron Holtzman <aholtzma@ess.engr.uvic.ca>") */
120 /* any additional comments */
124 typedef struct vo_functions_s
126 const vo_info_t *info;
128 * Preinitializes driver (real INITIALIZATION)
129 * arg - currently it's vo_subdevice
130 * returns: zero on successful initialization, non-zero on error.
132 int (*preinit)(const char *arg);
134 * Initialize (means CONFIGURE) the display driver.
136 * width,height: image source size
137 * d_width,d_height: size of the requested window size, just a hint
138 * fullscreen: flag, 0=windowd 1=fullscreen, just a hint
139 * title: window title, if available
140 * format: fourcc of pixel format
141 * returns : zero on successful initialization, non-zero on error.
143 int (*config)(uint32_t width, uint32_t height, uint32_t d_width,
144 uint32_t d_height, uint32_t fullscreen, char *title,
150 int (*control)(uint32_t request, void *data, ...);
153 * Display a new RGB/BGR frame of the video to the screen.
155 * src[0] - pointer to the image
157 int (*draw_frame)(uint8_t *src[]);
160 * Draw a planar YUV slice to the buffer:
162 * src[3] = source image planes (Y,U,V)
163 * stride[3] = source image planes line widths (in bytes)
164 * w,h = width*height of area to be copied (in Y pixels)
165 * x,y = position at the destination image (in Y pixels)
167 int (*draw_slice)(uint8_t *src[], int stride[], int w,int h, int x,int y);
170 * Draws OSD to the screen buffer
172 void (*draw_osd)(void);
175 * Blit/Flip buffer to the screen. Must be called after each frame!
177 void (*flip_page)(void);
180 * This func is called after every frames to handle keyboard and
181 * other events. It's called in PAUSE mode too!
183 void (*check_events)(void);
186 * Closes driver. Should restore the original state of the system.
188 void (*uninit)(void);
191 const vo_functions_t* init_best_video_out(char** vo_list);
192 int config_video_out(const vo_functions_t *vo, uint32_t width, uint32_t height,
193 uint32_t d_width, uint32_t d_height, uint32_t flags,
194 char *title, uint32_t format);
195 void list_video_out(void);
197 // NULL terminated array of all drivers
198 extern const vo_functions_t* const video_out_drivers[];
202 extern int vo_config_count;
204 extern int xinerama_screen;
205 extern int xinerama_x;
206 extern int xinerama_y;
208 // correct resolution/bpp on screen: (should be autodetected by vo_init())
209 extern int vo_depthonscreen;
210 extern int vo_screenwidth;
211 extern int vo_screenheight;
213 // requested resolution/bpp: (-x -y -bpp options)
216 extern int vo_dwidth;
217 extern int vo_dheight;
220 extern int vo_grabpointer;
221 extern int vo_doublebuffering;
222 extern int vo_directrendering;
225 extern int vo_fsmode;
226 extern float vo_panscan;
227 extern int vo_adapter_num;
228 extern int vo_refresh_rate;
229 extern int vo_keepaspect;
230 extern int vo_rootwin;
232 extern int vo_border;
234 extern int vo_gamma_gamma;
235 extern int vo_gamma_brightness;
236 extern int vo_gamma_saturation;
237 extern int vo_gamma_contrast;
238 extern int vo_gamma_hue;
239 extern int vo_gamma_red_intensity;
240 extern int vo_gamma_green_intensity;
241 extern int vo_gamma_blue_intensity;
243 extern int vo_nomouse_input;
244 extern int enable_mouse_movements;
249 extern char *vo_subdevice;
251 extern int vo_colorkey;
253 extern char *vo_winname;
254 extern char *vo_wintitle;
256 extern int64_t WinID;
263 float range_max(range_t *r);
264 int in_range(range_t *r, float f);
265 range_t *str2range(char *s);
266 extern char *monitor_hfreq_str;
267 extern char *monitor_vfreq_str;
268 extern char *monitor_dotclock_str;
274 int lookup_keymap_table(const struct mp_keymap *map, int key);
276 int left, right, top, bottom, width, height;
278 void calc_src_dst_rects(int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst,
279 struct vo_rect *borders, const struct vo_rect *crop);
280 void vo_mouse_movement(int posx, int posy);
282 static inline int aspect_scaling(void)
287 #endif /* MPLAYER_VIDEO_OUT_H */