From 2f46b23d51684eef7cfa2bd5fa5e2892772ca816 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 10 Dec 2013 19:08:56 +0100 Subject: video: move handling of brightness and deinterlacing control Handling of brightness/gamma/saturation/etc. and deinterlacing is moved from vf_vo.c to dec_video.c. --- video/decode/dec_video.c | 40 ++++++++++++++++++++++++++++++++++++++-- video/decode/dec_video.h | 5 ++++- video/filter/vf_vo.c | 27 --------------------------- 3 files changed, 42 insertions(+), 30 deletions(-) (limited to 'video') diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c index 4e97ef33ef..02e52368de 100644 --- a/video/decode/dec_video.c +++ b/video/decode/dec_video.c @@ -88,7 +88,7 @@ int video_set_colors(struct dec_video *d_video, const char *item, int value) mp_dbg(MSGT_DECVIDEO, MSGL_V, "set video colors %s=%d \n", item, value); if (d_video->vfilter) { - int ret = vf_control_any(d_video->vfilter, VFCTRL_SET_EQUALIZER, &data); + int ret = video_vf_vo_control(d_video, VFCTRL_SET_EQUALIZER, &data); if (ret == CONTROL_TRUE) return 1; } @@ -105,7 +105,7 @@ int video_get_colors(struct dec_video *d_video, const char *item, int *value) mp_dbg(MSGT_DECVIDEO, MSGL_V, "get video colors %s \n", item); if (d_video->vfilter) { - int ret = vf_control_any(d_video->vfilter, VFCTRL_GET_EQUALIZER, &data); + int ret = video_vf_vo_control(d_video, VFCTRL_GET_EQUALIZER, &data); if (ret == CONTROL_TRUE) { *value = data.value; return 1; @@ -452,3 +452,39 @@ int video_reconfig_filters(struct dec_video *d_video, return 0; } + +// Send a VCTRL, or if it doesn't work, translate it to a VOCTRL and try the VO. +int video_vf_vo_control(struct dec_video *d_video, int vf_cmd, void *data) +{ + if (d_video->vfilter && d_video->vfilter->initialized > 0) { + int r = vf_control_any(d_video->vfilter, vf_cmd, data); + if (r != CONTROL_UNKNOWN) + return r; + } + + switch (vf_cmd) { + case VFCTRL_GET_DEINTERLACE: + return vo_control(d_video->vo, VOCTRL_GET_DEINTERLACE, data) == VO_TRUE; + case VFCTRL_SET_DEINTERLACE: + return vo_control(d_video->vo, VOCTRL_SET_DEINTERLACE, data) == VO_TRUE; + case VFCTRL_SET_EQUALIZER: { + vf_equalizer_t *eq = data; + if (!d_video->vo->config_ok) + return CONTROL_FALSE; // vo not configured? + struct voctrl_set_equalizer_args param = { + eq->item, eq->value + }; + return vo_control(d_video->vo, VOCTRL_SET_EQUALIZER, ¶m) == VO_TRUE; + } + case VFCTRL_GET_EQUALIZER: { + vf_equalizer_t *eq = data; + if (!d_video->vo->config_ok) + return CONTROL_FALSE; // vo not configured? + struct voctrl_get_equalizer_args param = { + eq->item, &eq->value + }; + return vo_control(d_video->vo, VOCTRL_GET_EQUALIZER, ¶m) == VO_TRUE; + } + } + return CONTROL_UNKNOWN; +} diff --git a/video/decode/dec_video.h b/video/decode/dec_video.h index 7d30e6fd91..c15f0d9aba 100644 --- a/video/decode/dec_video.h +++ b/video/decode/dec_video.h @@ -25,12 +25,13 @@ #include "video/hwdec.h" #include "video/mp_image.h" -struct osd_state; struct mp_decoder_list; +struct vo; struct dec_video { struct MPOpts *opts; struct vf_chain *vfilter; // video filter chain + struct vo *vo; // (still) needed by video_set/get_colors const struct vd_functions *vd_driver; struct mp_hwdec_info hwdec_info; // video output hwdec handles struct sh_stream *header; @@ -95,4 +96,6 @@ int video_vd_control(struct dec_video *d_video, int cmd, void *arg); int video_reconfig_filters(struct dec_video *d_video, const struct mp_image_params *params); +int video_vf_vo_control(struct dec_video *d_video, int vf_cmd, void *data); + #endif /* MPLAYER_DEC_VIDEO_H */ diff --git a/video/filter/vf_vo.c b/video/filter/vf_vo.c index 631ab558f1..4f90f6ab3e 100644 --- a/video/filter/vf_vo.c +++ b/video/filter/vf_vo.c @@ -65,33 +65,6 @@ static int control(struct vf_instance *vf, int request, void *data) video_out = data; return CONTROL_OK; } - if (!video_out) - return CONTROL_FALSE; - - switch (request) { - case VFCTRL_GET_DEINTERLACE: - return vo_control(video_out, VOCTRL_GET_DEINTERLACE, data) == VO_TRUE; - case VFCTRL_SET_DEINTERLACE: - return vo_control(video_out, VOCTRL_SET_DEINTERLACE, data) == VO_TRUE; - case VFCTRL_SET_EQUALIZER: { - vf_equalizer_t *eq = data; - if (!video_out->config_ok) - return CONTROL_FALSE; // vo not configured? - struct voctrl_set_equalizer_args param = { - eq->item, eq->value - }; - return vo_control(video_out, VOCTRL_SET_EQUALIZER, ¶m) == VO_TRUE; - } - case VFCTRL_GET_EQUALIZER: { - vf_equalizer_t *eq = data; - if (!video_out->config_ok) - return CONTROL_FALSE; // vo not configured? - struct voctrl_get_equalizer_args param = { - eq->item, &eq->value - }; - return vo_control(video_out, VOCTRL_GET_EQUALIZER, ¶m) == VO_TRUE; - } - } return CONTROL_UNKNOWN; } -- cgit v1.2.3