[vlc-commits] vout: introduce vout_Hold() and vout_Release()

Rémi Denis-Courmont git at videolan.org
Wed Mar 6 21:57:49 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Mar  6 20:03:08 2019 +0200| [a990818d1a62995f8d300ac7942a1d8d62628e15] | committer: Rémi Denis-Courmont

vout: introduce vout_Hold() and vout_Release()

Type-safe replacements for vlc_object_hold() and vlc_object_release()
(as discussed during the last workshop).

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

 include/vlc_input.h                                | 10 ++++-----
 include/vlc_objects.h                              | 12 ++++++++++
 include/vlc_player.h                               |  5 ++---
 lib/media_player.c                                 |  2 +-
 lib/video.c                                        | 26 +++++++++++-----------
 modules/control/dbus/dbus_root.c                   |  2 +-
 modules/control/gestures.c                         |  4 ++--
 modules/control/hotkeys.c                          |  8 +++----
 modules/control/oldrc.c                            |  8 +++----
 .../macosx/coreinteraction/VLCCoreInteraction.m    | 14 ++++++------
 .../macosx/coreinteraction/VLCVideoFilterHelper.m  |  4 ++--
 modules/gui/macosx/menus/VLCMainMenu.m             |  8 +++----
 modules/gui/macosx/os-integration/applescript.m    |  6 ++---
 .../VLCTrackSynchronizationWindowController.m      |  2 +-
 .../panels/VLCVideoEffectsWindowController.m       |  4 ++--
 .../macosx/windows/video/VLCVideoWindowCommon.m    |  4 ++--
 modules/gui/macosx/windows/video/VLCVoutView.m     |  8 +++----
 modules/gui/ncurses.c                              |  2 +-
 modules/gui/qt/actions_manager.cpp                 |  4 ++--
 modules/gui/qt/components/controller.cpp           |  4 ++--
 modules/gui/qt/components/controller_widget.cpp    |  4 ++--
 modules/gui/qt/components/extended_panels.cpp      |  8 +++----
 modules/gui/qt/input_manager.cpp                   |  2 +-
 modules/gui/qt/menus.cpp                           |  6 ++---
 modules/gui/skins2/commands/cmd_fullscreen.cpp     |  2 +-
 modules/gui/skins2/commands/cmd_quit.cpp           |  2 +-
 modules/gui/skins2/commands/cmd_snapshot.cpp       |  2 +-
 modules/gui/skins2/src/vlcproc.cpp                 |  6 ++---
 modules/lua/libs/objects.c                         | 12 ++++++++--
 modules/lua/libs/osd.c                             | 10 ++++-----
 modules/lua/libs/video.c                           |  2 +-
 src/input/control.c                                |  2 +-
 src/input/decoder.c                                | 10 ++++-----
 src/input/decoder.h                                |  2 +-
 src/input/input.c                                  |  4 ++--
 src/input/player.c                                 |  6 ++---
 src/input/resource.c                               |  4 ++--
 src/input/resource.h                               |  4 ++--
 test/src/input/player.c                            |  4 ++--
 39 files changed, 124 insertions(+), 105 deletions(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index 289b1e7b55..6b2c513d27 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -577,7 +577,7 @@ enum input_query_e
     INPUT_SET_INITIAL_VIEWPOINT, /* arg1=(const vlc_viewpoint_t*) */
 
     /* Input ressources
-     * XXX You must call vlc_object_release as soon as possible */
+     * XXX You must release as soon as possible */
     INPUT_GET_AOUT,         /* arg1=audio_output_t **              res=can fail */
     INPUT_GET_VOUTS,        /* arg1=vout_thread_t ***, size_t *        res=can fail */
     INPUT_GET_ES_OBJECTS,   /* arg1=int id, vlc_object_t **dec, vout_thread_t **, audio_output_t ** */
@@ -657,7 +657,7 @@ VLC_API input_item_t* input_GetItem( input_thread_t * ) VLC_USED;
  * INPUT_GET_VOUTS directly and process _all_ video outputs instead.
  * @param p_input an input thread from which to get a video output
  * @return NULL on error, or a video output thread pointer (which needs to be
- * released with vlc_object_release()).
+ * released with vout_Release()).
  */
 static inline vout_thread_t *input_GetVout( input_thread_t *p_input )
 {
@@ -668,7 +668,7 @@ static inline vout_thread_t *input_GetVout( input_thread_t *p_input )
          return NULL;
 
      for( size_t i = 1; i < i_vout; i++ )
-         vlc_object_release( (vlc_object_t *)(pp_vout[i]) );
+         vout_Release(pp_vout[i]);
 
      p_vout = (i_vout >= 1) ? pp_vout[0] : NULL;
      free( pp_vout );
@@ -716,8 +716,8 @@ static inline audio_output_t *input_GetAout( input_thread_t *p_input )
 /**
  * Returns the objects associated to an ES.
  *
- * You must release all non NULL object using vlc_object_release.
- * You may set pointer of pointer to NULL to avoid retreiving it.
+ * You must release all non-NULL objects.
+ * You may set pointer of pointer to NULL to avoid retrieving it.
  */
 static inline int input_GetEsObjects( input_thread_t *p_input, int i_id,
                                       vlc_object_t **pp_decoder,
diff --git a/include/vlc_objects.h b/include/vlc_objects.h
index de251735cf..720c86639b 100644
--- a/include/vlc_objects.h
+++ b/include/vlc_objects.h
@@ -185,6 +185,18 @@ static inline void input_Release(input_thread_t *input)
     vlc_object_release((vlc_object_t *)input);
 }
 
+/* Here for backward compatibility. TODO: Move to <vlc_vout.h>! */
+static inline vout_thread_t *vout_Hold(vout_thread_t *vout)
+{
+    vlc_object_hold((vlc_object_t *)vout);
+    return vout;
+}
+
+static inline void vout_Release(vout_thread_t *vout)
+{
+    vlc_object_release((vlc_object_t *)vout);
+}
+
 /**
  * @defgroup objres Object resources
  *
diff --git a/include/vlc_player.h b/include/vlc_player.h
index 78d78d29d3..739953ca70 100644
--- a/include/vlc_player.h
+++ b/include/vlc_player.h
@@ -2592,8 +2592,7 @@ vlc_player_aout_EnableFilter(vlc_player_t *player, const char *name, bool add);
 /**
  * Get and hold the main video output
  *
- * @warning the returned vout_thread_t * must be released with
- * vlc_object_release().
+ * @warning the returned vout_thread_t * must be released with vout_Release().
  * @see vlc_players_cbs.on_vout_list_changed
  *
  * @param player player instance
@@ -2606,7 +2605,7 @@ vlc_player_vout_Hold(vlc_player_t *player);
  * Get and hold the list of video output
  *
  * @warning All vout_thread_t * element of the array must be released with
- * vlc_object_release(). The returned array must be freed.
+ * vout_Release(). The returned array must be freed.
  *
  * @see vlc_players_cbs.on_vout_list_changed
  *
diff --git a/lib/media_player.c b/lib/media_player.c
index 3ffceacf52..468c144da1 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -390,7 +390,7 @@ input_event_changed( vlc_object_t * p_this, char const * psz_cmd,
         else
         {
             for( size_t i = 0; i < i_vout; i++ )
-                vlc_object_release( pp_vout[i] );
+                vout_Release(pp_vout[i]);
             free( pp_vout );
         }
 
diff --git a/lib/video.c b/lib/video.c
index e5c2d72406..6c35d78507 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -80,7 +80,7 @@ static vout_thread_t *GetVout (libvlc_media_player_t *mp, size_t num)
 
     for (size_t i = 0; i < n; i++)
         if (i != num)
-            vlc_object_release (pp_vouts[i]);
+            vout_Release(pp_vouts[i]);
     free (pp_vouts);
 
     if (p_vout == NULL)
@@ -104,7 +104,7 @@ void libvlc_set_fullscreen( libvlc_media_player_t *p_mi, int b_fullscreen )
     for (size_t i = 0; i < n; i++)
     {
         var_SetBool (pp_vouts[i], "fullscreen", b_fullscreen);
-        vlc_object_release (pp_vouts[i]);
+        vout_Release(pp_vouts[i]);
     }
     free (pp_vouts);
 }
@@ -126,7 +126,7 @@ void libvlc_toggle_fullscreen( libvlc_media_player_t *p_mi )
         vout_thread_t *p_vout = pp_vouts[i];
 
         var_SetBool (p_vout, "fullscreen", b_fullscreen);
-        vlc_object_release (p_vout);
+        vout_Release(p_vout);
     }
     free (pp_vouts);
 }
@@ -165,7 +165,7 @@ libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num,
     var_Create( p_vout, "snapshot-format", VLC_VAR_STRING );
     var_SetString( p_vout, "snapshot-format", "png" );
     var_TriggerCallback( p_vout, "video-snapshot" );
-    vlc_object_release( p_vout );
+    vout_Release(p_vout);
     return 0;
 }
 
@@ -199,7 +199,7 @@ int libvlc_video_get_cursor( libvlc_media_player_t *mp, unsigned num,
         return -1;
 
     var_GetCoords (p_vout, "mouse-moved", px, py);
-    vlc_object_release (p_vout);
+    vout_Release(p_vout);
     return 0;
 }
 
@@ -208,7 +208,7 @@ unsigned libvlc_media_player_has_vout( libvlc_media_player_t *p_mi )
     size_t n;
     vout_thread_t **pp_vouts = GetVouts (p_mi, &n);
     for (size_t i = 0; i < n; i++)
-        vlc_object_release (pp_vouts[i]);
+        vout_Release(pp_vouts[i]);
     free (pp_vouts);
     return n;
 }
@@ -237,7 +237,7 @@ void libvlc_video_set_scale( libvlc_media_player_t *p_mp, float f_scale )
         if (isfinite(f_scale) && f_scale != 0.f)
             var_SetFloat (p_vout, "zoom", f_scale);
         var_SetBool (p_vout, "autoscale", f_scale == 0.f);
-        vlc_object_release (p_vout);
+        vout_Release(p_vout);
     }
     free (pp_vouts);
 }
@@ -261,7 +261,7 @@ void libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi,
         vout_thread_t *p_vout = pp_vouts[i];
 
         var_SetString (p_vout, "aspect-ratio", psz_aspect);
-        vlc_object_release (p_vout);
+        vout_Release(p_vout);
     }
     free (pp_vouts);
 }
@@ -437,7 +437,7 @@ void libvlc_video_set_crop_geometry( libvlc_media_player_t *p_mi,
         vout_thread_t *p_vout = pp_vouts[i];
 
         var_SetString (p_vout, "crop", psz_geometry);
-        vlc_object_release (p_vout);
+        vout_Release(p_vout);
     }
     free (pp_vouts);
 }
@@ -628,7 +628,7 @@ void libvlc_video_set_deinterlace( libvlc_media_player_t *p_mi, int deinterlace,
             var_SetString (p_vout, "deinterlace-mode", psz_mode);
 
         var_SetInteger (p_vout, "deinterlace", deinterlace);
-        vlc_object_release (p_vout);
+        vout_Release(p_vout);
     }
     free (pp_vouts);
 }
@@ -729,14 +729,14 @@ static bool find_sub_source_by_name( libvlc_media_player_t *p_mi, const char *re
     if( !psz_sources )
     {
         libvlc_printerr( "%s not enabled", name );
-        vlc_object_release( vout );
+        vout_Release(vout);
         return false;
     }
 
     /* Find 'name'  */
     char *p = strstr( psz_sources, name );
     free( psz_sources );
-    vlc_object_release( vout );
+    vout_Release(vout);
     return (p != NULL);
 }
 
@@ -792,7 +792,7 @@ set_value( libvlc_media_player_t *p_mi, const char *restrict name,
         var_SetChecked( pp_vouts[i], psz_opt_name, i_type, new_val );
         if( b_sub_source )
             var_TriggerCallback( pp_vouts[i], "sub-source" );
-        vlc_object_release( pp_vouts[i] );
+        vout_Release(pp_vouts[i]);
     }
 
     if( opt->type == 0 )
diff --git a/modules/control/dbus/dbus_root.c b/modules/control/dbus/dbus_root.c
index 5781278384..854d656912 100644
--- a/modules/control/dbus/dbus_root.c
+++ b/modules/control/dbus/dbus_root.c
@@ -97,7 +97,7 @@ MarshalCanSetFullscreen( intf_thread_t *p_intf, DBusMessageIter *container )
         if ( p_vout )
         {
             b_ret = TRUE;
-            vlc_object_release( p_vout );
+            vout_Release(p_vout);
         }
     }
 
diff --git a/modules/control/gestures.c b/modules/control/gestures.c
index 758cbdf39f..ff103f2f66 100644
--- a/modules/control/gestures.c
+++ b/modules/control/gestures.c
@@ -171,7 +171,7 @@ static void Close ( vlc_object_t *p_this )
         var_DelCallback( p_sys->p_vout, "mouse-moved", MovedEvent, p_intf );
         var_DelCallback( p_sys->p_vout, "mouse-button-down",
                          ButtonEvent, p_intf );
-        vlc_object_release( p_sys->p_vout );
+        vout_Release(p_sys->p_vout);
     }
 
     /* Destroy structure */
@@ -483,7 +483,7 @@ static int InputEvent( vlc_object_t *p_this, char const *psz_var,
                              p_intf );
             var_DelCallback( p_sys->p_vout, "mouse-button-down", ButtonEvent,
                              p_intf );
-            vlc_object_release( p_sys->p_vout );
+            vout_Release(p_sys->p_vout);
         }
 
         p_sys->p_vout = input_GetVout( p_input );
diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 46be8124f6..0793d2ad9f 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -241,7 +241,7 @@ static void ChangeVout( intf_thread_t *p_intf, vout_thread_t *p_vout )
         var_DelCallback( p_old_vout, "mouse-button-down", ButtonEvent,
                          p_intf );
         var_DelCallback( p_old_vout, "mouse-moved", MovedEvent, p_intf );
-        vlc_object_release( p_old_vout );
+        vout_Release(p_old_vout);
     }
 
     if( p_vout != NULL )
@@ -308,7 +308,7 @@ static void ChangeInput( intf_thread_t *p_intf, input_thread_t *p_input )
     if( p_old_input != NULL )
     {
         if( p_old_vout != NULL )
-            vlc_object_release( p_old_vout );
+            vout_Release(p_old_vout);
         input_Release(p_old_input);
     }
 
@@ -1446,7 +1446,7 @@ static int ActionEvent( vlc_object_t *libvlc, char const *psz_var,
     vlc_mutex_lock( &p_intf->p_sys->lock );
     input_thread_t *p_input = p_sys->p_input ? input_Hold(p_sys->p_input)
                                              : NULL;
-    vout_thread_t *p_vout = p_sys->p_vout ? vlc_object_hold( p_sys->p_vout )
+    vout_thread_t *p_vout = p_sys->p_vout ? vout_Hold(p_sys->p_vout)
                                           : NULL;
     int slider_chan = p_sys->slider_chan;
     bool b_vrnav = p_sys->vrnav.b_can_change;
@@ -1458,7 +1458,7 @@ static int ActionEvent( vlc_object_t *libvlc, char const *psz_var,
     if( p_input != NULL )
         input_Release(p_input);
     if( p_vout != NULL )
-        vlc_object_release( p_vout );
+        vout_Release(p_vout);
 
     return i_ret;
 }
diff --git a/modules/control/oldrc.c b/modules/control/oldrc.c
index 97d41795bb..86d43203f1 100644
--- a/modules/control/oldrc.c
+++ b/modules/control/oldrc.c
@@ -765,7 +765,7 @@ static void *Run( void *data )
                 if( p_vout )
                 {
                     var_SetBool( p_vout, "fullscreen", fs );
-                    vlc_object_release( p_vout );
+                    vout_Release(p_vout);
                 }
             }
             break;
@@ -1556,7 +1556,7 @@ static int VideoConfig( vlc_object_t *p_this, char const *psz_cmd,
             psz_value = var_GetString( p_vout, psz_variable );
             if( psz_value == NULL )
             {
-                vlc_object_release( p_vout );
+                vout_Release(p_vout);
                 return VLC_EGENERIC;
             }
         }
@@ -1564,7 +1564,7 @@ static int VideoConfig( vlc_object_t *p_this, char const *psz_cmd,
         if ( var_Change( p_vout, psz_variable, VLC_VAR_GETCHOICES,
                          &count, &val, &text ) < 0 )
         {
-            vlc_object_release( p_vout );
+            vout_Release(p_vout);
             free( psz_value );
             return VLC_EGENERIC;
         }
@@ -1601,7 +1601,7 @@ static int VideoConfig( vlc_object_t *p_this, char const *psz_cmd,
 
         free( name );
     }
-    vlc_object_release( p_vout );
+    vout_Release(p_vout);
     return i_error;
 }
 
diff --git a/modules/gui/macosx/coreinteraction/VLCCoreInteraction.m b/modules/gui/macosx/coreinteraction/VLCCoreInteraction.m
index e2be092a19..05e0f3e918 100644
--- a/modules/gui/macosx/coreinteraction/VLCCoreInteraction.m
+++ b/modules/gui/macosx/coreinteraction/VLCCoreInteraction.m
@@ -390,7 +390,7 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
         vout_OSDMessage(p_vout, VOUT_SPU_CHANNEL_OSD, "%s", _("Random Off"));
     }
 
-    vlc_object_release(p_vout);
+    vout_Release(p_vout);
 }
 
 - (void)repeatAll
@@ -400,7 +400,7 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
     vout_thread_t *p_vout = getVout();
     if (p_vout) {
         vout_OSDMessage(p_vout, VOUT_SPU_CHANNEL_OSD, "%s", _("Repeat All"));
-        vlc_object_release(p_vout);
+        vout_Release(p_vout);
     }
 }
 
@@ -411,7 +411,7 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
     vout_thread_t *p_vout = getVout();
     if (p_vout) {
         vout_OSDMessage(p_vout, VOUT_SPU_CHANNEL_OSD, "%s", _("Repeat One"));
-        vlc_object_release(p_vout);
+        vout_Release(p_vout);
     }
 }
 
@@ -422,7 +422,7 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
     vout_thread_t *p_vout = getVout();
     if (p_vout) {
         vout_OSDMessage(p_vout, VOUT_SPU_CHANNEL_OSD, "%s", _("Repeat Off"));
-        vlc_object_release(p_vout);
+        vout_Release(p_vout);
     }
 }
 
@@ -578,7 +578,7 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
         vout_thread_t *p_vout = input_GetVout(p_input);
         if (p_vout != NULL) {
             var_SetInteger(vlc_object_instance(getIntf()), "key-action", ACTIONID_POSITION);
-            vlc_object_release(p_vout);
+            vout_Release(p_vout);
         }
         input_Release(p_input);
     }
@@ -606,7 +606,7 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
     if (p_vout) {
         BOOL b_fs = var_ToggleBool(p_vout, "fullscreen");
         var_SetBool(pl_Get(p_intf), "fullscreen", b_fs);
-        vlc_object_release(p_vout);
+        vout_Release(p_vout);
     } else { // e.g. lion fullscreen toggle
         BOOL b_fs = var_ToggleBool(pl_Get(p_intf), "fullscreen");
         [[[VLCMain sharedInstance] voutProvider] setFullscreen:b_fs forWindow:nil withAnimation:YES];
@@ -693,7 +693,7 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
                             eventHandled = YES;
                         }
                     }
-                    vlc_object_release(p_vout);
+                    vout_Release(p_vout);
                 }
                 input_Release(p_input);
             }
diff --git a/modules/gui/macosx/coreinteraction/VLCVideoFilterHelper.m b/modules/gui/macosx/coreinteraction/VLCVideoFilterHelper.m
index 182f6b7ad2..f33b496514 100644
--- a/modules/gui/macosx/coreinteraction/VLCVideoFilterHelper.m
+++ b/modules/gui/macosx/coreinteraction/VLCVideoFilterHelper.m
@@ -106,7 +106,7 @@
             for (NSValue * val in vouts) {
                 vout_thread_t *p_vout = [val pointerValue];
                 var_SetString(p_vout, psz_filter_type, psz_string);
-                vlc_object_release(p_vout);
+                vout_Release(p_vout);
             }
     }
 
@@ -172,7 +172,7 @@
 
     if (vouts)
         for (NSValue *ptr in vouts)
-            vlc_object_release((vout_thread_t *)[ptr pointerValue]);
+            vout_Release((vout_thread_t *)[ptr pointerValue]);
 }
 
 
diff --git a/modules/gui/macosx/menus/VLCMainMenu.m b/modules/gui/macosx/menus/VLCMainMenu.m
index e5321af3fc..e5d32b94cc 100644
--- a/modules/gui/macosx/menus/VLCMainMenu.m
+++ b/modules/gui/macosx/menus/VLCMainMenu.m
@@ -597,7 +597,7 @@
             [self setupVarMenuItem:_deinterlace_mode target: (vlc_object_t *)p_vout
                                      var:"deinterlace-mode" selector: @selector(toggleVar:)];
 
-            vlc_object_release(p_vout);
+            vout_Release(p_vout);
 
             [self refreshVoutDeviceMenu:nil];
         }
@@ -949,7 +949,7 @@
         {
             [[NSApp keyWindow] performZoom:sender];
         }
-        vlc_object_release(p_vout);
+        vout_Release(p_vout);
     }
 }
 
@@ -963,7 +963,7 @@
             BOOL b_fs = var_ToggleBool(p_vout, "video-on-top");
             var_SetBool(pl_Get(getIntf()), "video-on-top", b_fs);
 
-            vlc_object_release(p_vout);
+            vout_Release(p_vout);
         }
         input_Release(p_input);
     }
@@ -1636,7 +1636,7 @@
                 [mi setState: _playerController.fullscreen];
 
             enabled = YES;
-            vlc_object_release(p_vout);
+            vout_Release(p_vout);
         }
 
         [self setupMenus]; /* Make sure video menu is up to date */
diff --git a/modules/gui/macosx/os-integration/applescript.m b/modules/gui/macosx/os-integration/applescript.m
index 0c92cb3f74..ff4745f59f 100644
--- a/modules/gui/macosx/os-integration/applescript.m
+++ b/modules/gui/macosx/os-integration/applescript.m
@@ -159,7 +159,7 @@
     if (!p_vout)
         return NO;
     BOOL b_value = var_GetBool(p_vout, "fullscreen");
-    vlc_object_release(p_vout);
+    vout_Release(p_vout);
     return b_value;
 }
 
@@ -168,10 +168,10 @@
     if (!p_vout)
         return;
     if (var_GetBool(p_vout, "fullscreen") == mode) {
-        vlc_object_release(p_vout);
+        vout_Release(p_vout);
         return;
     }
-    vlc_object_release(p_vout);
+    vout_Release(p_vout);
     [[VLCCoreInteraction sharedInstance] toggleFullscreen];
 }
 
diff --git a/modules/gui/macosx/panels/VLCTrackSynchronizationWindowController.m b/modules/gui/macosx/panels/VLCTrackSynchronizationWindowController.m
index c426b67ed5..c64216bd6d 100644
--- a/modules/gui/macosx/panels/VLCTrackSynchronizationWindowController.m
+++ b/modules/gui/macosx/panels/VLCTrackSynchronizationWindowController.m
@@ -205,7 +205,7 @@
                 vout_thread_t *p_vout = [ptr pointerValue];
 
                 var_SetFloat(p_vout, SUBSDELAY_CFG_FACTOR, f_factor);
-                vlc_object_release(p_vout);
+                vout_Release(p_vout);
             }
         [VLCVideoFilterHelper setVideoFilter: "subsdelay" on: f_factor > 0];
 
diff --git a/modules/gui/macosx/panels/VLCVideoEffectsWindowController.m b/modules/gui/macosx/panels/VLCVideoEffectsWindowController.m
index 0a9bfe8ef0..8c1b880f0f 100644
--- a/modules/gui/macosx/panels/VLCVideoEffectsWindowController.m
+++ b/modules/gui/macosx/panels/VLCVideoEffectsWindowController.m
@@ -125,7 +125,7 @@
         for (NSValue *ptr in vouts) {
             vout_thread_t *p_vout = [ptr pointerValue];
             var_SetString(p_vout, "sub-source", [tempString UTF8String]);
-            vlc_object_release(p_vout);
+            vout_Release(p_vout);
         }
 
     tempString = B64DecNSStr([items objectAtIndex:2]);
@@ -1023,7 +1023,7 @@
             var_SetInteger(p_vout, "crop-bottom", [_cropBottomTextField intValue]);
             var_SetInteger(p_vout, "crop-left", [_cropLeftTextField intValue]);
             var_SetInteger(p_vout, "crop-right", [_cropRightTextField intValue]);
-            vlc_object_release(p_vout);
+            vout_Release(p_vout);
         }
 }
 
diff --git a/modules/gui/macosx/windows/video/VLCVideoWindowCommon.m b/modules/gui/macosx/windows/video/VLCVideoWindowCommon.m
index 7b0d6b785a..8380be27bc 100644
--- a/modules/gui/macosx/windows/video/VLCVideoWindowCommon.m
+++ b/modules/gui/macosx/windows/video/VLCVideoWindowCommon.m
@@ -452,7 +452,7 @@
         vout_thread_t *p_vout = getVoutForActiveWindow();
         if (p_vout) {
             var_SetBool(p_vout, "fullscreen", true);
-            vlc_object_release(p_vout);
+            vout_Release(p_vout);
         }
     }
 
@@ -498,7 +498,7 @@
         vout_thread_t *p_vout = getVoutForActiveWindow();
         if (p_vout) {
             var_SetBool(p_vout, "fullscreen", false);
-            vlc_object_release(p_vout);
+            vout_Release(p_vout);
         }
     }
 
diff --git a/modules/gui/macosx/windows/video/VLCVoutView.m b/modules/gui/macosx/windows/video/VLCVoutView.m
index e53d11cbf0..78b5d41bde 100644
--- a/modules/gui/macosx/windows/video/VLCVoutView.m
+++ b/modules/gui/macosx/windows/video/VLCVoutView.m
@@ -68,7 +68,7 @@
 - (void)dealloc
 {
     if (p_vout)
-        vlc_object_release(p_vout);
+        vout_Release(p_vout);
 
     [self unregisterDraggedTypes];
 }
@@ -316,13 +316,13 @@
 {
     assert(p_vout == NULL);
     p_vout = p_vout_thread;
-    vlc_object_hold(p_vout);
+    vout_Hold(p_vout);
 }
 
 - (vout_thread_t *)voutThread
 {
     if (p_vout) {
-        vlc_object_hold(p_vout);
+        vout_Hold(p_vout);
         return p_vout;
     }
 
@@ -332,7 +332,7 @@
 - (void)releaseVoutThread
 {
     if (p_vout) {
-        vlc_object_release(p_vout);
+        vout_Release(p_vout);
         p_vout = NULL;
     }
 }
diff --git a/modules/gui/ncurses.c b/modules/gui/ncurses.c
index 746ca2c69f..d827844614 100644
--- a/modules/gui/ncurses.c
+++ b/modules/gui/ncurses.c
@@ -1574,7 +1574,7 @@ static void HandleCommonKey(intf_thread_t *intf, input_thread_t *input,
             if (p_vout) {
                 bool fs = var_ToggleBool(p_playlist, "fullscreen");
                 var_SetBool(p_vout, "fullscreen", fs);
-                vlc_object_release(p_vout);
+                vout_Release(p_vout);
             }
         }
         return;
diff --git a/modules/gui/qt/actions_manager.cpp b/modules/gui/qt/actions_manager.cpp
index 31e583e06c..aec1207a31 100644
--- a/modules/gui/qt/actions_manager.cpp
+++ b/modules/gui/qt/actions_manager.cpp
@@ -127,7 +127,7 @@ void ActionsManager::fullscreen()
     if( p_vout)
     {
         var_SetBool( p_vout, "fullscreen", fs );
-        vlc_object_release( p_vout );
+        vout_Release(p_vout);
     }
 }
 
@@ -137,7 +137,7 @@ void ActionsManager::snapshot()
     if( p_vout )
     {
         var_TriggerCallback( p_vout, "video-snapshot" );
-        vlc_object_release( p_vout );
+        vout_Release(p_vout);
     }
 }
 
diff --git a/modules/gui/qt/components/controller.cpp b/modules/gui/qt/components/controller.cpp
index c26d7a3680..7a624234f5 100644
--- a/modules/gui/qt/components/controller.cpp
+++ b/modules/gui/qt/components/controller.cpp
@@ -1188,7 +1188,7 @@ void FullscreenControllerWidget::setVoutList( vout_thread_t **pp_vout, int i_vou
         vout.removeAll( p_vout );
         vlc_mutex_unlock( &lock );
 
-        vlc_object_release( VLC_OBJECT(p_vout) );
+        vout_Release(p_vout);
     }
 
     /* Vout to track */
@@ -1202,7 +1202,7 @@ void FullscreenControllerWidget::setVoutList( vout_thread_t **pp_vout, int i_vou
 
     foreach( vout_thread_t *p_vout, add )
     {
-        vlc_object_hold( VLC_OBJECT(p_vout) );
+        vout_Hold(p_vout);
 
         vlc_mutex_lock( &lock );
         vout.append( p_vout );
diff --git a/modules/gui/qt/components/controller_widget.cpp b/modules/gui/qt/components/controller_widget.cpp
index 647c035d35..5136a3eed7 100644
--- a/modules/gui/qt/components/controller_widget.cpp
+++ b/modules/gui/qt/components/controller_widget.cpp
@@ -293,7 +293,7 @@ void AspectRatioComboBox::updateRatios()
     setEnabled( true );
     free(text_list);
     free(val_list);
-    vlc_object_release( p_vout );
+    vout_Release(p_vout);
 }
 
 void AspectRatioComboBox::updateAspectRatio( int x )
@@ -304,6 +304,6 @@ void AspectRatioComboBox::updateAspectRatio( int x )
         var_SetString( p_vout, "aspect-ratio", qtu( itemData(x).toString() ) );
     }
     if( p_vout )
-        vlc_object_release( p_vout );
+        vout_Release(p_vout);
 }
 
diff --git a/modules/gui/qt/components/extended_panels.cpp b/modules/gui/qt/components/extended_panels.cpp
index f170357687..4b09b432a4 100644
--- a/modules/gui/qt/components/extended_panels.cpp
+++ b/modules/gui/qt/components/extended_panels.cpp
@@ -277,7 +277,7 @@ void ExtVideo::cropChange()
         var_SetInteger( p_vout, "crop-bottom", ui.cropBotPx->value() );
         var_SetInteger( p_vout, "crop-left", ui.cropLeftPx->value() );
         var_SetInteger( p_vout, "crop-right", ui.cropRightPx->value() );
-        vlc_object_release( p_vout );
+        vout_Release(p_vout);
     }
 }
 
@@ -318,7 +318,7 @@ static void UpdateVFiltersString( struct intf_thread_t *p_intf,
         foreach( vout_thread_t *p_vout, p_vouts )
         {
             var_SetString( p_vout, psz_filter_type, value );
-            vlc_object_release( p_vout );
+            vout_Release(p_vout);
         }
     }
 }
@@ -565,7 +565,7 @@ void ExtVideo::setFilterOption( const char *psz_module, const char *psz_option,
     }
 
     foreach( vout_thread_t *p_vout, p_vouts )
-        vlc_object_release( p_vout );
+        vout_Release(p_vout);
 }
 
 void ExtVideo::updateFilterOptions()
@@ -1574,7 +1574,7 @@ void SyncControls::subsdelaySetFactor( double f_factor )
     foreach( vout_thread_t *p_vout, p_vouts )
     {
         var_SetFloat( p_vout, SUBSDELAY_CFG_FACTOR, f_factor );
-        vlc_object_release( p_vout );
+        vout_Release(p_vout);
     }
 }
 
diff --git a/modules/gui/qt/input_manager.cpp b/modules/gui/qt/input_manager.cpp
index ade9e328f4..9ce7a9ee1d 100644
--- a/modules/gui/qt/input_manager.cpp
+++ b/modules/gui/qt/input_manager.cpp
@@ -645,7 +645,7 @@ void InputManager::UpdateVout()
 
     /* Release the vout list */
     for( size_t i = 0; i < i_vout; i++ )
-        vlc_object_release( (vlc_object_t*)pp_vout[i] );
+        vout_Release(pp_vout[i]);
     free( pp_vout );
 }
 
diff --git a/modules/gui/qt/menus.cpp b/modules/gui/qt/menus.cpp
index 0ebfa136b0..438745b188 100644
--- a/modules/gui/qt/menus.cpp
+++ b/modules/gui/qt/menus.cpp
@@ -244,7 +244,7 @@ static int VideoAutoMenuBuilder( playlist_t *pl, input_thread_t *p_input,
     PUSH_VAR( "deinterlace-mode" );
 
     if( p_object )
-        vlc_object_release( p_object );
+        vout_Release( p_object );
     return VLC_SUCCESS;
 }
 
@@ -1036,7 +1036,7 @@ QMenu* VLCMenuBar::PopupMenu( intf_thread_t *p_intf, bool show )
                         qtr( "Leave Fullscreen" ),"" , ITEM_NORMAL,
                         VLC_OBJECT(THEPL), val, VLC_VAR_BOOL, b_isFullscreen );
             }
-            vlc_object_release( p_vout );
+            vout_Release(p_vout);
 
             menu->addSeparator();
         }
@@ -1535,7 +1535,7 @@ void VLCMenuBar::DoAction( QObject *data )
             if( vout != NULL )
             {
                 var_Set( vout, var, val ); /* never void class */
-                vlc_object_release( vout );
+                vout_Release(vout);
             }
         }
     }
diff --git a/modules/gui/skins2/commands/cmd_fullscreen.cpp b/modules/gui/skins2/commands/cmd_fullscreen.cpp
index 40cc40c3d6..459ce10ff9 100644
--- a/modules/gui/skins2/commands/cmd_fullscreen.cpp
+++ b/modules/gui/skins2/commands/cmd_fullscreen.cpp
@@ -38,7 +38,7 @@ void CmdFullscreen::execute()
         {
             // Toggle fullscreen
             fs = var_ToggleBool( pVout, "fullscreen" );
-            vlc_object_release( pVout );
+            vout_Release(pVout);
             hasVout = true;
         }
     }
diff --git a/modules/gui/skins2/commands/cmd_quit.cpp b/modules/gui/skins2/commands/cmd_quit.cpp
index 96e5e412ba..85ba6d655c 100644
--- a/modules/gui/skins2/commands/cmd_quit.cpp
+++ b/modules/gui/skins2/commands/cmd_quit.cpp
@@ -42,7 +42,7 @@ void CmdQuit::execute()
         if( pVout )
         {
             vout_OSDMessage( pVout, VOUT_SPU_CHANNEL_OSD, "%s", _( "Quit" ) );
-            vlc_object_release( pVout );
+            vout_Release(pVout);
         }
     }
 
diff --git a/modules/gui/skins2/commands/cmd_snapshot.cpp b/modules/gui/skins2/commands/cmd_snapshot.cpp
index 99a0f4814e..0ca276f43f 100644
--- a/modules/gui/skins2/commands/cmd_snapshot.cpp
+++ b/modules/gui/skins2/commands/cmd_snapshot.cpp
@@ -34,7 +34,7 @@ void CmdSnapshot::execute()
     {
         // Take a snapshot
         var_TriggerCallback( pVout, "video-snapshot" );
-        vlc_object_release( pVout );
+        vout_Release(pVout);
     }
 }
 
diff --git a/modules/gui/skins2/src/vlcproc.cpp b/modules/gui/skins2/src/vlcproc.cpp
index 86deb91c1a..25803a1872 100644
--- a/modules/gui/skins2/src/vlcproc.cpp
+++ b/modules/gui/skins2/src/vlcproc.cpp
@@ -186,7 +186,7 @@ VlcProc::~VlcProc()
 {
     if( m_pVout )
     {
-        vlc_object_release( m_pVout );
+        vout_Release(m_pVout);
         m_pVout = NULL;
     }
 
@@ -495,7 +495,7 @@ void VlcProc::on_intf_event_changed( vlc_object_t* p_obj, vlc_value_t newVal )
             {
                 // end of input or vout reuse (nothing to do)
                 if( pVout )
-                    vlc_object_release( pVout );
+                    vout_Release(pVout);
                 break;
             }
             if( m_pVout )
@@ -503,7 +503,7 @@ void VlcProc::on_intf_event_changed( vlc_object_t* p_obj, vlc_value_t newVal )
                 // remove previous Vout callbacks
                 var_DelCallback( m_pVout, "mouse-moved",
                                  onGenericCallback, this );
-                vlc_object_release( m_pVout );
+                vout_Release(m_pVout);
                 m_pVout = NULL;
             }
 
diff --git a/modules/lua/libs/objects.c b/modules/lua/libs/objects.c
index b93a3a0c4e..18ac94aa14 100644
--- a/modules/lua/libs/objects.c
+++ b/modules/lua/libs/objects.c
@@ -115,6 +115,15 @@ static int vlclua_get_input( lua_State *L )
     return 1;
 }
 
+static int vlclua_vout_release(lua_State *L)
+{
+    vlc_object_t **pp = luaL_checkudata(L, 1, "vlc_object");
+
+    lua_pop(L, 1);
+    vout_Release((vout_thread_t *)*pp);
+    return 0;
+}
+
 static int vlclua_get_vout( lua_State *L )
 {
     input_thread_t *p_input = vlclua_get_input_internal( L );
@@ -124,8 +133,7 @@ static int vlclua_get_vout( lua_State *L )
         input_Release(p_input);
         if(p_vout)
         {
-            vlclua_push_vlc_object(L, VLC_OBJECT(p_vout),
-                                   vlclua_object_release);
+            vlclua_push_vlc_object(L, VLC_OBJECT(p_vout), vlclua_vout_release);
             return 1;
         }
     }
diff --git a/modules/lua/libs/osd.c b/modules/lua/libs/osd.c
index 3757431638..c71d784b9f 100644
--- a/modules/lua/libs/osd.c
+++ b/modules/lua/libs/osd.c
@@ -77,7 +77,7 @@ static int vlclua_osd_icon( lua_State *L )
         if( p_vout )
         {
             vout_OSDIcon( p_vout, i_chan, i_icon );
-            vlc_object_release( p_vout );
+            vout_Release(p_vout);
         }
         input_Release(p_input);
     }
@@ -125,7 +125,7 @@ static int vlclua_osd_message( lua_State *L )
         {
             vout_OSDText( p_vout, i_chan, vlc_osd_position_from_string( psz_position ),
                           duration, psz_message );
-            vlc_object_release( p_vout );
+            vout_Release(p_vout);
         }
         input_Release(p_input);
     }
@@ -168,7 +168,7 @@ static int vlclua_osd_slider( lua_State *L )
         if( p_vout )
         {
             vout_OSDSlider( p_vout, i_chan, i_position, i_type );
-            vlc_object_release( p_vout );
+            vout_Release(p_vout);
         }
         input_Release(p_input);
     }
@@ -189,7 +189,7 @@ static int vlclua_spu_channel_register( lua_State *L )
     }
 
     int i_chan = vout_RegisterSubpictureChannel( p_vout );
-    vlc_object_release( p_vout );
+    vout_Release( p_vout );
     lua_pushinteger( L, i_chan );
     return 1;
 }
@@ -208,7 +208,7 @@ static int vlclua_spu_channel_clear( lua_State *L )
     }
 
     vout_FlushSubpictureChannel( p_vout, i_chan );
-    vlc_object_release( p_vout );
+    vout_Release(p_vout);
     return 0;
 }
 
diff --git a/modules/lua/libs/video.c b/modules/lua/libs/video.c
index 110f56a68f..f38258ded2 100644
--- a/modules/lua/libs/video.c
+++ b/modules/lua/libs/video.c
@@ -58,7 +58,7 @@ static int vlclua_fullscreen( lua_State *L )
 
     i_ret = vlclua_var_toggle_or_set( L, p_vout, "fullscreen" );
 
-    vlc_object_release( p_vout );
+    vout_Release(p_vout);
     return i_ret;
 }
 
diff --git a/src/input/control.c b/src/input/control.c
index 2aa79e67b3..ae30ee1395 100644
--- a/src/input/control.c
+++ b/src/input/control.c
@@ -264,7 +264,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
                                             vlc_gettext("Subtitle track added"));
                             break;
                     }
-                    vlc_object_release( (vlc_object_t *)p_vout );
+                    vout_Release(p_vout);
                 }
             }
             return VLC_SUCCESS;
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 93d49a9289..d6ca661f86 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -607,7 +607,7 @@ static subpicture_t *spu_new_buffer( decoder_t *p_dec,
         if( p_owner->p_vout )
         {
             vlc_mutex_lock( &p_owner->lock );
-            vlc_object_release( p_owner->p_vout );
+            vout_Release(p_owner->p_vout);
             p_owner->p_vout = NULL;
             vlc_mutex_unlock( &p_owner->lock );
         }
@@ -621,12 +621,12 @@ static subpicture_t *spu_new_buffer( decoder_t *p_dec,
 
         vlc_mutex_lock( &p_owner->lock );
         if( p_owner->p_vout )
-            vlc_object_release( p_owner->p_vout );
+            vout_Release(p_owner->p_vout);
         p_owner->p_vout = p_vout;
         vlc_mutex_unlock( &p_owner->lock );
     }
     else
-        vlc_object_release( p_vout );
+        vout_Release(p_vout);
 
     p_subpic = subpicture_New( p_updater );
     if( p_subpic )
@@ -1994,7 +1994,7 @@ static void DeleteDecoder( decoder_t * p_dec )
             {
                 vout_FlushSubpictureChannel( p_owner->p_vout,
                                              p_owner->i_spu_channel );
-                vlc_object_release( p_owner->p_vout );
+                vout_Release(p_owner->p_vout);
             }
             break;
         }
@@ -2548,7 +2548,7 @@ void input_DecoderGetObjects( decoder_t *p_dec,
     vlc_mutex_lock( &p_owner->lock );
     if( pp_vout )
         *pp_vout = p_dec->fmt_in.i_cat == VIDEO_ES && p_owner->p_vout ?
-            vlc_object_hold( p_owner->p_vout ) : NULL;
+            vout_Hold(p_owner->p_vout) : NULL;
     if( pp_aout )
         *pp_aout = p_dec->fmt_in.i_cat == AUDIO_ES && p_owner->p_aout ?
             vlc_object_hold( p_owner->p_aout ) : NULL;
diff --git a/src/input/decoder.h b/src/input/decoder.h
index dfb06f3bc4..db491ac44e 100644
--- a/src/input/decoder.h
+++ b/src/input/decoder.h
@@ -112,7 +112,7 @@ size_t input_DecoderGetFifoSize( decoder_t *p_dec );
 /**
  * This function returns the objects associated to a decoder
  *
- * They must be released using vlc_object_release().
+ * They must be released.
  */
 void input_DecoderGetObjects( decoder_t *, vout_thread_t **, audio_output_t ** );
 
diff --git a/src/input/input.c b/src/input/input.c
index eae7b6a139..83800dca1d 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1750,7 +1750,7 @@ static void ViewpointApply( input_thread_t *p_input )
         /* This variable can only be read from callbacks */
         var_Change( pp_vout[i], "viewpoint", VLC_VAR_SETVALUE,
                     (vlc_value_t) { .p_address = NULL } );
-        vlc_object_release( pp_vout[i] );
+        vout_Release(pp_vout[i]);
     }
     free( pp_vout );
 
@@ -1814,7 +1814,7 @@ static void ControlNav( input_thread_t *p_input, int i_type )
         if( !b_viewpoint_ch
          && var_GetBool( pp_vout[i], "viewpoint-changeable" ) )
             b_viewpoint_ch = true;
-        vlc_object_release( pp_vout[i] );
+        vout_Release(pp_vout[i]);
     }
     free( pp_vout );
 
diff --git a/src/input/player.c b/src/input/player.c
index 5f70c85f5e..9b720e403b 100644
--- a/src/input/player.c
+++ b/src/input/player.c
@@ -279,7 +279,7 @@ vlc_player_vout_OSDReleaseAll(vlc_player_t *player, vout_thread_t **vouts,
                             size_t count)
 {
     for (size_t i = 0; i < count; ++i)
-        vlc_object_release(vouts[i]);
+        vout_Release(vouts[i]);
     free(vouts);
     (void) player;
 }
@@ -3333,7 +3333,7 @@ vlc_player_vout_SetVar(vlc_player_t *player, const char *name, int type,
     for (size_t i = 0; i < count; i++)
     {
         var_SetChecked(vouts[i], name, type, val);
-        vlc_object_release(vouts[i]);
+        vout_Release(vouts[i]);
     }
     free(vouts);
 }
@@ -3347,7 +3347,7 @@ vlc_player_vout_TriggerOption(vlc_player_t *player, const char *option)
     for (size_t i = 0; i < count; ++i)
     {
         var_TriggerCallback(vouts[i], option);
-        vlc_object_release(vouts[i]);
+        vout_Release(vouts[i]);
     }
     free(vouts);
 }
diff --git a/src/input/resource.c b/src/input/resource.c
index 49abb683c4..22719cf14a 100644
--- a/src/input/resource.c
+++ b/src/input/resource.c
@@ -201,7 +201,7 @@ static vout_thread_t *HoldVout( input_resource_t *p_resource )
 
     vout_thread_t *p_vout = p_resource->i_vout > 0 ? p_resource->pp_vout[0] : NULL;
     if( p_vout )
-        vlc_object_hold( p_vout );
+        vout_Hold(p_vout);
 
     vlc_mutex_unlock( &p_resource->lock_hold );
 
@@ -231,7 +231,7 @@ static void HoldVouts( input_resource_t *p_resource, vout_thread_t ***ppp_vout,
     for( int i = 0; i < p_resource->i_vout; i++ )
     {
         pp_vout[i] = p_resource->pp_vout[i];
-        vlc_object_hold( pp_vout[i] );
+        vout_Hold(pp_vout[i]);
     }
 
 exit:
diff --git a/src/input/resource.h b/src/input/resource.h
index 0bcd7160fb..123018064c 100644
--- a/src/input/resource.h
+++ b/src/input/resource.h
@@ -44,14 +44,14 @@ void input_resource_PutVout(input_resource_t *, vout_thread_t *);
 /**
  * This function returns one of the current vout if any.
  *
- * You must call vlc_object_release on the value returned (if non NULL).
+ * You must call vout_Release() on the value returned (if non NULL).
  */
 vout_thread_t *input_resource_HoldVout( input_resource_t * );
 
 /**
  * This function returns all current vouts if any.
  *
- * You must call vlc_object_release on all values returned (if non NULL).
+ * You must call vout_Release() on all values returned (if non NULL).
  */
 void input_resource_HoldVouts( input_resource_t *, vout_thread_t ***, size_t * );
 
diff --git a/test/src/input/player.c b/test/src/input/player.c
index d477629607..669a6c5013 100644
--- a/test/src/input/player.c
+++ b/test/src/input/player.c
@@ -437,7 +437,7 @@ player_on_vout_list_changed(vlc_player_t *player,
         .action = action,
         .vout = vout,
     };
-    vlc_object_hold(vout);
+    vout_Hold(vout);
     VEC_PUSH(on_vout_list_changed, report);
 }
 
@@ -566,7 +566,7 @@ ctx_reset(struct ctx *ctx)
     {
         struct report_vout_list report;
         FOREACH_VEC(report, on_vout_list_changed)
-            vlc_object_release(report.vout);
+            vout_Release(report.vout);
     }
 
     {




More information about the vlc-commits mailing list