From a42aae3bf82688c753cfe46fb5b76589879f5ac0 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 29 Oct 2012 02:05:33 +0100 Subject: cleanup: remove some things related to old video decoders --- libmpcodecs/dec_video.c | 34 ++++------------------------------ libmpcodecs/vd.c | 6 +++--- libmpcodecs/vd.h | 25 +++++++------------------ libmpcodecs/vd_ffmpeg.c | 8 ++++---- 4 files changed, 18 insertions(+), 55 deletions(-) diff --git a/libmpcodecs/dec_video.c b/libmpcodecs/dec_video.c index e5dcf690c6..5c6d3113da 100644 --- a/libmpcodecs/dec_video.c +++ b/libmpcodecs/dec_video.c @@ -61,14 +61,6 @@ int get_video_quality_max(sh_video_t *sh_video) return ret; } } - const struct vd_functions *vd = sh_video->vd_driver; - if (vd) { - int ret = vd->control(sh_video, VDCTRL_QUERY_MAX_PP_LEVEL, NULL); - if (ret > 0) { - mp_tmsg(MSGT_DECVIDEO, MSGL_INFO, "[PP] Using codec's postprocessing, max q = %d.\n", ret); - return ret; - } - } return 0; } @@ -86,13 +78,7 @@ int set_video_colors(sh_video_t *sh_video, const char *item, int value) if (ret == CONTROL_TRUE) return 1; } - /* try software control */ - const struct vd_functions *vd = sh_video->vd_driver; - if (vd && - vd->control(sh_video, VDCTRL_SET_EQUALIZER, (void *)item, value) - == CONTROL_OK) - return 1; - mp_tmsg(MSGT_DECVIDEO, MSGL_V, "Video attribute '%s' is not supported by selected vo & vd.\n", + mp_tmsg(MSGT_DECVIDEO, MSGL_V, "Video attribute '%s' is not supported by selected vo.\n", item); return 0; } @@ -112,10 +98,6 @@ int get_video_colors(sh_video_t *sh_video, const char *item, int *value) return 1; } } - /* try software control */ - const struct vd_functions *vd = sh_video->vd_driver; - if (vd) - return vd->control(sh_video, VDCTRL_GET_EQUALIZER, (void *)item, value); return 0; } @@ -181,9 +163,7 @@ void resync_video_stream(sh_video_t *sh_video) void video_reset_aspect(struct sh_video *sh_video) { - int r = sh_video->vd_driver->control(sh_video, VDCTRL_RESET_ASPECT, NULL); - if (r != true) - mpcodecs_config_vo(sh_video, sh_video->disp_w, sh_video->disp_h, 0); + sh_video->vd_driver->control(sh_video, VDCTRL_RESET_ASPECT, NULL); } int get_current_video_decoder_lag(sh_video_t *sh_video) @@ -413,14 +393,8 @@ void *decode_video(sh_video_t *sh_video, struct demux_packet *packet, } } - if (sh_video->vd_driver->decode2) { - mpi = sh_video->vd_driver->decode2(sh_video, packet, start, in_size, - drop_frame, &pts); - } else { - mpi = sh_video->vd_driver->decode(sh_video, start, in_size, - drop_frame); - pts = MP_NOPTS_VALUE; - } + mpi = sh_video->vd_driver->decode(sh_video, packet, start, in_size, + drop_frame, &pts); //------------------------ frame decoded. -------------------- diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c index 511665aeac..e800d14e32 100644 --- a/libmpcodecs/vd.c +++ b/libmpcodecs/vd.c @@ -51,9 +51,9 @@ const vd_functions_t * const mpcodecs_vd_drivers[] = { NULL }; -int mpcodecs_config_vo2(sh_video_t *sh, int w, int h, - const unsigned int *outfmts, - unsigned int preferred_outfmt) +int mpcodecs_config_vo(sh_video_t *sh, int w, int h, + const unsigned int *outfmts, + unsigned int preferred_outfmt) { struct MPOpts *opts = sh->opts; int j; diff --git a/libmpcodecs/vd.h b/libmpcodecs/vd.h index 8b0f9c1aea..6b9803a611 100644 --- a/libmpcodecs/vd.h +++ b/libmpcodecs/vd.h @@ -33,35 +33,24 @@ typedef struct vd_functions const vd_info_t *info; int (*init)(sh_video_t *sh); void (*uninit)(sh_video_t *sh); - int (*control)(sh_video_t *sh, int cmd, void *arg, ...); - mp_image_t * (*decode)(sh_video_t * sh, void *data, int len, int flags); - struct mp_image *(*decode2)(struct sh_video *sh, struct demux_packet *pkt, - void *data, int len, int flags, - double *reordered_pts); + int (*control)(sh_video_t *sh, int cmd, void *arg); + struct mp_image *(*decode)(struct sh_video *sh, struct demux_packet *pkt, + void *data, int len, int flags, + double *reordered_pts); } vd_functions_t; // NULL terminated array of all drivers extern const vd_functions_t *const mpcodecs_vd_drivers[]; #define VDCTRL_QUERY_FORMAT 3 // test for availabilty of a format -#define VDCTRL_QUERY_MAX_PP_LEVEL 4 // query max postprocessing level (if any) -#define VDCTRL_SET_PP_LEVEL 5 // set postprocessing level -#define VDCTRL_SET_EQUALIZER 6 // set color options (brightness,contrast etc) -#define VDCTRL_GET_EQUALIZER 7 // get color options (brightness,contrast etc) #define VDCTRL_RESYNC_STREAM 8 // reset decode state after seeking #define VDCTRL_QUERY_UNSEEN_FRAMES 9 // current decoder lag #define VDCTRL_RESET_ASPECT 10 // reinit filter/VO chain for new aspect ratio // callbacks: -int mpcodecs_config_vo2(sh_video_t *sh, int w, int h, - const unsigned int *outfmts, - unsigned int preferred_outfmt); - -static inline int mpcodecs_config_vo(sh_video_t *sh, int w, int h, - unsigned int preferred_outfmt) -{ - return mpcodecs_config_vo2(sh, w, h, NULL, preferred_outfmt); -} +int mpcodecs_config_vo(sh_video_t *sh, int w, int h, + const unsigned int *outfmts, + unsigned int preferred_outfmt); mp_image_t *mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index 10d494e48c..18cad93bad 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -446,8 +446,8 @@ static int init_vo(sh_video_t *sh, enum PixelFormat pix_fmt) sh->colorspace = avcol_spc_to_mp_csp(avctx->colorspace); sh->color_range = avcol_range_to_mp_csp_levels(avctx->color_range); - if (!mpcodecs_config_vo2(sh, sh->disp_w, sh->disp_h, supported_fmts, - ctx->best_csp)) + if (!mpcodecs_config_vo(sh, sh->disp_w, sh->disp_h, supported_fmts, + ctx->best_csp)) return -1; ctx->vo_initialized = 1; } @@ -806,7 +806,7 @@ static enum PixelFormat get_format(struct AVCodecContext *avctx, return fmt[i]; } -static int control(sh_video_t *sh, int cmd, void *arg, ...) +static int control(sh_video_t *sh, int cmd, void *arg) { vd_ffmpeg_ctx *ctx = sh->context; AVCodecContext *avctx = ctx->avctx; @@ -851,5 +851,5 @@ const struct vd_functions mpcodecs_vd_ffmpeg = { .init = init, .uninit = uninit, .control = control, - .decode2 = decode + .decode = decode, }; -- cgit v1.2.3