From 88e813aae6f2a91177b450a46c04a26db276c422 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 15 Jul 2013 00:57:04 +0200 Subject: vf: add vf_control wrapper Slightly cleaner, although rather redundant. But still, why wasn't this added 10 years ago? --- video/decode/dec_video.c | 12 ++++++------ video/filter/vf.c | 5 +++++ video/filter/vf.h | 1 + 3 files changed, 12 insertions(+), 6 deletions(-) (limited to 'video') diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c index ac351db6b6..93359196eb 100644 --- a/video/decode/dec_video.c +++ b/video/decode/dec_video.c @@ -55,7 +55,7 @@ int get_video_quality_max(sh_video_t *sh_video) { vf_instance_t *vf = sh_video->vfilter; if (vf) { - int ret = vf->control(vf, VFCTRL_QUERY_MAX_PP_LEVEL, NULL); + int ret = vf_control(vf, VFCTRL_QUERY_MAX_PP_LEVEL, NULL); if (ret > 0) { mp_tmsg(MSGT_DECVIDEO, MSGL_INFO, "[PP] Using external postprocessing filter, max q = %d.\n", ret); return ret; @@ -74,7 +74,7 @@ int set_video_colors(sh_video_t *sh_video, const char *item, int value) mp_dbg(MSGT_DECVIDEO, MSGL_V, "set video colors %s=%d \n", item, value); if (vf) { - int ret = vf->control(vf, VFCTRL_SET_EQUALIZER, &data); + int ret = vf_control(vf, VFCTRL_SET_EQUALIZER, &data); if (ret == CONTROL_TRUE) return 1; } @@ -92,7 +92,7 @@ int get_video_colors(sh_video_t *sh_video, const char *item, int *value) mp_dbg(MSGT_DECVIDEO, MSGL_V, "get video colors %s \n", item); if (vf) { - int ret = vf->control(vf, VFCTRL_GET_EQUALIZER, &data); + int ret = vf_control(vf, VFCTRL_GET_EQUALIZER, &data); if (ret == CONTROL_TRUE) { *value = data.value; return 1; @@ -129,10 +129,10 @@ void set_video_colorspace(struct sh_video *sh) struct mp_csp_details requested; get_detected_video_colorspace(sh, &requested); - vf->control(vf, VFCTRL_SET_YUV_COLORSPACE, &requested); + vf_control(vf, VFCTRL_SET_YUV_COLORSPACE, &requested); struct mp_csp_details actual = MP_CSP_DETAILS_DEFAULTS; - vf->control(vf, VFCTRL_GET_YUV_COLORSPACE, &actual); + vf_control(vf, VFCTRL_GET_YUV_COLORSPACE, &actual); int success = actual.format == requested.format && actual.levels_in == requested.levels_in @@ -146,7 +146,7 @@ void set_video_colorspace(struct sh_video *sh) && requested.format == MP_CSP_SMPTE_240M) { // BT.709 is pretty close, much better than BT.601 requested.format = MP_CSP_BT_709; - vf->control(vf, VFCTRL_SET_YUV_COLORSPACE, &requested); + vf_control(vf, VFCTRL_SET_YUV_COLORSPACE, &requested); } } diff --git a/video/filter/vf.c b/video/filter/vf.c index 1402ad3efc..1570e8402c 100644 --- a/video/filter/vf.c +++ b/video/filter/vf.c @@ -123,6 +123,11 @@ const m_obj_list_t vf_obj_list = { M_ST_OFF(vf_info_t, opts) }; +int vf_control(struct vf_instance *vf, int cmd, void *arg) +{ + return vf->control(vf, cmd, arg); +} + // Get a new image for filter output, with size and pixel format according to // the last vf_config call. struct mp_image *vf_alloc_out_image(struct vf_instance *vf) diff --git a/video/filter/vf.h b/video/filter/vf.h index 638fc30a61..be1243e3a4 100644 --- a/video/filter/vf.h +++ b/video/filter/vf.h @@ -109,6 +109,7 @@ typedef struct vf_seteq { #define VFCTRL_SET_YUV_COLORSPACE 22 // arg is struct mp_csp_details* #define VFCTRL_GET_YUV_COLORSPACE 23 // arg is struct mp_csp_details* +int vf_control(struct vf_instance *vf, int cmd, void *arg); struct mp_image *vf_alloc_out_image(struct vf_instance *vf); void vf_make_out_image_writeable(struct vf_instance *vf, struct mp_image *img); -- cgit v1.2.3