mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
f3bb6692c7
commit
2287245136
1
Makefile
1
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 \
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#include <math.h>
|
||||
#include "talloc.h"
|
||||
#include "gl_common.h"
|
||||
#include "old_vo_wrapper.h"
|
||||
#include "csputils.h"
|
||||
#include "aspect.h"
|
||||
#include "pnm_loader.h"
|
||||
|
|
|
@ -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
|
|
@ -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 <stdint.h>
|
||||
#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);
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef MPLAYER_OLD_VO_WRAPPER_H
|
||||
#define MPLAYER_OLD_VO_WRAPPER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#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
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 <stdint.h>
|
||||
|
||||
/* 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 */
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
13
sub/spudec.c
13
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)
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#ifndef MPLAYER_SPUDEC_H
|
||||
#define MPLAYER_SPUDEC_H
|
||||
|
||||
#include "libvo/video_out.h"
|
||||
#include <stdint.h>
|
||||
|
||||
void spudec_heartbeat(void *this, unsigned int pts100);
|
||||
void spudec_assemble(void *this, unsigned char *packet, unsigned int len, int pts100);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue