diff options
Diffstat (limited to 'libvo/video_out.h')
-rw-r--r-- | libvo/video_out.h | 136 |
1 files changed, 93 insertions, 43 deletions
diff --git a/libvo/video_out.h b/libvo/video_out.h index f90123ddee..6d4b405e56 100644 --- a/libvo/video_out.h +++ b/libvo/video_out.h @@ -60,7 +60,15 @@ #define VOCTRL_SET_PANSCAN 16 /* equalizer controls */ #define VOCTRL_SET_EQUALIZER 17 +struct voctrl_set_equalizer_args { + const char *name; + int value; +}; #define VOCTRL_GET_EQUALIZER 18 +struct voctrl_get_equalizer_args { + const char *name; + int *valueptr; +}; //#define VOCTRL_GUI_NOWINDOW 19 /* Frame duplication */ #define VOCTRL_DUPLICATE_FRAME 20 @@ -92,6 +100,8 @@ typedef struct { } mp_colorkey_t; #define VOCTRL_XOVERLAY_SET_WIN 23 +#define VOCTRL_REDRAW_OSD 24 + typedef struct { int x,y; int w,h; @@ -121,15 +131,24 @@ typedef struct vo_info_s const char *comment; } vo_info_t; -typedef struct vo_functions_s -{ +struct vo; +struct osd_state; + +struct vo_driver { + // Driver uses new API + int is_new; + + // This is set if the driver is not new and contains pointers to + // old-API functions to be used instead of the ones below. + struct vo_old_functions *old_functions; + const vo_info_t *info; /* * Preinitializes driver (real INITIALIZATION) * arg - currently it's vo_subdevice * returns: zero on successful initialization, non-zero on error. */ - int (*preinit)(const char *arg); + int (*preinit)(struct vo *vo, const char *arg); /* * Initialize (means CONFIGURE) the display driver. * params: @@ -140,21 +159,21 @@ typedef struct vo_functions_s * format: fourcc of pixel format * returns : zero on successful initialization, non-zero on error. */ - int (*config)(uint32_t width, uint32_t height, uint32_t d_width, - uint32_t d_height, uint32_t fullscreen, char *title, - uint32_t format); + int (*config)(struct vo *vo, uint32_t width, uint32_t height, + uint32_t d_width, uint32_t d_height, uint32_t fullscreen, + char *title, uint32_t format); /* * Control interface */ - int (*control)(uint32_t request, void *data, ...); + int (*control)(struct vo *vo, uint32_t request, void *data); /* * Display a new RGB/BGR frame of the video to the screen. * params: * src[0] - pointer to the image */ - int (*draw_frame)(uint8_t *src[]); + int (*draw_frame)(struct vo *vo, uint8_t *src[]); /* * Draw a planar YUV slice to the buffer: @@ -164,60 +183,100 @@ typedef struct vo_functions_s * w,h = width*height of area to be copied (in Y pixels) * x,y = position at the destination image (in Y pixels) */ - int (*draw_slice)(uint8_t *src[], int stride[], int w,int h, int x,int y); + int (*draw_slice)(struct vo *vo, uint8_t *src[], int stride[], int w, + int h, int x, int y); /* * Draws OSD to the screen buffer */ - void (*draw_osd)(void); + void (*draw_osd)(struct vo *vo, struct osd_state *osd); /* * Blit/Flip buffer to the screen. Must be called after each frame! */ - void (*flip_page)(void); + void (*flip_page)(struct vo *vo); /* * This func is called after every frames to handle keyboard and * other events. It's called in PAUSE mode too! */ - void (*check_events)(void); + void (*check_events)(struct vo *vo); /* * Closes driver. Should restore the original state of the system. */ - void (*uninit)(void); + void (*uninit)(struct vo *vo); +}; -} vo_functions_t; +struct vo_old_functions { + int (*preinit)(const char *arg); + int (*config)(uint32_t width, uint32_t height, uint32_t d_width, + uint32_t d_height, uint32_t fullscreen, char *title, + uint32_t format); + int (*control)(uint32_t request, void *data); + int (*draw_frame)(uint8_t *src[]); + int (*draw_slice)(uint8_t *src[], int stride[], int w,int h, int x,int y); + void (*draw_osd)(void); + void (*flip_page)(void); + void (*check_events)(void); + void (*uninit)(void); +}; + +struct vo { + int config_ok; // Last config call was successful? + int config_count; // Total number of successful config calls + const struct vo_driver *driver; + void *priv; + struct MPOpts *opts; + struct vo_x11_state *x11; + struct mp_fifo *key_fifo; + struct input_ctx *input_ctx; + + // requested position/resolution + int dx; + int dy; + int dwidth; + int dheight; + + int panscan_x; + int panscan_y; + float panscan_amount; + float monitor_aspect; + struct aspect_data { + int orgw; // real width + int orgh; // real height + int prew; // prescaled width + int preh; // prescaled height + int scrw; // horizontal resolution + int scrh; // vertical resolution + float asp; + } aspdat; +}; -const vo_functions_t* init_best_video_out(char** vo_list); -int config_video_out(const vo_functions_t *vo, uint32_t width, uint32_t height, +struct vo *init_best_video_out(struct MPOpts *opts, struct vo_x11_state *x11, + struct mp_fifo *key_fifo, + struct input_ctx *input_ctx); +int vo_config(struct vo *vo, uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format); void list_video_out(void); -// NULL terminated array of all drivers -extern const vo_functions_t* const video_out_drivers[]; +int vo_control(struct vo *vo, uint32_t request, void *data); +int vo_draw_frame(struct vo *vo, uint8_t *src[]); +int vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[], int w, int h, int x, int y); +void vo_draw_osd(struct vo *vo, struct osd_state *osd); +void vo_flip_page(struct vo *vo); +void vo_check_events(struct vo *vo); +void vo_destroy(struct vo *vo); -extern int vo_flags; -extern int vo_config_count; +// NULL terminated array of all drivers +extern const struct vo_driver *video_out_drivers[]; extern int xinerama_screen; extern int xinerama_x; extern int xinerama_y; -// correct resolution/bpp on screen: (should be autodetected by vo_init()) -extern int vo_depthonscreen; -extern int vo_screenwidth; -extern int vo_screenheight; - -// requested resolution/bpp: (-x -y -bpp options) -extern int vo_dx; -extern int vo_dy; -extern int vo_dwidth; -extern int vo_dheight; -extern int vo_dbpp; - extern int vo_grabpointer; extern int vo_doublebuffering; extern int vo_directrendering; @@ -229,18 +288,8 @@ extern int vo_adapter_num; extern int vo_refresh_rate; extern int vo_keepaspect; extern int vo_rootwin; -extern int vo_ontop; extern int vo_border; -extern int vo_gamma_gamma; -extern int vo_gamma_brightness; -extern int vo_gamma_saturation; -extern int vo_gamma_contrast; -extern int vo_gamma_hue; -extern int vo_gamma_red_intensity; -extern int vo_gamma_green_intensity; -extern int vo_gamma_blue_intensity; - extern int vo_nomouse_input; extern int vo_pts; @@ -272,7 +321,8 @@ int lookup_keymap_table(const struct keymap *map, int key); struct vo_rect { int left, right, top, bottom, width, height; }; -void calc_src_dst_rects(int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst, +void calc_src_dst_rects(struct vo *vo, int src_width, int src_height, + struct vo_rect *src, struct vo_rect *dst, struct vo_rect *borders, const struct vo_rect *crop); #endif /* MPLAYER_VIDEO_OUT_H */ |