summaryrefslogtreecommitdiffstats
path: root/video/decode/dec_video.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-10 19:08:56 +0100
committerwm4 <wm4@nowhere>2013-12-10 20:07:39 +0100
commit2f46b23d51684eef7cfa2bd5fa5e2892772ca816 (patch)
treebb4363f817e6631d037cc77e225bcef2bc5b092e /video/decode/dec_video.c
parent5f0585177e58349a8a309037803ff99046a3ab27 (diff)
downloadmpv-2f46b23d51684eef7cfa2bd5fa5e2892772ca816.tar.bz2
mpv-2f46b23d51684eef7cfa2bd5fa5e2892772ca816.tar.xz
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.
Diffstat (limited to 'video/decode/dec_video.c')
-rw-r--r--video/decode/dec_video.c40
1 files changed, 38 insertions, 2 deletions
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, &param) == 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, &param) == VO_TRUE;
+ }
+ }
+ return CONTROL_UNKNOWN;
+}