summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-10-28 20:59:15 +0100
committerwm4 <wm4@nowhere>2012-10-30 19:50:24 +0100
commitcaf1398c208bf9929865fa34e202fb190e31a463 (patch)
treed63b275019394d07563aa0ab1d715d4fdac7fcf2
parent63a56048b2682c054e0da40473f30a832c86416e (diff)
downloadmpv-caf1398c208bf9929865fa34e202fb190e31a463.tar.bz2
mpv-caf1398c208bf9929865fa34e202fb190e31a463.tar.xz
command: make property "deinterlace" unavailable if deinterlacer absent
The "deinterlace" property was stuck at "no" if there wasn't actually any switchable deinterlacer (like yadif or vdpau) in the video chain. Also, take care of returning only 0/1 values. It appears yadif and vdpau return their current deinterlacer mode, which is not always the value 0 or 1.
-rw-r--r--command.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/command.c b/command.c
index 189b086b94..5b615ef5be 100644
--- a/command.c
+++ b/command.c
@@ -854,13 +854,15 @@ static int mp_property_fullscreen(m_option_t *prop, int action, void *arg,
static int mp_property_deinterlace(m_option_t *prop, int action,
void *arg, MPContext *mpctx)
{
- vf_instance_t *vf;
if (!mpctx->sh_video || !mpctx->sh_video->vfilter)
return M_PROPERTY_UNAVAILABLE;
- vf = mpctx->sh_video->vfilter;
+ vf_instance_t *vf = mpctx->sh_video->vfilter;
+ int enabled = 0;
+ if (vf->control(vf, VFCTRL_GET_DEINTERLACE, &enabled) != CONTROL_OK)
+ return M_PROPERTY_UNAVAILABLE;
switch (action) {
case M_PROPERTY_GET:
- vf->control(vf, VFCTRL_GET_DEINTERLACE, arg);
+ *(int *)arg = !!enabled;
return M_PROPERTY_OK;
case M_PROPERTY_SET:
vf->control(vf, VFCTRL_SET_DEINTERLACE, arg);