4 * Copyright (C) Aaron Holtzman - Aug 1999
5 * Strongly modified, most parts rewritten: A'rpi/ESP-team - 2000-2001
6 * (C) MPlayer Developers
10 #ifndef MPLAYER_VIDEO_OUT_H
11 #define MPLAYER_VIDEO_OUT_H
16 //#include "font_load.h"
17 #include "libmpcodecs/img_format.h"
18 //#include "vidix/vidix.h"
20 #define VO_EVENT_EXPOSE 1
21 #define VO_EVENT_RESIZE 2
22 #define VO_EVENT_KEYPRESS 4
24 /* Obsolete: VOCTRL_QUERY_VAA 1 */
25 /* does the device support the required format */
26 #define VOCTRL_QUERY_FORMAT 2
27 /* signal a device reset seek */
28 #define VOCTRL_RESET 3
29 /* true if vo driver can use GUI created windows */
30 #define VOCTRL_GUISUPPORT 4
31 #define VOCTRL_GUI_NOWINDOW 19
32 /* used to switch to fullscreen */
33 #define VOCTRL_FULLSCREEN 5
34 /* signal a device pause */
35 #define VOCTRL_PAUSE 7
36 /* start/resume playback */
37 #define VOCTRL_RESUME 8
38 /* libmpcodecs direct rendering: */
39 #define VOCTRL_GET_IMAGE 9
40 #define VOCTRL_DRAW_IMAGE 13
41 #define VOCTRL_SET_SPU_PALETTE 14
43 #define VOCTRL_GET_NUM_FRAMES 10
44 #define VOCTRL_GET_FRAME_NUM 11
45 #define VOCTRL_SET_FRAME_NUM 12
46 #define VOCTRL_GET_PANSCAN 15
47 #define VOCTRL_SET_PANSCAN 16
48 /* equalizer controls */
49 #define VOCTRL_SET_EQUALIZER 17
50 struct voctrl_set_equalizer_args
{
54 #define VOCTRL_GET_EQUALIZER 18
55 struct voctrl_get_equalizer_args
{
59 //#define VOCTRL_GUI_NOWINDOW 19
60 /* Frame duplication */
61 #define VOCTRL_DUPLICATE_FRAME 20
63 #define VOCTRL_START_SLICE 21
65 #define VOCTRL_ONTOP 25
66 #define VOCTRL_ROOTWIN 26
67 #define VOCTRL_BORDER 27
68 #define VOCTRL_DRAW_EOSD 28
69 #define VOCTRL_GET_EOSD_RES 29
71 int w
, h
; // screen dimensions, including black borders
72 int mt
, mb
, ml
, mr
; // borders (top, bottom, left, right)
75 #define VOCTRL_SET_DEINTERLACE 30
76 #define VOCTRL_GET_DEINTERLACE 31
78 #define VOCTRL_UPDATE_SCREENINFO 32
80 // Vo can be used by xover
81 #define VOCTRL_XOVERLAY_SUPPORT 22
83 #define VOCTRL_XOVERLAY_SET_COLORKEY 24
85 uint32_t x11
; // The raw x11 color
89 #define VOCTRL_XOVERLAY_SET_WIN 23
90 #define VOCTRL_REDRAW_OSD 24
100 #define VO_NOTAVAIL -2
101 #define VO_NOTIMPL -3
103 #define VOFLAG_FULLSCREEN 0x01
104 #define VOFLAG_MODESWITCHING 0x02
105 #define VOFLAG_SWSCALE 0x04
106 #define VOFLAG_FLIPPING 0x08
107 #define VOFLAG_XOVERLAY_SUB_VO 0x10000
109 typedef struct vo_info_s
111 /* driver name ("Matrox Millennium G200/G400" */
113 /* short name (for config strings) ("mga") */
114 const char *short_name
;
115 /* author ("Aaron Holtzman <aholtzma@ess.engr.uvic.ca>") */
117 /* any additional comments */
125 // Driver uses new API
128 // This is set if the driver is not new and contains pointers to
129 // old-API functions to be used instead of the ones below.
130 struct vo_old_functions
*old_functions
;
132 const vo_info_t
*info
;
134 * Preinitializes driver (real INITIALIZATION)
135 * arg - currently it's vo_subdevice
136 * returns: zero on successful initialization, non-zero on error.
138 int (*preinit
)(struct vo
*vo
, const char *arg
);
140 * Initialize (means CONFIGURE) the display driver.
142 * width,height: image source size
143 * d_width,d_height: size of the requested window size, just a hint
144 * fullscreen: flag, 0=windowd 1=fullscreen, just a hint
145 * title: window title, if available
146 * format: fourcc of pixel format
147 * returns : zero on successful initialization, non-zero on error.
149 int (*config
)(struct vo
*vo
, uint32_t width
, uint32_t height
,
150 uint32_t d_width
, uint32_t d_height
, uint32_t fullscreen
,
151 char *title
, uint32_t format
);
156 int (*control
)(struct vo
*vo
, uint32_t request
, void *data
);
159 * Display a new RGB/BGR frame of the video to the screen.
161 * src[0] - pointer to the image
163 int (*draw_frame
)(struct vo
*vo
, uint8_t *src
[]);
166 * Draw a planar YUV slice to the buffer:
168 * src[3] = source image planes (Y,U,V)
169 * stride[3] = source image planes line widths (in bytes)
170 * w,h = width*height of area to be copied (in Y pixels)
171 * x,y = position at the destination image (in Y pixels)
173 int (*draw_slice
)(struct vo
*vo
, uint8_t *src
[], int stride
[], int w
,
174 int h
, int x
, int y
);
177 * Draws OSD to the screen buffer
179 void (*draw_osd
)(struct vo
*vo
, struct osd_state
*osd
);
182 * Blit/Flip buffer to the screen. Must be called after each frame!
184 void (*flip_page
)(struct vo
*vo
);
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
)(struct vo
*vo
);
193 * Closes driver. Should restore the original state of the system.
195 void (*uninit
)(struct vo
*vo
);
198 struct vo_old_functions
{
199 int (*preinit
)(const char *arg
);
200 int (*config
)(uint32_t width
, uint32_t height
, uint32_t d_width
,
201 uint32_t d_height
, uint32_t fullscreen
, char *title
,
203 int (*control
)(uint32_t request
, void *data
);
204 int (*draw_frame
)(uint8_t *src
[]);
205 int (*draw_slice
)(uint8_t *src
[], int stride
[], int w
,int h
, int x
,int y
);
206 void (*draw_osd
)(void);
207 void (*flip_page
)(void);
208 void (*check_events
)(void);
209 void (*uninit
)(void);
213 int config_ok
; // Last config call was successful?
214 int config_count
; // Total number of successful config calls
215 const struct vo_driver
*driver
;
218 struct vo_x11_state
*x11
;
219 struct mp_fifo
*key_fifo
;
220 struct input_ctx
*input_ctx
;
222 // requested position/resolution
230 float panscan_amount
;
231 float monitor_aspect
;
233 int orgw
; // real width
234 int orgh
; // real height
235 int prew
; // prescaled width
236 int preh
; // prescaled height
237 int scrw
; // horizontal resolution
238 int scrh
; // vertical resolution
243 struct vo
*init_best_video_out(struct MPOpts
*opts
, struct vo_x11_state
*x11
,
244 struct mp_fifo
*key_fifo
,
245 struct input_ctx
*input_ctx
);
246 int vo_config(struct vo
*vo
, uint32_t width
, uint32_t height
,
247 uint32_t d_width
, uint32_t d_height
, uint32_t flags
,
248 char *title
, uint32_t format
);
249 void list_video_out(void);
251 int vo_control(struct vo
*vo
, uint32_t request
, void *data
);
252 int vo_draw_frame(struct vo
*vo
, uint8_t *src
[]);
253 int vo_draw_slice(struct vo
*vo
, uint8_t *src
[], int stride
[], int w
, int h
, int x
, int y
);
254 void vo_draw_osd(struct vo
*vo
, struct osd_state
*osd
);
255 void vo_flip_page(struct vo
*vo
);
256 void vo_check_events(struct vo
*vo
);
257 void vo_destroy(struct vo
*vo
);
260 // NULL terminated array of all drivers
261 extern const struct vo_driver
*video_out_drivers
[];
263 extern int xinerama_screen
;
264 extern int xinerama_x
;
265 extern int xinerama_y
;
267 extern int vo_grabpointer
;
268 extern int vo_doublebuffering
;
269 extern int vo_directrendering
;
272 extern int vo_fsmode
;
273 extern float vo_panscan
;
274 extern int vo_adapter_num
;
275 extern int vo_refresh_rate
;
276 extern int vo_keepaspect
;
277 extern int vo_rootwin
;
278 extern int vo_border
;
280 extern int vo_nomouse_input
;
285 extern char *vo_subdevice
;
287 extern int vo_colorkey
;
296 float range_max(range_t
*r
);
297 int in_range(range_t
*r
, float f
);
298 range_t
*str2range(char *s
);
299 extern char *monitor_hfreq_str
;
300 extern char *monitor_vfreq_str
;
301 extern char *monitor_dotclock_str
;
307 int lookup_keymap_table(const struct keymap
*map
, int key
);
309 #endif /* MPLAYER_VIDEO_OUT_H */