]> git.sesse.net Git - vlc/blobdiff - src/video_output/event.h
shine: avoid double free
[vlc] / src / video_output / event.h
index df4ebb9b66db67cfaf8fd8e4adbe3fe8c3a0b674..c3c2ddf0a3378823eee6ebfae676d03fdbb6ad8f 100644 (file)
@@ -42,6 +42,7 @@ static inline void vout_SendEventClose(vout_thread_t *vout)
 #warning FIXME: implement video close event
     /* FIXME: this code is disabled as it breaks the non-playlist cases */
     //playlist_Stop(pl_Get(vout));
+    (void) vout;
 }
 static inline void vout_SendEventKey(vout_thread_t *vout, int key)
 {
@@ -53,7 +54,7 @@ static inline void vout_SendEventMouseMoved(vout_thread_t *vout, int x, int y)
 }
 static inline void vout_SendEventMousePressed(vout_thread_t *vout, int button)
 {
-    int key;
+    int key = KEY_UNSET;
     var_OrInteger(vout, "mouse-button-down", 1 << button);
 
     switch (button)
@@ -87,8 +88,7 @@ static inline void vout_SendEventMouseReleased(vout_thread_t *vout, int button)
 static inline void vout_SendEventMouseDoubleClick(vout_thread_t *vout)
 {
     //vout_ControlSetFullscreen(vout, !var_GetBool(vout, "fullscreen"));
-    //var_ToggleBool(vout, "fullscreen");
-    var_SetInteger(vout->p_libvlc, "key-action", ACTIONID_TOGGLE_FULLSCREEN);
+    var_ToggleBool(vout, "fullscreen");
 }
 static inline void vout_SendEventMouseVisible(vout_thread_t *vout)
 {
@@ -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)
 {