changeset 35171:75e4ee082dd2

mp_property_deinterlace: Improve OSD feedback Do not show wrong OSD if setting of property deinterlace fails or is not supported by current video chain. This was particularly misleading because if you e.g. were using mplayer without a deinterlacing filter and your vo didn't have deinterlacing support. The OSD output of the property would appear like it got stuck at "enabled". Patch by Vicente Sendra >visenri yahoo.es< with a few changes by me.
author al
date Sun, 21 Oct 2012 19:01:48 +0000
parents 6f214e8ae780
children cc35fea76ccc
files command.c
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/command.c	Sun Oct 21 15:00:48 2012 +0000
+++ b/command.c	Sun Oct 21 19:01:48 2012 +0000
@@ -1078,7 +1078,7 @@
 static int mp_property_deinterlace(m_option_t *prop, int action,
                                    void *arg, MPContext *mpctx)
 {
-    int deinterlace;
+    int deinterlace, deinterlace_old;
     vf_instance_t *vf;
     if (!mpctx->sh_video || !mpctx->sh_video->vfilter)
         return M_PROPERTY_UNAVAILABLE;
@@ -1097,9 +1097,11 @@
         return M_PROPERTY_OK;
     case M_PROPERTY_STEP_UP:
     case M_PROPERTY_STEP_DOWN:
-        vf->control(vf, VFCTRL_GET_DEINTERLACE, &deinterlace);
-        deinterlace = !deinterlace;
-        vf->control(vf, VFCTRL_SET_DEINTERLACE, &deinterlace);
+        vf->control(vf, VFCTRL_GET_DEINTERLACE, &deinterlace_old);
+        deinterlace = !deinterlace_old;
+        if (vf->control(vf, VFCTRL_SET_DEINTERLACE, &deinterlace) != CONTROL_OK) {
+            deinterlace = deinterlace_old;
+        }
         set_osd_msg(OSD_MSG_SPEED, 1, osd_duration, MSGTR_OSDDeinterlace,
             deinterlace ? MSGTR_Enabled : MSGTR_Disabled);
         return M_PROPERTY_OK;