changeset 35173:95ad1e516f03

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<
author al
date Thu, 25 Oct 2012 18:26:45 +0000
parents cc35fea76ccc
children cf26d64d5972
files command.c
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/command.c	Tue Oct 23 21:12:34 2012 +0000
+++ b/command.c	Thu Oct 25 18:26:45 2012 +0000
@@ -1079,6 +1079,7 @@
                                    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 @@
         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;
 }