[vlc-commits] vout: remove harmful or commented out display events

Rémi Denis-Courmont git at videolan.org
Thu Oct 23 20:19:38 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Oct 23 21:13:40 2014 +0300| [9dd3e8fb42fb3314317400059e8630b713221e95] | committer: Rémi Denis-Courmont

vout: remove harmful or commented out display events

The video output variables currently represent the wanted state, not
the actual state. Forcefully resetting them to the actual state with a
delay can create feedback loops. (Indeed some of the code paths had
already been commented out for that exact reason.)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9dd3e8fb42fb3314317400059e8630b713221e95
---

 src/video_output/display.c |   29 ------------
 src/video_output/event.h   |  110 --------------------------------------------
 2 files changed, 139 deletions(-)

diff --git a/src/video_output/display.c b/src/video_output/display.c
index ec0871d..87c6deb 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -870,8 +870,6 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
 
                 msg_Err(vd, "Failed to set fullscreen");
             }
-
-            vout_SendEventFullscreen(osys->vout, osys->cfg.is_fullscreen);
         }
 
         /* */
@@ -900,8 +898,6 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
             }
             osys->cfg.is_display_filled = osys->is_display_filled;
             osys->ch_display_filled = false;
-
-            vout_SendEventDisplayFilled(osys->vout, osys->cfg.is_display_filled);
         }
         /* */
         if (osys->ch_zoom) {
@@ -929,8 +925,6 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
             osys->cfg.zoom.num = osys->zoom.num;
             osys->cfg.zoom.den = osys->zoom.den;
             osys->ch_zoom = false;
-
-            vout_SendEventZoom(osys->vout, osys->cfg.zoom.num, osys->cfg.zoom.den);
         }
 #if defined(_WIN32) || defined(__OS2__)
         /* */
@@ -940,9 +934,6 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
                 wm_state = osys->wm_state;
             }
             osys->wm_state_initial = wm_state;
-
-            /* */
-            vout_SendEventOnTop(osys->vout, osys->wm_state_initial);
         }
 #endif
         /* */
@@ -973,21 +964,6 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
             osys->sar.den = source.i_sar_den;
             osys->ch_sar  = false;
 
-            /* */
-            if (osys->sar.num == osys->source.i_sar_num &&
-                osys->sar.den == osys->source.i_sar_den)
-            {
-                vout_SendEventSourceAspect(osys->vout, 0, 0);
-            }
-            else
-            {
-                unsigned dar_num, dar_den;
-                vlc_ureduce( &dar_num, &dar_den,
-                             osys->sar.num * vd->source.i_visible_width,
-                             osys->sar.den * vd->source.i_visible_height,
-                             65536);
-                vout_SendEventSourceAspect(osys->vout, dar_num, dar_den);
-            }
             /* If a crop ratio is requested, recompute the parameters */
             if (osys->crop.num > 0 && osys->crop.den > 0)
                 osys->ch_crop = true;
@@ -1053,11 +1029,6 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
             osys->crop.num    = crop_num;
             osys->crop.den    = crop_den;
             osys->ch_crop = false;
-
-            vout_SendEventSourceCrop(osys->vout,
-                                     osys->crop.num, osys->crop.den,
-                                     osys->crop.left, osys->crop.top,
-                                     -osys->crop.right, -osys->crop.bottom);
         }
 
         /* */
diff --git a/src/video_output/event.h b/src/video_output/event.h
index b076c69..c3c2ddf 100644
--- a/src/video_output/event.h
+++ b/src/video_output/event.h
@@ -101,116 +101,6 @@ static inline void vout_SendEventMouseHidden(vout_thread_t *vout)
     VLC_UNUSED(vout);
 }
 
-static inline void vout_SendEventFullscreen(vout_thread_t *vout, bool is_fullscreen)
-{
-    var_SetBool(vout, "fullscreen", is_fullscreen);
-}
-
-static inline void vout_SendEventDisplayFilled(vout_thread_t *vout, bool is_display_filled)
-{
-    if (!var_GetBool(vout, "autoscale") != !is_display_filled)
-        var_SetBool(vout, "autoscale", is_display_filled);
-}
-
-static inline void vout_SendEventZoom(vout_thread_t *vout, int num, int den)
-{
-    VLC_UNUSED(vout);
-    VLC_UNUSED(num);
-    VLC_UNUSED(den);
-    /* FIXME deadlock problems with current vout */
-#if 0
-    const float zoom = (float)num / (float)den;
-
-    /* XXX 0.1% is arbitrary */
-    if (fabs(zoom - var_GetFloat(vout, "scale")) > 0.001)
-        var_SetFloat(vout, "scale", zoom);
-#endif
-}
-
-static inline void vout_SendEventOnTop(vout_thread_t *vout, bool is_on_top)
-{
-    VLC_UNUSED(vout);
-    VLC_UNUSED(is_on_top);
-    /* FIXME deadlock problems with current vout */
-#if 0
-
-    if (!var_GetBool(vout, "video-on-top") != !is_on_top)
-        var_SetBool(vout, "video-on-top", is_on_top);
-#endif
-}
-
-/**
- * It must be called on source aspect ratio changes, with the new DAR (Display
- * Aspect Ratio) value.
- */
-static inline void vout_SendEventSourceAspect(vout_thread_t *vout,
-                                              unsigned num, unsigned den)
-{
-    VLC_UNUSED(vout);
-    VLC_UNUSED(num);
-    VLC_UNUSED(den);
-    /* FIXME the value stored in "aspect-ratio" are not reduced
-     * creating a lot of problems here */
-#if 0
-    char *ar;
-    if (num > 0 && den > 0) {
-        if (asprintf(&ar, "%u:%u", num, den) < 0)
-            return;
-    } else {
-        ar = strdup("");
-    }
-
-    char *current = var_GetString(vout, "aspect-ratio");
-    msg_Err(vout, "vout_SendEventSourceAspect %s -> %s", current, ar);
-    if (ar && current && strcmp(ar, current))
-        var_SetString(vout, "aspect-ratio", ar);
-
-    free(current);
-    free(ar);
-#endif
-}
-static inline void vout_SendEventSourceCrop(vout_thread_t *vout,
-                                            unsigned num, unsigned den,
-                                            unsigned left, unsigned top,
-                                            unsigned right, unsigned bottom)
-{
-    VLC_UNUSED(num);
-    VLC_UNUSED(den);
-
-    vlc_value_t val;
-
-    /* I cannot use var_Set here, infinite loop otherwise */
-
-    /* */
-    val.i_int = left;
-    var_Change(vout, "crop-left",   VLC_VAR_SETVALUE, &val, NULL);
-    val.i_int = top;
-    var_Change(vout, "crop-top",    VLC_VAR_SETVALUE, &val, NULL);
-    val.i_int = right;
-    var_Change(vout, "crop-right",  VLC_VAR_SETVALUE, &val, NULL);
-    val.i_int = bottom;
-    var_Change(vout, "crop-bottom", VLC_VAR_SETVALUE, &val, NULL);
-
-    /* FIXME the value stored in "crop" are not reduced
-     * creating a lot of problems here */
-#if 0
-    char *crop;
-    if (num > 0 && den > 0) {
-        if (asprintf(&crop, "%u:%u", num, den) < 0)
-            crop = NULL;
-    } else if (left > 0 || top > 0 || right > 0 || bottom > 0) {
-        if (asprintf(&crop, "%u+%u+%u+%u", left, top, right, bottom) < 0)
-            crop = NULL;
-    } else {
-        crop = strdup("");
-    }
-    if (crop) {
-        val.psz_string = crop;
-        var_Change(vout, "crop", VLC_VAR_SETVALUE, &val, NULL);
-        free(crop);
-    }
-#endif
-}
 #if 0
 static inline void vout_SendEventSnapshot(vout_thread_t *vout, const char *filename)
 {



More information about the vlc-commits mailing list