From 22872451369fe219990c6280fc0d1c0c0c344b55 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 7 Aug 2012 01:26:11 +0200 Subject: VO: remove old VO glue This transition to a new VO API started over 4 years ago. It's time to finally end it, and get rid of the horrible hacks. Also removes some previously undetected dead code from spudec.c. --- Makefile | 1 - libmpcodecs/vf_vo.c | 3 +- libvo/aspect.h | 16 ------- libvo/gl_common.c | 1 - libvo/old_vo_defines.h | 24 ---------- libvo/old_vo_wrapper.c | 117 --------------------------------------------- libvo/old_vo_wrapper.h | 29 ----------- libvo/video_out.c | 9 ---- libvo/video_out.h | 19 -------- libvo/video_out_internal.h | 72 ---------------------------- libvo/x11_common.h | 43 ----------------- mp_fifo.h | 5 -- sub/spudec.c | 13 +---- sub/spudec.h | 2 +- sub/sub.h | 5 -- 15 files changed, 3 insertions(+), 356 deletions(-) delete mode 100644 libvo/old_vo_defines.h delete mode 100644 libvo/old_vo_wrapper.c delete mode 100644 libvo/old_vo_wrapper.h delete mode 100644 libvo/video_out_internal.h diff --git a/Makefile b/Makefile index 4aa48794f1..db8c61218a 100644 --- a/Makefile +++ b/Makefile @@ -419,7 +419,6 @@ SRCS_MPLAYER = command.c \ libvo/csputils.c \ libvo/filter_kernels.c \ libvo/geometry.c \ - libvo/old_vo_wrapper.c \ libvo/video_out.c \ libvo/vo_null.c \ libvo/vo_image.c \ diff --git a/libmpcodecs/vf_vo.c b/libmpcodecs/vf_vo.c index 6cf7a7a3ac..0c747beb83 100644 --- a/libmpcodecs/vf_vo.c +++ b/libmpcodecs/vf_vo.c @@ -216,8 +216,7 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) if (vf->default_caps & VFCAP_ACCEPT_STRIDE) vo_draw_slice(video_out, mpi->planes, mpi->stride, mpi->w, mpi->h, 0, 0); - else - vo_draw_frame(video_out, mpi->planes); + // else: out of luck } return 1; } diff --git a/libvo/aspect.h b/libvo/aspect.h index f5ff1a8ad7..aa117833f3 100644 --- a/libvo/aspect.h +++ b/libvo/aspect.h @@ -37,20 +37,4 @@ void aspect_save_screenres(struct vo *vo, int scrw, int scrh); void aspect(struct vo *vo, int *srcw, int *srch, int zoom); void aspect_fit(struct vo *vo, int *srcw, int *srch, int fitw, int fith); - -#ifdef IS_OLD_VO -#define vo_panscan_x global_vo->panscan_x -#define vo_panscan_y global_vo->panscan_y -#define vo_panscan_amount global_vo->panscan_amount -#define monitor_aspect global_vo->monitor_aspect - -#define panscan_init() panscan_init(global_vo) -#define panscan_calc() panscan_calc(global_vo) -#define panscan_calc_windowed() panscan_calc_windowed(global_vo) -#define aspect_save_orig(...) aspect_save_orig(global_vo, __VA_ARGS__) -#define aspect_save_prescale(...) aspect_save_prescale(global_vo, __VA_ARGS__) -#define aspect_save_screenres(...) aspect_save_screenres(global_vo, __VA_ARGS__) -#define aspect(...) aspect(global_vo, __VA_ARGS__) -#endif - #endif /* MPLAYER_ASPECT_H */ diff --git a/libvo/gl_common.c b/libvo/gl_common.c index 1c156277dc..1ad7017e10 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -41,7 +41,6 @@ #include #include "talloc.h" #include "gl_common.h" -#include "old_vo_wrapper.h" #include "csputils.h" #include "aspect.h" #include "pnm_loader.h" diff --git a/libvo/old_vo_defines.h b/libvo/old_vo_defines.h deleted file mode 100644 index feded12d5b..0000000000 --- a/libvo/old_vo_defines.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef MPLAYER_OLD_VO_DEFINES_H -#define MPLAYER_OLD_VO_DEFINES_H - -#include "options.h" -#include "video_out.h" -#include "old_vo_wrapper.h" - -// Triggers more defines in x11_common.h -#define IS_OLD_VO 1 - -#define vo_ontop global_vo->opts->vo_ontop -#define vo_config_count global_vo->config_count -#define vo_dx global_vo->dx -#define vo_dy global_vo->dy -#define vo_dwidth global_vo->dwidth -#define vo_dheight global_vo->dheight -#define vo_dbpp global_vo->opts->vo_dbpp -#define vo_screenwidth global_vo->opts->vo_screenwidth -#define vo_screenheight global_vo->opts->vo_screenheight -#define vidmode global_vo->opts->vidmode -#define movie_aspect global_vo->opts->movie_aspect - -#define calc_src_dst_rects(...) calc_src_dst_rects(global_vo, __VA_ARGS__) -#endif diff --git a/libvo/old_vo_wrapper.c b/libvo/old_vo_wrapper.c deleted file mode 100644 index b3053eb57f..0000000000 --- a/libvo/old_vo_wrapper.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - - -#include -#include "old_vo_wrapper.h" -#include "video_out.h" -#include "sub/sub.h" - -struct vo *global_vo; -struct osd_state *global_osd; - -int old_vo_preinit(struct vo *vo, const char *arg) -{ - global_vo = vo; - return vo->driver->old_functions->preinit(arg); -} - - -int old_vo_config(struct vo *vo, uint32_t width, uint32_t height, - uint32_t d_width, uint32_t d_height, - uint32_t flags, uint32_t format) -{ - return vo->driver->old_functions->config(width, height, d_width, - d_height, flags, "MPlayer", - format); -} - - -int old_vo_control(struct vo *vo, uint32_t request, void *data) -{ - return vo->driver->old_functions->control(request, data); -} - - -int old_vo_draw_frame(struct vo *vo, uint8_t *src[]) -{ - return vo->driver->old_functions->draw_frame(src); -} - - -int old_vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[], - int w, int h, int x, int y) -{ - return vo->driver->old_functions->draw_slice(src, stride, w, h, x, y); -} - - -void old_vo_draw_osd(struct vo *vo, struct osd_state *osd) -{ - global_osd = osd; - vo->driver->old_functions->draw_osd(); -} - - -void old_vo_flip_page(struct vo *vo) -{ - vo->driver->old_functions->flip_page(); -} - - -void old_vo_check_events(struct vo *vo) -{ - vo->driver->old_functions->check_events(); -} - - -void old_vo_uninit(struct vo *vo) -{ - vo->driver->old_functions->uninit(); -} - - -static void draw_alpha_wrapper(void *ctx, int x0, int y0, int w, int h, - unsigned char *src, unsigned char *srca, - int stride) -{ - void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) = ctx; - draw_alpha(x0, y0, w, h, src, srca, stride); -} - - -void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)) -{ - osd_draw_text(global_osd, dxs, dys, draw_alpha_wrapper, draw_alpha); -} - -void vo_draw_text_ext(int dxs, int dys, int left_border, int top_border, - int right_border, int bottom_border, int orig_w, int orig_h, - void (*draw_alpha)(int x0, int y0, int w,int h, - unsigned char* src, - unsigned char *srca, int stride)) -{ - osd_draw_text_ext(global_osd, dxs, dys, left_border, top_border, - right_border, bottom_border, orig_w, orig_h, - draw_alpha_wrapper, draw_alpha); -} - -int vo_update_osd(int dxs, int dys) -{ - return osd_update(global_osd, dxs, dys); -} diff --git a/libvo/old_vo_wrapper.h b/libvo/old_vo_wrapper.h deleted file mode 100644 index f18ee296f4..0000000000 --- a/libvo/old_vo_wrapper.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef MPLAYER_OLD_VO_WRAPPER_H -#define MPLAYER_OLD_VO_WRAPPER_H - -#include -#include "video_out.h" - -extern struct vo *global_vo; -extern struct osd_state *global_osd; - -int old_vo_preinit(struct vo *vo, const char *); -int old_vo_config(struct vo *vo, uint32_t width, uint32_t height, - uint32_t d_width, uint32_t d_height, - uint32_t flags, uint32_t format); -int old_vo_control(struct vo *vo, uint32_t request, void *data); -int old_vo_draw_frame(struct vo *vo, uint8_t *src[]); -int old_vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[], - int w, int h, int x, int y); -void old_vo_draw_osd(struct vo *vo, struct osd_state *osd); -void old_vo_flip_page(struct vo *vo); -void old_vo_check_events(struct vo *vo); -void old_vo_uninit(struct vo *vo); - -void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)); -void vo_draw_text_ext(int dxs, int dys, int left_border, int top_border, - int right_border, int bottom_border, int orig_w, int orig_h, - void (*draw_alpha)(int x0, int y0, int w,int h,unsigned char* src, unsigned char *srca, int stride)); -int vo_update_osd(int dxs, int dys); - -#endif diff --git a/libvo/video_out.c b/libvo/video_out.c index 5ae219093f..218dd36d1b 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c @@ -33,7 +33,6 @@ #include "video_out.h" #include "aspect.h" #include "geometry.h" -#include "old_vo_wrapper.h" #include "input/input.h" #include "mp_fifo.h" #include "m_config.h" @@ -219,14 +218,6 @@ void vo_skip_frame(struct vo *vo) vo->frame_loaded = false; } -int vo_draw_frame(struct vo *vo, uint8_t *src[]) -{ - assert(!vo->driver->is_new); - if (!vo->config_ok) - return 0; - return old_vo_draw_frame(vo, src); -} - int vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[], int w, int h, int x, int y) { return vo->driver->draw_slice(vo, src, stride, w, h, x, y); diff --git a/libvo/video_out.h b/libvo/video_out.h index 6cc7c0d02f..3042efd8d2 100644 --- a/libvo/video_out.h +++ b/libvo/video_out.h @@ -156,10 +156,6 @@ struct vo_driver { // of pts values itself bool buffer_frames; - // 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) @@ -239,20 +235,6 @@ struct vo_driver { const struct m_option *options; }; -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 @@ -313,7 +295,6 @@ int vo_draw_image(struct vo *vo, struct mp_image *mpi, double pts); int vo_redraw_frame(struct vo *vo); int vo_get_buffered_frame(struct vo *vo, bool eof); void vo_skip_frame(struct vo *vo); -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_new_frame_imminent(struct vo *vo); void vo_draw_osd(struct vo *vo, struct osd_state *osd); diff --git a/libvo/video_out_internal.h b/libvo/video_out_internal.h deleted file mode 100644 index 263a94e695..0000000000 --- a/libvo/video_out_internal.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) Aaron Holtzman - Aug 1999 - * - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPLAYER_VIDEO_OUT_INTERNAL_H -#define MPLAYER_VIDEO_OUT_INTERNAL_H - -#include - -/* All video drivers will want this */ -#include "libmpcodecs/vfcap.h" -#include "libmpcodecs/mp_image.h" -#include "geometry.h" -#include "old_vo_wrapper.h" -#include "old_vo_defines.h" - -static int control(uint32_t request, void *data); -static int config(uint32_t width, uint32_t height, uint32_t d_width, - uint32_t d_height, uint32_t fullscreen, char *title, - uint32_t format); -static int draw_frame(uint8_t *src[]); -static int draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y); -static void draw_osd(void); -static void flip_page(void); -static void check_events(void); -static void uninit(void); -static int preinit(const char *); - -#define LIBVO_EXTERN(x) struct vo_driver video_out_##x =\ -{\ - .is_new = 0,\ - .info = &info,\ - .preinit = old_vo_preinit,\ - .config = old_vo_config,\ - .control = old_vo_control,\ - .draw_slice = old_vo_draw_slice,\ - .draw_osd = old_vo_draw_osd,\ - .flip_page = old_vo_flip_page,\ - .check_events = old_vo_check_events,\ - .uninit = old_vo_uninit,\ - .old_functions = &(struct vo_old_functions){\ - preinit,\ - config,\ - control,\ - draw_frame,\ - draw_slice,\ - draw_osd,\ - flip_page,\ - check_events,\ - uninit,\ - }\ -}; - -#include "osd.h" - -#endif /* MPLAYER_VIDEO_OUT_INTERNAL_H */ diff --git a/libvo/x11_common.h b/libvo/x11_common.h index bd340c822d..87be7181f3 100644 --- a/libvo/x11_common.h +++ b/libvo/x11_common.h @@ -188,47 +188,4 @@ void update_xinerama_info(struct vo *vo); int vo_find_depth_from_visuals(Display *dpy, int screen, Visual **visual_return); void xscreensaver_heartbeat(struct vo_x11_state *x11); -// Old VOs use incompatible function calls, translate them to new -// prototypes -#ifdef IS_OLD_VO -#define vo_x11_create_vo_window(vis, x, y, width, height, flags, col_map, classname, title) \ - vo_x11_create_vo_window(global_vo, vis, x, y, width, height, flags, col_map, classname) -#define vo_x11_fullscreen() vo_x11_fullscreen(global_vo) -#define vo_x11_update_geometry() vo_x11_update_geometry(global_vo, 1) -#define vo_x11_ontop() vo_x11_ontop(global_vo) -#define vo_init() vo_init(global_vo) -#define vo_x11_ewmh_fullscreen(action) vo_x11_ewmh_fullscreen(global_vo->x11->display, action) -#define update_xinerama_info() update_xinerama_info(global_vo) -#define vo_x11_uninit() vo_x11_uninit(global_vo) -#define vo_x11_check_events(display) vo_x11_check_events(global_vo) -#define vo_x11_sizehint(...) vo_x11_sizehint(global_vo, __VA_ARGS__) -#define vo_vm_switch() vo_vm_switch(global_vo) -#define vo_x11_create_colormap(vinfo) vo_x11_create_colormap(global_vo, vinfo) -#define vo_x11_set_equalizer(...) vo_x11_set_equalizer(global_vo, __VA_ARGS__) -#define vo_xv_set_eq(...) vo_xv_set_eq(global_vo, __VA_ARGS__) -#define vo_xv_get_eq(...) vo_xv_get_eq(global_vo, __VA_ARGS__) -#define vo_xv_enable_vsync() vo_xv_enable_vsync(global_vo) -#define vo_xv_get_max_img_dim(...) vo_xv_get_max_img_dim(global_vo, __VA_ARGS__) -#define vo_xv_init_colorkey() vo_xv_init_colorkey(global_vo) -#define vo_xv_draw_colorkey(...) vo_xv_draw_colorkey(global_vo, __VA_ARGS__) -#define vo_x11_clearwindow_part(display, ...) vo_x11_clearwindow_part(global_vo, __VA_ARGS__) -#define vo_vm_close() vo_vm_close(global_vo) -#define vo_x11_clearwindow(display, window) vo_x11_clearwindow(global_vo, window) -#define vo_x11_classhint(display, window, name) vo_x11_classhint(global_vo, window, name) -#define vo_x11_setlayer(display, window, layer) vo_x11_setlayer(global_vo, window, layer) -#define xv_setup_colorkeyhandling(a, b) xv_setup_colorkeyhandling(global_vo, a, b) -#define vo_x11_border() vo_x11_border(global_vo) - -#define mDisplay global_vo->x11->display -#define vo_depthonscreen global_vo->x11->depthonscreen -#define vo_window global_vo->x11->window -#define xv_ck_info global_vo->x11->xv_ck_info -#define xv_colorkey global_vo->x11->xv_colorkey -#define xv_port global_vo->x11->xv_port -#define vo_gc global_vo->x11->vo_gc -#define mRootWin global_vo->x11->rootwin -#define mScreen global_vo->x11->screen -#define mLocalDisplay global_vo->x11->display_is_local -#endif - #endif /* MPLAYER_X11_COMMON_H */ diff --git a/mp_fifo.h b/mp_fifo.h index aa7fde0f29..015286db83 100644 --- a/mp_fifo.h +++ b/mp_fifo.h @@ -29,9 +29,4 @@ struct input_ctx; struct MPOpts; struct mp_fifo *mp_fifo_create(struct input_ctx *input, struct MPOpts *opts); - -#ifdef IS_OLD_VO -#define mplayer_put_key(key) mplayer_put_key(global_vo->key_fifo, key) -#endif - #endif /* MPLAYER_MP_FIFO_H */ diff --git a/sub/spudec.c b/sub/spudec.c index 82e8f2f793..47a3dec22a 100644 --- a/sub/spudec.c +++ b/sub/spudec.c @@ -42,7 +42,6 @@ #include "config.h" #include "mp_msg.h" -#include "libvo/video_out.h" #include "spudec.h" #include "vobsub.h" #include "mpcommon.h" @@ -119,7 +118,6 @@ typedef struct { unsigned char *scaled_aimage; int auto_palette; /* 1 if we lack a palette and must use an heuristic. */ int font_start_level; /* Darkest value used for the computed font */ - struct vo *hw_spu; int spu_changed; unsigned int forced_subs_only; /* flag: 0=display all subtitle, !0 display only forced subtitles */ unsigned int is_forced_sub; /* true if current subtitle is a forced subtitle */ @@ -580,16 +578,7 @@ static void spudec_process_control(spudec_handle_t *this, int pts100) static void spudec_decode(spudec_handle_t *this, int pts100) { - if (!this->hw_spu) - spudec_process_control(this, pts100); - else if (pts100 >= 0) { - static vo_mpegpes_t packet = { NULL, 0, 0x20, 0 }; - static vo_mpegpes_t *pkg=&packet; - packet.data = this->packet; - packet.size = this->packet_size; - packet.timestamp = pts100; - vo_draw_frame(this->hw_spu, (uint8_t**)&pkg); - } + spudec_process_control(this, pts100); } int spudec_changed(void * this) diff --git a/sub/spudec.h b/sub/spudec.h index 533ac511e8..6104ad7228 100644 --- a/sub/spudec.h +++ b/sub/spudec.h @@ -19,7 +19,7 @@ #ifndef MPLAYER_SPUDEC_H #define MPLAYER_SPUDEC_H -#include "libvo/video_out.h" +#include void spudec_heartbeat(void *this, unsigned int pts100); void spudec_assemble(void *this, unsigned char *packet, unsigned int len, int pts100); diff --git a/sub/sub.h b/sub/sub.h index 35f213d2db..de8fbc6487 100644 --- a/sub/sub.h +++ b/sub/sub.h @@ -175,11 +175,6 @@ void osd_free(struct osd_state *osd); void osd_set_nav_box (uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey); #endif - -#ifdef IS_OLD_VO -#define vo_remove_text(...) osd_remove_text(global_osd, __VA_ARGS__) -#endif - // used only by osd_ft.c or osd_libass.c void osd_alloc_buf(mp_osd_obj_t* obj); void vo_draw_text_from_buffer(mp_osd_obj_t* obj,void (*draw_alpha)(void *ctx, int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride), void *ctx); -- cgit v1.2.3