[MPlayer-cvslog] r35267 - trunk/command.c

al subversion at mplayerhq.hu
Thu Oct 25 20:26:46 CEST 2012


Author: al
Date: Thu Oct 25 20:26:45 2012
New Revision: 35267

Log:
mp_property_deinterlace: Signalize control() failure

Always having to do a GET after a SET to check if the state was
really changed, seems not very friendly from the perspective of
the client application that changes the property.

Return M_PROPERTY_UNAVAILABLE to signalize that the control() was
not positively consumed by the filter/vo chain.

Based on a patch by Vicente Sendra >visenri yahoo.es<

Modified:
   trunk/command.c

Modified: trunk/command.c
==============================================================================
--- trunk/command.c	Tue Oct 23 23:12:34 2012	(r35266)
+++ trunk/command.c	Thu Oct 25 20:26:45 2012	(r35267)
@@ -1079,6 +1079,7 @@ static int mp_property_deinterlace(m_opt
                                    void *arg, MPContext *mpctx)
 {
     int deinterlace, deinterlace_old;
+    int result;
     vf_instance_t *vf;
     if (!mpctx->sh_video || !mpctx->sh_video->vfilter)
         return M_PROPERTY_UNAVAILABLE;
@@ -1093,18 +1094,19 @@ static int mp_property_deinterlace(m_opt
         if (!arg)
             return M_PROPERTY_ERROR;
         M_PROPERTY_CLAMP(prop, *(int *) arg);
-        vf->control(vf, VFCTRL_SET_DEINTERLACE, arg);
-        return M_PROPERTY_OK;
+        result = vf->control(vf, VFCTRL_SET_DEINTERLACE, arg);
+        return (result == CONTROL_OK) ? M_PROPERTY_OK : M_PROPERTY_UNAVAILABLE;
     case M_PROPERTY_STEP_UP:
     case M_PROPERTY_STEP_DOWN:
         vf->control(vf, VFCTRL_GET_DEINTERLACE, &deinterlace_old);
         deinterlace = !deinterlace_old;
-        if (vf->control(vf, VFCTRL_SET_DEINTERLACE, &deinterlace) != CONTROL_OK) {
+        result = vf->control(vf, VFCTRL_SET_DEINTERLACE, &deinterlace);
+        if (result != 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;
+        return (result == CONTROL_OK) ? M_PROPERTY_OK : M_PROPERTY_UNAVAILABLE;
     }
     return M_PROPERTY_NOT_IMPLEMENTED;
 }


More information about the MPlayer-cvslog mailing list