cleanup: remove some things related to old video decoders

This commit is contained in:
wm4 2012-10-29 02:05:33 +01:00
parent 62dc32250e
commit a42aae3bf8
4 changed files with 18 additions and 55 deletions

View File

@ -61,14 +61,6 @@ int get_video_quality_max(sh_video_t *sh_video)
return ret; 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; return 0;
} }
@ -86,13 +78,7 @@ int set_video_colors(sh_video_t *sh_video, const char *item, int value)
if (ret == CONTROL_TRUE) if (ret == CONTROL_TRUE)
return 1; return 1;
} }
/* try software control */ mp_tmsg(MSGT_DECVIDEO, MSGL_V, "Video attribute '%s' is not supported by selected vo.\n",
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",
item); item);
return 0; return 0;
} }
@ -112,10 +98,6 @@ int get_video_colors(sh_video_t *sh_video, const char *item, int *value)
return 1; 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; return 0;
} }
@ -181,9 +163,7 @@ void resync_video_stream(sh_video_t *sh_video)
void video_reset_aspect(struct sh_video *sh_video) void video_reset_aspect(struct sh_video *sh_video)
{ {
int r = sh_video->vd_driver->control(sh_video, VDCTRL_RESET_ASPECT, NULL); 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);
} }
int get_current_video_decoder_lag(sh_video_t *sh_video) 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->decode(sh_video, packet, start, in_size,
mpi = sh_video->vd_driver->decode2(sh_video, packet, start, in_size, drop_frame, &pts);
drop_frame, &pts);
} else {
mpi = sh_video->vd_driver->decode(sh_video, start, in_size,
drop_frame);
pts = MP_NOPTS_VALUE;
}
//------------------------ frame decoded. -------------------- //------------------------ frame decoded. --------------------

View File

@ -51,9 +51,9 @@ const vd_functions_t * const mpcodecs_vd_drivers[] = {
NULL NULL
}; };
int mpcodecs_config_vo2(sh_video_t *sh, int w, int h, int mpcodecs_config_vo(sh_video_t *sh, int w, int h,
const unsigned int *outfmts, const unsigned int *outfmts,
unsigned int preferred_outfmt) unsigned int preferred_outfmt)
{ {
struct MPOpts *opts = sh->opts; struct MPOpts *opts = sh->opts;
int j; int j;

View File

@ -33,35 +33,24 @@ typedef struct vd_functions
const vd_info_t *info; const vd_info_t *info;
int (*init)(sh_video_t *sh); int (*init)(sh_video_t *sh);
void (*uninit)(sh_video_t *sh); void (*uninit)(sh_video_t *sh);
int (*control)(sh_video_t *sh, int cmd, void *arg, ...); 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 *(*decode)(struct sh_video *sh, struct demux_packet *pkt,
struct mp_image *(*decode2)(struct sh_video *sh, struct demux_packet *pkt, void *data, int len, int flags,
void *data, int len, int flags, double *reordered_pts);
double *reordered_pts);
} vd_functions_t; } vd_functions_t;
// NULL terminated array of all drivers // NULL terminated array of all drivers
extern const vd_functions_t *const mpcodecs_vd_drivers[]; extern const vd_functions_t *const mpcodecs_vd_drivers[];
#define VDCTRL_QUERY_FORMAT 3 // test for availabilty of a format #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_RESYNC_STREAM 8 // reset decode state after seeking
#define VDCTRL_QUERY_UNSEEN_FRAMES 9 // current decoder lag #define VDCTRL_QUERY_UNSEEN_FRAMES 9 // current decoder lag
#define VDCTRL_RESET_ASPECT 10 // reinit filter/VO chain for new aspect ratio #define VDCTRL_RESET_ASPECT 10 // reinit filter/VO chain for new aspect ratio
// callbacks: // callbacks:
int mpcodecs_config_vo2(sh_video_t *sh, int w, int h, int mpcodecs_config_vo(sh_video_t *sh, int w, int h,
const unsigned int *outfmts, const unsigned int *outfmts,
unsigned int preferred_outfmt); 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);
}
mp_image_t *mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, mp_image_t *mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag,
int w, int h); int w, int h);

View File

@ -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->colorspace = avcol_spc_to_mp_csp(avctx->colorspace);
sh->color_range = avcol_range_to_mp_csp_levels(avctx->color_range); 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, if (!mpcodecs_config_vo(sh, sh->disp_w, sh->disp_h, supported_fmts,
ctx->best_csp)) ctx->best_csp))
return -1; return -1;
ctx->vo_initialized = 1; ctx->vo_initialized = 1;
} }
@ -806,7 +806,7 @@ static enum PixelFormat get_format(struct AVCodecContext *avctx,
return fmt[i]; 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; vd_ffmpeg_ctx *ctx = sh->context;
AVCodecContext *avctx = ctx->avctx; AVCodecContext *avctx = ctx->avctx;
@ -851,5 +851,5 @@ const struct vd_functions mpcodecs_vd_ffmpeg = {
.init = init, .init = init,
.uninit = uninit, .uninit = uninit,
.control = control, .control = control,
.decode2 = decode .decode = decode,
}; };