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 "font_load.h"
30 #include "libmpcodecs/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
37 /* Obsolete: VOCTRL_QUERY_VAA 1 */
38 /* does the device support the required format */
39 #define VOCTRL_QUERY_FORMAT 2
40 /* signal a device reset seek */
41 #define VOCTRL_RESET 3
42 /* used to switch to fullscreen */
43 #define VOCTRL_FULLSCREEN 5
44 /* signal a device pause */
45 #define VOCTRL_PAUSE 7
46 /* start/resume playback */
47 #define VOCTRL_RESUME 8
48 /* libmpcodecs direct rendering: */
49 #define VOCTRL_GET_IMAGE 9
50 #define VOCTRL_DRAW_IMAGE 13
51 #define VOCTRL_SET_SPU_PALETTE 14
53 #define VOCTRL_GET_NUM_FRAMES 10
54 #define VOCTRL_GET_FRAME_NUM 11
55 #define VOCTRL_SET_FRAME_NUM 12
56 #define VOCTRL_GET_PANSCAN 15
57 #define VOCTRL_SET_PANSCAN 16
58 /* equalizer controls */
59 #define VOCTRL_SET_EQUALIZER 17
60 struct voctrl_set_equalizer_args
{
64 #define VOCTRL_GET_EQUALIZER 18
65 struct voctrl_get_equalizer_args
{
69 /* Frame duplication */
70 #define VOCTRL_DUPLICATE_FRAME 20
72 #define VOCTRL_START_SLICE 21
74 #define VOCTRL_ONTOP 25
75 #define VOCTRL_ROOTWIN 26
76 #define VOCTRL_BORDER 27
77 #define VOCTRL_DRAW_EOSD 28
78 #define VOCTRL_GET_EOSD_RES 29
80 int w
, h
; // screen dimensions, including black borders
81 int mt
, mb
, ml
, mr
; // borders (top, bottom, left, right)
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
99 #define VOCTRL_REDRAW_OSD 24
109 #define VO_NOTAVAIL -2
110 #define VO_NOTIMPL -3
112 #define VOFLAG_FULLSCREEN 0x01
113 #define VOFLAG_MODESWITCHING 0x02
114 #define VOFLAG_SWSCALE 0x04
115 #define VOFLAG_FLIPPING 0x08
116 #define VOFLAG_XOVERLAY_SUB_VO 0x10000
118 typedef struct vo_info_s
120 /* driver name ("Matrox Millennium G200/G400" */
122 /* short name (for config strings) ("mga") */
123 const char *short_name
;
124 /* author ("Aaron Holtzman <aholtzma@ess.engr.uvic.ca>") */
126 /* any additional comments */
134 // Driver uses new API
137 // This is set if the driver is not new and contains pointers to
138 // old-API functions to be used instead of the ones below.
139 struct vo_old_functions
*old_functions
;
141 const vo_info_t
*info
;
143 * Preinitializes driver (real INITIALIZATION)
144 * arg - currently it's vo_subdevice
145 * returns: zero on successful initialization, non-zero on error.
147 int (*preinit
)(struct vo
*vo
, const char *arg
);
149 * Initialize (means CONFIGURE) the display driver.
151 * width,height: image source size
152 * d_width,d_height: size of the requested window size, just a hint
153 * fullscreen: flag, 0=windowd 1=fullscreen, just a hint
154 * title: window title, if available
155 * format: fourcc of pixel format
156 * returns : zero on successful initialization, non-zero on error.
158 int (*config
)(struct vo
*vo
, uint32_t width
, uint32_t height
,
159 uint32_t d_width
, uint32_t d_height
, uint32_t fullscreen
,
160 char *title
, uint32_t format
);
165 int (*control
)(struct vo
*vo
, uint32_t request
, void *data
);
168 * Display a new RGB/BGR frame of the video to the screen.
170 * src[0] - pointer to the image
172 int (*draw_frame
)(struct vo
*vo
, uint8_t *src
[]);
175 * Draw a planar YUV slice to the buffer:
177 * src[3] = source image planes (Y,U,V)
178 * stride[3] = source image planes line widths (in bytes)
179 * w,h = width*height of area to be copied (in Y pixels)
180 * x,y = position at the destination image (in Y pixels)
182 int (*draw_slice
)(struct vo
*vo
, uint8_t *src
[], int stride
[], int w
,
183 int h
, int x
, int y
);
186 * Draws OSD to the screen buffer
188 void (*draw_osd
)(struct vo
*vo
, struct osd_state
*osd
);
191 * Blit/Flip buffer to the screen. Must be called after each frame!
193 void (*flip_page
)(struct vo
*vo
);
196 * This func is called after every frames to handle keyboard and
197 * other events. It's called in PAUSE mode too!
199 void (*check_events
)(struct vo
*vo
);
202 * Closes driver. Should restore the original state of the system.
204 void (*uninit
)(struct vo
*vo
);
207 struct vo_old_functions
{
208 int (*preinit
)(const char *arg
);
209 int (*config
)(uint32_t width
, uint32_t height
, uint32_t d_width
,
210 uint32_t d_height
, uint32_t fullscreen
, char *title
,
212 int (*control
)(uint32_t request
, void *data
);
213 int (*draw_frame
)(uint8_t *src
[]);
214 int (*draw_slice
)(uint8_t *src
[], int stride
[], int w
,int h
, int x
,int y
);
215 void (*draw_osd
)(void);
216 void (*flip_page
)(void);
217 void (*check_events
)(void);
218 void (*uninit
)(void);
222 int config_ok
; // Last config call was successful?
223 int config_count
; // Total number of successful config calls
224 const struct vo_driver
*driver
;
227 struct vo_x11_state
*x11
;
228 struct mp_fifo
*key_fifo
;
229 struct input_ctx
*input_ctx
;
231 // requested position/resolution
239 float panscan_amount
;
240 float monitor_aspect
;
242 int orgw
; // real width
243 int orgh
; // real height
244 int prew
; // prescaled width
245 int preh
; // prescaled height
246 int scrw
; // horizontal resolution
247 int scrh
; // vertical resolution
252 struct vo
*init_best_video_out(struct MPOpts
*opts
, struct vo_x11_state
*x11
,
253 struct mp_fifo
*key_fifo
,
254 struct input_ctx
*input_ctx
);
255 int vo_config(struct vo
*vo
, uint32_t width
, uint32_t height
,
256 uint32_t d_width
, uint32_t d_height
, uint32_t flags
,
257 char *title
, uint32_t format
);
258 void list_video_out(void);
260 int vo_control(struct vo
*vo
, uint32_t request
, void *data
);
261 int vo_draw_frame(struct vo
*vo
, uint8_t *src
[]);
262 int vo_draw_slice(struct vo
*vo
, uint8_t *src
[], int stride
[], int w
, int h
, int x
, int y
);
263 void vo_draw_osd(struct vo
*vo
, struct osd_state
*osd
);
264 void vo_flip_page(struct vo
*vo
);
265 void vo_check_events(struct vo
*vo
);
266 void vo_destroy(struct vo
*vo
);
269 // NULL terminated array of all drivers
270 extern const struct vo_driver
*video_out_drivers
[];
272 extern int xinerama_screen
;
273 extern int xinerama_x
;
274 extern int xinerama_y
;
276 extern int vo_grabpointer
;
277 extern int vo_doublebuffering
;
278 extern int vo_directrendering
;
281 extern int vo_fsmode
;
282 extern float vo_panscan
;
283 extern int vo_adapter_num
;
284 extern int vo_refresh_rate
;
285 extern int vo_keepaspect
;
286 extern int vo_rootwin
;
287 extern int vo_border
;
289 extern int vo_nomouse_input
;
294 extern char *vo_subdevice
;
296 extern int vo_colorkey
;
298 extern int64_t WinID
;
305 float range_max(range_t
*r
);
306 int in_range(range_t
*r
, float f
);
307 range_t
*str2range(char *s
);
308 extern char *monitor_hfreq_str
;
309 extern char *monitor_vfreq_str
;
310 extern char *monitor_dotclock_str
;
316 int lookup_keymap_table(const struct keymap
*map
, int key
);
318 int left
, right
, top
, bottom
, width
, height
;
320 void calc_src_dst_rects(struct vo
*vo
, int src_width
, int src_height
,
321 struct vo_rect
*src
, struct vo_rect
*dst
,
322 struct vo_rect
*borders
, const struct vo_rect
*crop
);
324 #endif /* MPLAYER_VIDEO_OUT_H */