]> git.sesse.net Git - vlc/commitdiff
Remove pl_Release, and rename pl_Hold back to pl_Get
authorRémi Denis-Courmont <remi@remlab.net>
Tue, 9 Feb 2010 19:18:40 +0000 (21:18 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Tue, 9 Feb 2010 19:22:13 +0000 (21:22 +0200)
pl_Hold() assumed the playlist was already created.
pl_Release() does not solve any problem. Playlist synchronization is
done with the playlist lock, while playlist deletion must anyway be done
after all interfaces, services and other threads are joined.

53 files changed:
include/vlc_playlist.h
modules/access_output/http.c
modules/control/dbus.c
modules/control/gestures.c
modules/control/hotkeys.c
modules/control/http/http.c
modules/control/netsync.c
modules/control/rc.c
modules/gui/hildon/maemo.c
modules/gui/macosx/applescript.m
modules/gui/macosx/controls.m
modules/gui/macosx/embeddedwindow.m
modules/gui/macosx/equalizer.m
modules/gui/macosx/extended.m
modules/gui/macosx/intf.m
modules/gui/macosx/playlist.m
modules/gui/macosx/playlistinfo.m
modules/gui/macosx/vout.m
modules/gui/macosx/wizard.m
modules/gui/ncurses.c
modules/gui/qt4/components/controller_widget.cpp
modules/gui/qt4/components/info_panels.cpp
modules/gui/qt4/input_manager.cpp
modules/gui/qt4/qt4.cpp
modules/gui/skins2/src/skin_main.cpp
modules/misc/audioscrobbler.c
modules/misc/inhibit.c
modules/misc/lua/demux.c
modules/misc/lua/libs/input.c
modules/misc/lua/libs/objects.c
modules/misc/lua/libs/playlist.c
modules/misc/lua/libs/playlist.h
modules/misc/lua/libs/sd.c
modules/misc/lua/libs/volume.c
modules/misc/lua/meta.c
modules/misc/notify/growl.m
modules/misc/notify/growl_udp.c
modules/misc/notify/msn.c
modules/misc/notify/notify.c
modules/misc/notify/telepathy.c
modules/misc/notify/xosd.c
modules/video_filter/atmo/atmo.cpp
modules/video_output/msw/direct3d.c
modules/video_output/msw/directx.c
modules/visualization/goom.c
src/audio_output/intf.c
src/input/meta.c
src/libvlc.c
src/libvlccore.sym
src/playlist/control.c
src/text/strings.c
src/video_output/event.h
src/win32/specific.c

index 6854b9fb47d2cde0143f884a70b321e074f7cd20..061e7611a63190f471532efe2bf71b37e65264f8 100644 (file)
@@ -260,11 +260,8 @@ enum pl_locked_state
 #define PL_UNLOCK playlist_Unlock( p_playlist )
 #define PL_ASSERT_LOCKED playlist_AssertLocked( p_playlist )
 
-VLC_EXPORT( playlist_t *, pl_Hold, ( vlc_object_t * ) );
-#define pl_Hold( a ) pl_Hold( VLC_OBJECT(a) )
-
-VLC_EXPORT( void, pl_Release, ( vlc_object_t * ) );
-#define pl_Release(a) pl_Release( VLC_OBJECT(a) )
+VLC_EXPORT( playlist_t *, pl_Get, ( vlc_object_t * ) );
+#define pl_Get( a ) pl_Get( VLC_OBJECT(a) )
 
 /* Playlist control */
 #define playlist_Play(p) playlist_Control(p,PLAYLIST_PLAY, pl_Unlocked )
@@ -379,11 +376,7 @@ VLC_EXPORT( playlist_item_t *, playlist_GetPrevLeaf, ( playlist_t *p_playlist, p
 #define pl_CurrentInput(a) __pl_CurrentInput( VLC_OBJECT(a) )
 static  inline input_thread_t * __pl_CurrentInput( vlc_object_t * p_this )
 {
-    playlist_t * p_playlist = pl_Hold( p_this );
-    if( !p_playlist ) return NULL;
-    input_thread_t * p_input = playlist_CurrentInput( p_playlist );
-    pl_Release( p_this );
-    return p_input;
+    return playlist_CurrentInput( pl_Get( p_this ) );
 }
 
 /** Tell if the playlist is empty */
index 8a87765dbb934f3a581eb9cf11af81b41a7b306a..79c57f4e61c70afe47b14575810de9682dd09ee8 100644 (file)
@@ -282,7 +282,7 @@ static int Open( vlc_object_t *p_this )
     if( var_InheritInteger(p_this, SOUT_CFG_PREFIX "bonjour") )
     {
         char                *psz_txt, *psz_name;
-        playlist_t          *p_playlist = pl_Hold( p_access );
+        playlist_t          *p_playlist = pl_Get( p_access );
 
         char *psz_uri = input_item_GetURI( p_playlist->status.p_item->p_input );
         char *psz_newuri = psz_uri;
@@ -293,7 +293,6 @@ static int Open( vlc_object_t *p_this )
         if( psz_file_name &&
             asprintf( &psz_txt, "path=%s", psz_file_name ) == -1 )
             {
-                pl_Release( p_access );
                 free( psz_uri );
                 return VLC_ENOMEM;
             }
@@ -307,7 +306,6 @@ static int Open( vlc_object_t *p_this )
 
         if( p_sys->p_bonjour == NULL )
             msg_Err( p_access, "unable to start requested Bonjour announce" );
-        pl_Release( p_access );
     }
     else
         p_sys->p_bonjour = NULL;
index 90ee7b2e9083a1c2299f5d1929492d205ece2052..5fcab72e72a6ebf5808d4f663e7572d31d6470e9 100644 (file)
@@ -745,7 +745,7 @@ static int Open( vlc_object_t *p_this )
     p_sys->p_events = vlc_array_new();
     vlc_mutex_init( &p_sys->lock );
 
-    p_playlist = pl_Hold( p_intf );
+    p_playlist = pl_Get( p_intf );
     p_sys->p_playlist = p_playlist;
 
     PL_LOCK;
@@ -788,7 +788,6 @@ static void Close   ( vlc_object_t *p_this )
         var_DelCallback( p_input, "state", AllCallback, p_intf );
         vlc_object_release( p_input );
     }
-    pl_Release( p_intf );
 
     dbus_connection_unref( p_sys->p_conn );
 
index fdf7cceb3cb1f34b902db5dc76c8234676ce79d3..8e8d9291043c5b9c26b0ef0aa0089f9ee423d7ea 100644 (file)
@@ -203,7 +203,7 @@ static void RunIntf( intf_thread_t *p_intf )
             /* If you modify this, please try to follow this convention:
                Start with LEFT, RIGHT for playback related commands
                and UP, DOWN, for other commands */
-            playlist_t * p_playlist = pl_Hold( p_intf );
+            playlist_t * p_playlist = pl_Get( p_intf );
             switch( p_sys->i_pattern )
             {
             case LEFT:
@@ -399,7 +399,6 @@ static void RunIntf( intf_thread_t *p_intf )
             p_sys->i_num_gestures = 0;
             p_sys->i_pattern = 0;
             p_sys->b_got_gesture = false;
-            pl_Release( p_intf );
         }
 
         /*
@@ -417,9 +416,7 @@ static void RunIntf( intf_thread_t *p_intf )
 
         if( p_sys->p_vout == NULL )
         {
-            playlist_t *p_playlist = pl_Hold( p_intf );
-            p_input = playlist_CurrentInput( p_playlist );
-            pl_Release( p_intf );
+            p_input = playlist_CurrentInput( pl_Get( p_intf ) );
             if( p_input )
             {
                 p_sys->p_vout = input_GetVout( p_input );
index bb989bf0978b69fb558085f8e2b46b5740a07475..d3af55ff28fd2f318ee60556792008b492a9e13e 100644 (file)
@@ -146,7 +146,7 @@ static void Close( vlc_object_t *p_this )
 static int PutAction( intf_thread_t *p_intf, int i_action )
 {
     intf_sys_t *p_sys = p_intf->p_sys;
-    playlist_t *p_playlist = pl_Hold( p_intf );
+    playlist_t *p_playlist = pl_Get( p_intf );
 
     /* Update the input */
     input_thread_t *p_input = playlist_CurrentInput( p_playlist );
@@ -887,7 +887,6 @@ cleanup_and_continue:
         vlc_object_release( p_vout );
     if( p_input )
         vlc_object_release( p_input );
-    pl_Release( p_intf );
     return VLC_SUCCESS;
 }
 
@@ -960,7 +959,7 @@ static void PlayBookmark( intf_thread_t *p_intf, int i_num )
     if( asprintf( &psz_bookmark_name, "bookmark%i", i_num ) == -1 )
         return;
 
-    playlist_t *p_playlist = pl_Hold( p_intf );
+    playlist_t *p_playlist = pl_Get( p_intf );
     char *psz_bookmark = var_CreateGetString( p_intf, psz_bookmark_name );
 
     PL_LOCK;
@@ -980,7 +979,6 @@ static void PlayBookmark( intf_thread_t *p_intf, int i_num )
 
     free( psz_bookmark );
     free( psz_bookmark_name );
-    pl_Release( p_intf );
 }
 
 static void SetBookmark( intf_thread_t *p_intf, int i_num )
@@ -989,7 +987,7 @@ static void SetBookmark( intf_thread_t *p_intf, int i_num )
     if( asprintf( &psz_bookmark_name, "bookmark%i", i_num ) == -1 )
         return;
 
-    playlist_t *p_playlist = pl_Hold( p_intf );
+    playlist_t *p_playlist = pl_Get( p_intf );
     var_Create( p_intf, psz_bookmark_name,
                 VLC_VAR_STRING|VLC_VAR_DOINHERIT );
     playlist_item_t * p_item = playlist_CurrentPlayingItem( p_playlist );
@@ -1002,7 +1000,6 @@ static void SetBookmark( intf_thread_t *p_intf, int i_num )
         config_SaveConfigFile( p_intf, "hotkeys" );
     }
 
-    pl_Release( p_intf );
     free( psz_bookmark_name );
 }
 
index d35e5b59e8765f9a68132e7560ab1f2fcb7253b4..7232fae23e204e9a1270af9e83723974a71fb151 100644 (file)
@@ -130,7 +130,7 @@ static int Open( vlc_object_t *p_this )
         return( VLC_ENOMEM );
     }
 
-    p_sys->p_playlist = pl_Hold( p_this );
+    p_sys->p_playlist = pl_Get( p_this );
     p_sys->p_input    = NULL;
     p_sys->p_vlm      = NULL;
     p_sys->psz_address = psz_address;
@@ -212,7 +212,6 @@ static int Open( vlc_object_t *p_this )
     if( p_sys->p_httpd_host == NULL )
     {
         msg_Err( p_intf, "cannot listen on %s:%d", psz_address, i_port );
-        pl_Release( p_this );
         free( p_sys->psz_address );
         free( p_sys );
         return VLC_EGENERIC;
@@ -285,7 +284,6 @@ failed:
     httpd_HostDelete( p_sys->p_httpd_host );
     free( p_sys->psz_address );
     free( p_sys );
-    pl_Release( p_this );
     return VLC_EGENERIC;
 }
 
@@ -336,7 +334,6 @@ static void Close ( vlc_object_t *p_this )
     httpd_HostDelete( p_sys->p_httpd_host );
     free( p_sys->psz_address );
     free( p_sys );
-    pl_Release( p_this );
 }
 
 /****************************************************************************
index fb7956ed842ef20f47ba04c4beeb0be61d3c45c4..455be184dcbb1f71c74630c12d707a43ecba0667 100644 (file)
@@ -139,7 +139,7 @@ static int Open(vlc_object_t *object)
     sys->timeout = var_InheritInteger(intf, "netsync-timeout");
     if (sys->timeout < 500)
         sys->timeout = 500;
-    sys->playlist = pl_Hold(intf);
+    sys->playlist = pl_Get(intf);
     sys->input = NULL;
 
     var_AddCallback(sys->playlist, "input-current", PlaylistEvent, intf);
@@ -156,7 +156,6 @@ void Close(vlc_object_t *object)
 
     assert(sys->input == NULL);
     var_DelCallback(sys->playlist, "input-current", PlaylistEvent, intf);
-    pl_Release(intf);
     net_Close(sys->fd);
     free(sys);
 }
index 6b5da0b9fe0693cd768eb4995d20761170abac54..db0d9666df2033a27ae83f02a9152e0d822255fa 100644 (file)
@@ -439,7 +439,7 @@ static void RegisterCallbacks( intf_thread_t *p_intf )
 static void Run( intf_thread_t *p_intf )
 {
     input_thread_t * p_input = NULL;
-    playlist_t *     p_playlist = pl_Hold( p_intf );
+    playlist_t *     p_playlist = pl_Get( p_intf );
 
     char p_buffer[ MAX_LINE_LENGTH + 1 ];
     bool b_showpos = var_InheritInteger( p_intf, "rc-show-pos" );
@@ -800,8 +800,6 @@ static void Run( intf_thread_t *p_intf )
         vlc_object_release( p_input );
     }
 
-    pl_Release( p_intf );
-
     var_DelCallback( p_intf->p_libvlc, "volume-change", VolumeChanged, p_intf );
     vlc_restorecancel( canc );
 }
index 0c6b47a86aac1efe9c9b14063c5b4567d663926f..4809d49c830ebb42858e91c62892cba5bfbe7475 100644 (file)
@@ -86,7 +86,7 @@ static int Open( vlc_object_t *p_this )
     if( p_intf->p_sys == NULL )
         return VLC_ENOMEM;
 
-    p_sys->p_playlist = pl_Hold( p_intf );
+    p_sys->p_playlist = pl_Get( p_intf );
     p_sys->p_input = NULL;
 
     p_sys->p_main_window = NULL;
@@ -100,7 +100,6 @@ static int Open( vlc_object_t *p_this )
     vlc_sem_init (&p_sys->ready, 0);
     if( vlc_clone( &p_sys->thread, Thread, p_intf, VLC_THREAD_PRIORITY_LOW ) )
     {
-        pl_Release (p_sys->p_playlist);
         free (p_sys);
         return VLC_ENOMEM;
     }
@@ -122,7 +121,6 @@ static void Close( vlc_object_t *p_this )
 
     var_Destroy (p_this->p_libvlc, "hildon-iface");
     vlc_join (p_intf->p_sys->thread, NULL);
-    pl_Release ( p_intf->p_sys->p_playlist );
     vlc_spin_destroy( &p_intf->p_sys->event_lock );
     free( p_intf->p_sys );
 }
index 4935d3f71db4a4ffce94f076e2b039285fa72b26..f3e8c4cb140c47c0617123d4c78917f1148d9984 100644 (file)
@@ -41,7 +41,7 @@
     if ( [o_command isEqualToString:@"GetURL"] || [o_command isEqualToString:@"OpenURL"] )
     {
         intf_thread_t * p_intf = VLCIntf;
-        playlist_t * p_playlist = pl_Hold( p_intf );
+        playlist_t * p_playlist = pl_Get( p_intf );
         if( p_playlist == NULL )
         {
             return nil;
@@ -69,7 +69,6 @@
                     noteNewRecentDocumentURL: o_url];
             }
         }
-        pl_Release( p_intf );
     }
     return nil;
 }
@@ -90,7 +89,7 @@
     NSString *o_command = [[self commandDescription] commandName];
 
     intf_thread_t * p_intf = VLCIntf;
-    playlist_t * p_playlist = pl_Hold( p_intf );
+    playlist_t * p_playlist = pl_Get( p_intf );
     if( p_playlist == NULL )
     {
         return nil;
             [o_controls volumeDown:self];
         }
     }
-    pl_Release( p_intf );
     return nil;
 }
 
index 381131aef9974dce7368099de55218d7375af813..29ad6aff7f7fc2bcdb5f113b6435a0cf7ccdbc11 100644 (file)
 - (IBAction)play:(id)sender
 {
     intf_thread_t * p_intf = VLCIntf;
-    playlist_t * p_playlist = pl_Hold( p_intf );
+    playlist_t * p_playlist = pl_Get( p_intf );
     bool empty;
 
     PL_LOCK;
     empty = playlist_IsEmpty( p_playlist );
     PL_UNLOCK;
 
-    pl_Release( p_intf );
-
     if( empty )
         [o_main intfOpenFileGeneric: (id)sender];
 
 {
     vlc_value_t val;
     intf_thread_t * p_intf = VLCIntf;
-    playlist_t * p_playlist = pl_Hold( p_intf );
+    playlist_t * p_playlist = pl_Get( p_intf );
 
     var_Get( p_playlist, "random", &val );
     val.b_bool = !val.b_bool;
 
     p_intf->p_sys->b_playmode_update = true;
     p_intf->p_sys->b_intf_update = true;
-    pl_Release( p_intf );
 }
 
 /* three little ugly helpers */
 - (void)shuffle
 {
     vlc_value_t val;
-    playlist_t *p_playlist = pl_Hold( VLCIntf );
+    playlist_t *p_playlist = pl_Get( VLCIntf );
     var_Get( p_playlist, "random", &val );
     [o_btn_shuffle setState: val.b_bool];
        if(val.b_bool)
         [o_btn_shuffle_embed setImage: [NSImage imageNamed:@"sidebarShuffleOn"]];
        else
         [o_btn_shuffle_embed setImage: [NSImage imageNamed:@"sidebarShuffle"]];    
-    pl_Release( VLCIntf );
 }
 
 - (IBAction)repeatButtonAction:(id)sender
 {
     vlc_value_t looping,repeating;
     intf_thread_t * p_intf = VLCIntf;
-    playlist_t * p_playlist = pl_Hold( p_intf );
+    playlist_t * p_playlist = pl_Get( p_intf );
 
     var_Get( p_playlist, "repeat", &repeating );
     var_Get( p_playlist, "loop", &looping );
     var_Set( p_playlist, "loop", looping );
     p_intf->p_sys->b_playmode_update = true;
     p_intf->p_sys->b_intf_update = true;
-
-    pl_Release( p_intf );
 }
 
 
 {
     vlc_value_t val;
     intf_thread_t * p_intf = VLCIntf;
-    playlist_t * p_playlist = pl_Hold( p_intf );
+    playlist_t * p_playlist = pl_Get( p_intf );
 
     var_Get( p_playlist, "repeat", &val );
     if (!val.b_bool)
  
     p_intf->p_sys->b_playmode_update = true;
     p_intf->p_sys->b_intf_update = true;
-    pl_Release( p_intf );
 }
 
 - (IBAction)loop:(id)sender
 {
     vlc_value_t val;
     intf_thread_t * p_intf = VLCIntf;
-    playlist_t * p_playlist = pl_Hold( p_intf );
+    playlist_t * p_playlist = pl_Get( p_intf );
 
     var_Get( p_playlist, "loop", &val );
     if (!val.b_bool)
 
     p_intf->p_sys->b_playmode_update = true;
     p_intf->p_sys->b_intf_update = true;
-    pl_Release( p_intf );
 }
 
 - (IBAction)quitAfterPlayback:(id)sender
 {
     vlc_value_t val;
-    playlist_t * p_playlist = pl_Hold( VLCIntf );
-    var_Get( p_playlist, "play-and-exit", &val );
-    val.b_bool = !val.b_bool;
-    var_Set( p_playlist, "play-and-exit", val );
-    pl_Release( VLCIntf );
+    playlist_t * p_playlist = pl_Get( VLCIntf );
+    var_ToggleBool( p_playlist, "play-and-exit" );
 }
 
 - (IBAction)forward:(id)sender
 - (IBAction)volumeSliderUpdated:(id)sender
 {
     intf_thread_t * p_intf = VLCIntf;
-    playlist_t * p_playlist = pl_Hold( p_intf );
+    playlist_t * p_playlist = pl_Get( p_intf );
     audio_volume_t i_volume = (audio_volume_t)[sender intValue];
     int i_volume_step;
 
     i_volume_step = config_GetInt( p_intf->p_libvlc, "volume-step" );
     aout_VolumeSet( p_playlist, i_volume * i_volume_step );
-    pl_Release( p_intf );
     /* Manage volume status */
     [o_main manageVolumeSlider];
 }
         }
         else
         {
-            playlist_t * p_playlist = pl_Hold( VLCIntf );
+            playlist_t * p_playlist = pl_Get( VLCIntf );
 
             if( [o_title isEqualToString: _NS("Fullscreen")] ||
                 [sender isKindOfClass:[NSButton class]] )
             {
                 var_ToggleBool( p_playlist, "fullscreen" );
             }
-
-            pl_Release( VLCIntf );
         }
         vlc_object_release( p_input );
     }
     BOOL bEnabled = TRUE;
     vlc_value_t val;
     intf_thread_t * p_intf = VLCIntf;
-    playlist_t * p_playlist = pl_Hold( p_intf );
+    playlist_t * p_playlist = pl_Get( p_intf );
     input_thread_t * p_input = playlist_CurrentInput( p_playlist );
 
     if( [[o_mi title] isEqualToString: _NS("Faster")] ||
     }
 
     if( p_input ) vlc_object_release( p_input );
-    pl_Release( p_intf );
 
     return( bEnabled );
 }
index 91c46d3dba6cde3b0f5cc851eb90c4c6050ac290..6b892367a6e74e0eccacc3fb2b5980dcf3f2bb6c 100644 (file)
 
 - (BOOL)windowShouldClose:(id)sender
 {
-    playlist_t * p_playlist = pl_Hold( VLCIntf );
+    playlist_t * p_playlist = pl_Get( VLCIntf );
 
     /* Only want to stop playback if video is playing */
     if( videoRatio.height != 0. && videoRatio.width != 0. )
         playlist_Stop( p_playlist );
-    pl_Release( VLCIntf );
     return YES;
 }
 
index fb5e52ca3e725e01f200bcd21ad29be7f2c38950..26c366039e6f3372db3091ada6e1ee54db8cc1ad 100644 (file)
@@ -53,7 +53,7 @@ static void ChangeFiltersString( intf_thread_t *p_intf,
     vlc_object_t *p_object = VLC_OBJECT(p_aout);
     if( !p_object )
     {
-        p_object = (vlc_object_t *)pl_Hold( p_intf );
+        p_object = vlc_object_hold(pl_Get( p_intf ));
     }
 
     psz_string = var_GetNonEmptyString( p_object, "audio-filter" );
@@ -116,7 +116,7 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
     char *psz_parser, *psz_string;
     vlc_object_t *p_object = VLC_OBJECT(getAout());
     if( p_object == NULL )
-        p_object = (vlc_object_t *)pl_Hold( p_intf );
+        p_object = vlc_object_hold(pl_Get( p_intf ));
 
     if( (BOOL)config_GetInt( p_intf, "macosx-eq-keep" ) == YES )
         psz_string = config_GetPsz( p_intf, "audio-filter" );
@@ -172,7 +172,7 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
     vlc_object_t *p_object = VLC_OBJECT(getAout());
 
     if( p_object == NULL )
-        p_object = (vlc_object_t *)pl_Hold( p_intf );
+        p_object = vlc_object_hold(pl_Get( p_intf ));
 
     var_Create( p_object, "equalizer-preamp", VLC_VAR_FLOAT |
                 VLC_VAR_DOINHERIT );
@@ -227,7 +227,7 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
     vlc_object_t *p_object = VLC_OBJECT(getAout());
 
     if( p_object == NULL )
-        p_object = (vlc_object_t *)pl_Hold( p_intf );
+        p_object = vlc_object_hold(pl_Get( p_intf ));
 
     const char *psz_values;
     NSString *preset = [NSString stringWithFormat:@"%.1f", [o_slider_band1 floatValue] ];
@@ -262,7 +262,7 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
     int i;
     vlc_object_t *p_object= VLC_OBJECT(getAout());
     if( p_object == NULL )
-        p_object = (vlc_object_t *)pl_Hold( p_intf );
+        p_object = vlc_object_hold(pl_Get( p_intf ));
 
     var_SetString( p_object , "equalizer-preset" , preset_list[[sender indexOfSelectedItem]] );
 
@@ -306,7 +306,7 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
 
     vlc_object_t *p_object = VLC_OBJECT(getAout());
     if( p_object == NULL )
-        p_object = (vlc_object_t *)pl_Hold( p_intf );
+        p_object = vlc_object_hold(pl_Get( p_intf ));
 
     var_SetFloat( p_object, "equalizer-preamp", f_preamp );
 
@@ -345,7 +345,7 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
     aout_instance_t *p_aout = getAout();
     vlc_object_t *p_object= VLC_OBJECT(p_aout);
     if( p_object == NULL )
-        p_object = (vlc_object_t *)pl_Hold( p_intf );
+        p_object = vl_object_hold(pl_Get( p_intf ));
 
     var_SetBool( p_object, "equalizer-2pass", b_2p );
 
@@ -371,7 +371,7 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
     int i;
     vlc_object_t *p_object= VLC_OBJECT(getAout());
     if( p_object == NULL )
-        p_object = (vlc_object_t *)pl_Hold( VLCIntf );
+        p_object = vlc_object_hold(pl_Get( VLCIntf ));
 
     [o_window setExcludedFromWindowsMenu: TRUE];
 
index 34ebe19f21e1e529015d615e182237674f2d338a..3b9165e7e05ee256d86a41d685c6da0713d84d94 100644 (file)
@@ -409,7 +409,7 @@ static VLCExtended *_o_sharedInstance = nil;
     id o_window = [NSApp keyWindow];
     NSArray *o_windows = [NSApp orderedWindows];
     NSEnumerator *o_enumerator = [o_windows objectEnumerator];
-    playlist_t * p_playlist = pl_Hold( VLCIntf );
+    playlist_t * p_playlist = pl_Get( VLCIntf );
     vout_thread_t *p_vout = getVout();
     vout_thread_t *p_real_vout;
 
@@ -436,8 +436,6 @@ static VLCExtended *_o_sharedInstance = nil;
     /* store to prefs */
     config_PutFloat( p_playlist , "macosx-opaqueness" , val.f_float );
 
-    pl_Release( VLCIntf );
-
     o_config_changed = YES;
 }
 
@@ -746,7 +744,7 @@ static VLCExtended *_o_sharedInstance = nil;
 {
     /* save the preferences to make sure that our module-changes will up on
      * next launch again */
-    playlist_t * p_playlist = pl_Hold( VLCIntf );
+    playlist_t * p_playlist = pl_Get( VLCIntf );
     int returnedValue;
     NSArray * theModules;
     theModules = [[NSArray alloc] initWithObjects: @"main", 
@@ -775,7 +773,6 @@ static VLCExtended *_o_sharedInstance = nil;
             "extended control attribute '%s' (%i)",
             [[theModules objectAtIndex: x] UTF8String] , returnedValue);
             [theModules release];
-            pl_Release( VLCIntf );
  
             return;
         }
@@ -786,6 +783,5 @@ static VLCExtended *_o_sharedInstance = nil;
     msg_Dbg( VLCIntf, "VLCExtended: saved certain preferences successfully" );
  
     [theModules release];
-    pl_Release( VLCIntf );
 }
 @end
index 31df950602cb499c09e00779ff00e3d886540aa3..7bc551eb7ada8dad8a612dbcba59fb4915a0d3bc 100644 (file)
@@ -514,7 +514,7 @@ static VLCMain *_o_sharedMainInstance = nil;
 
     o_size_with_playlist = [o_window contentRectForFrameRect:[o_window frame]].size;
 
-    p_playlist = pl_Hold( p_intf );
+    p_playlist = pl_Get( p_intf );
 
     var_Create( p_playlist, "fullscreen", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);
     val.b_bool = false;
@@ -522,8 +522,6 @@ static VLCMain *_o_sharedMainInstance = nil;
     var_AddCallback( p_playlist, "fullscreen", FullscreenChanged, self);
     var_AddCallback( p_intf->p_libvlc, "intf-show", ShowController, self);
 
-    pl_Release( p_intf );
-
     /* load our Core Dialogs nib */
     nib_coredialogs_loaded = [NSBundle loadNibNamed:@"CoreDialogs" owner: NSApp];
     
@@ -898,10 +896,8 @@ static VLCMain *_o_sharedMainInstance = nil;
 
     /* Kill the playlist, so that it doesn't accept new request
      * such as the play request from vlc.c (we are a blocking interface). */
-    p_playlist = pl_Hold( p_intf );
+    p_playlist = pl_Get( p_intf );
     vlc_object_kill( p_playlist );
-    pl_Release( p_intf );
-
     libvlc_Quit( p_intf->p_libvlc );
 
     [self setIntf:nil];
@@ -1554,8 +1550,6 @@ static void manage_cleanup( void * args )
     var_DelCallback( p_playlist, "playlist-item-append", PlaylistChanged, self );
     var_DelCallback( p_playlist, "playlist-item-deleted", PlaylistChanged, self );
 
-    pl_Release( p_intf );
-
     if( p_input ) vlc_object_release( p_input );
 }
 
@@ -1568,7 +1562,7 @@ static void manage_cleanup( void * args )
 
     vlc_thread_set_priority( p_intf, VLC_THREAD_PRIORITY_LOW );
 
-    p_playlist = pl_Hold( p_intf );
+    p_playlist = pl_Get( p_intf );
 
     var_AddCallback( p_playlist, "item-current", PlaylistChanged, self );
     var_AddCallback( p_playlist, "intf-change", PlaylistChanged, self );
@@ -1629,10 +1623,9 @@ static void manage_cleanup( void * args )
 - (void)manageVolumeSlider
 {
     audio_volume_t i_volume;
-    playlist_t * p_playlist = pl_Hold( p_intf );
+    playlist_t * p_playlist = pl_Get( p_intf );
 
     aout_VolumeGet( p_playlist, &i_volume );
-    pl_Release( p_intf );
 
     if( i_volume != i_lastShownVolume )
     {
@@ -1659,13 +1652,12 @@ static void manage_cleanup( void * args )
          * the playlist or the selection is empty */
         if( [self isPlaylistCollapsed] == YES )
         {
-            playlist_t * p_playlist = pl_Hold( p_intf );
+            playlist_t * p_playlist = pl_Get( p_intf );
             PL_LOCK;
             playlist_item_t * p_item = playlist_CurrentPlayingItem( p_playlist );
             PL_UNLOCK;
             if( p_item )
                 [[self info] updatePanelWithItem: p_item->p_input];
-            pl_Release( p_intf );
         }
     }
     if( p_intf->p_sys->b_intf_update )
@@ -1676,7 +1668,7 @@ static void manage_cleanup( void * args )
         bool b_seekable = false;
         bool b_chapters = false;
 
-        playlist_t * p_playlist = pl_Hold( p_intf );
+        playlist_t * p_playlist = pl_Get( p_intf );
 
         PL_LOCK;
         b_plmul = playlist_CurrentSize( p_playlist ) > 1;
@@ -1706,7 +1698,6 @@ static void manage_cleanup( void * args )
             //b_chapters = p_input->stream.i_area_nb > 1;
             vlc_object_release( p_input );
         }
-        pl_Release( p_intf );
 
         if( b_buffering )
         {
@@ -1882,7 +1873,7 @@ end:
 
 - (void)setupMenus
 {
-    playlist_t * p_playlist = pl_Hold( p_intf );
+    playlist_t * p_playlist = pl_Get( p_intf );
     input_thread_t * p_input = playlist_CurrentInput( p_playlist );
     if( p_input != NULL )
     {
@@ -1950,7 +1941,6 @@ end:
         }
         vlc_object_release( p_input );
     }
-    pl_Release( p_intf );
 }
 
 - (void)refreshVoutDeviceMenu:(NSNotification *)o_notification
@@ -1990,7 +1980,7 @@ end:
 
 - (void)resetScrollField
 {
-    playlist_t * p_playlist = pl_Hold( p_intf );
+    playlist_t * p_playlist = pl_Get( p_intf );
     input_thread_t * p_input = playlist_CurrentInput( p_playlist );
 
     i_end_scroll = -1;
@@ -2007,10 +1997,8 @@ end:
         [self setScrollField: o_temp stopAfter:-1];
         [[[self controls] fspanel] setStreamTitle: o_temp];
         vlc_object_release( p_input );
-        pl_Release( p_intf );
         return;
     }
-    pl_Release( p_intf );
     [self setScrollField: _NS("VLC media player") stopAfter:-1];
 }
 
@@ -2074,7 +2062,7 @@ end:
         default:
             return;
     }
-    p_playlist = pl_Hold( p_intf );
+    p_playlist = pl_Get( p_intf );
     p_input = playlist_CurrentInput( p_playlist );
     if( p_input != NULL )
     {
@@ -2102,7 +2090,6 @@ end:
         [o_embedded_window setTime: o_time position: f_updated];
         vlc_object_release( p_input );
     }
-    pl_Release( p_intf );
 }
 
 - (IBAction)timeFieldWasClicked:(id)sender
index 515205ec7d231a8d9332d74621cb65d7685b7ab3..7abe6e6b5d92add8550631610f11e76d162f3936 100644 (file)
 }
 - (void)awakeFromNib
 {
-    playlist_t * p_playlist = pl_Hold( VLCIntf );
+    playlist_t * p_playlist = pl_Get( VLCIntf );
     [o_outline_view setTarget: self];
     [o_outline_view setDelegate: self];
     [o_outline_view setDataSource: self];
     [o_outline_view_other setDataSource: self];
     [o_outline_view_other setAllowsEmptySelection: NO];
 
-    pl_Release( VLCIntf );
     [self initStrings];
 }
 
 {
     int i_return = 0;
     playlist_item_t *p_item = NULL;
-    playlist_t * p_playlist = pl_Hold( VLCIntf );
+    playlist_t * p_playlist = pl_Get( VLCIntf );
     //assert( outlineView == o_outline_view );
 
     if( !item )
     if( p_item )
         i_return = p_item->i_children;
 
-    pl_Release( VLCIntf );
-
     return i_return > 0 ? i_return : 0;
 }
 
 {
     playlist_item_t *p_return = NULL, *p_item = NULL;
     NSValue *o_value;
-    playlist_t * p_playlist = pl_Hold( VLCIntf );
+    playlist_t * p_playlist = pl_Get( VLCIntf );
 
     PL_LOCK;
     if( item == nil )
         p_return = p_item->pp_children[index];
     PL_UNLOCK;
 
-    pl_Release( VLCIntf );
-
     o_value = [o_outline_dict objectForKey:[NSString stringWithFormat: @"%p", p_return]];
 
     if( o_value == nil )
 - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
 {
     int i_return = 0;
-    playlist_t *p_playlist = pl_Hold( VLCIntf );
+    playlist_t *p_playlist = pl_Get( VLCIntf );
 
     PL_LOCK;
     if( item == nil )
             i_return = p_item->i_children;
     }
     PL_UNLOCK;
-    pl_Release( VLCIntf );
 
     return (i_return >= 0);
 }
 
 - (void)awakeFromNib
 {
-    playlist_t * p_playlist = pl_Hold( VLCIntf );
+    playlist_t * p_playlist = pl_Get( VLCIntf );
 
     int i;
 
     char ** ppsz_name;
     char ** ppsz_services = vlc_sd_GetNames( VLCIntf, &ppsz_name );
     if( !ppsz_services )
-    {
-        pl_Release( VLCIntf );
         return;
-    }
     
     for( i = 0; ppsz_services[i]; i++ )
     {
     }
     free( ppsz_services );
     free( ppsz_name );
-
-    pl_Release( VLCIntf );
 }
 
 - (void)searchfieldChanged:(NSNotification *)o_notification
     [[[[VLCMain sharedInstance] wizard] playlistWizard] reloadOutlineView];
     [[[[VLCMain sharedInstance] bookmarks] dataTable] reloadData];
 
-    playlist_t *p_playlist = pl_Hold( VLCIntf );
+    playlist_t *p_playlist = pl_Get( VLCIntf );
 
     PL_LOCK;
     if( playlist_CurrentSize( p_playlist ) >= 2 )
         }
     }
     PL_UNLOCK;
-    pl_Release( VLCIntf );
 
     [self outlineViewSelectionDidChange: nil];
 }
 
 - (void)playModeUpdated
 {
-    playlist_t *p_playlist = pl_Hold( VLCIntf );
+    playlist_t *p_playlist = pl_Get( VLCIntf );
 
     bool loop = var_GetBool( p_playlist, "loop" );
     bool repeat = var_GetBool( p_playlist, "repeat" );
         [[[VLCMain sharedInstance] controls] repeatOff];
 
     [[[VLCMain sharedInstance] controls] shuffle];
-
-    pl_Release( VLCIntf );
 }
 
 - (void)outlineViewSelectionDidChange:(NSNotification *)notification
     unsigned int j;
 
     // FIXME: unsafe
-    playlist_t *p_playlist = pl_Hold( VLCIntf );
+    playlist_t *p_playlist = pl_Get( VLCIntf );
     playlist_item_t *p_item, *p_temp_item;
     NSMutableArray *o_array = [NSMutableArray array];
 
     if( p_item == NULL )
     {
         PL_UNLOCK;
-        pl_Release( VLCIntf );
         return;
     }
 
             [o_outline_view expandItem: o_item];
         }
     }
-
-    pl_Release( VLCIntf );
 }
 
 /* Check if p_item is a child of p_node recursively. We need to check the item
                     locked:(BOOL)b_locked
 
 {
-    playlist_t * p_playlist = pl_Hold( VLCIntf );
+    playlist_t * p_playlist = pl_Get( VLCIntf );
     playlist_item_t *p_temp_item = p_item;
 
     if( p_node == p_item )
-    {
-        pl_Release( VLCIntf );
         return YES;
-    }
 
     if( p_node->i_children < 1)
-    {
-        pl_Release( VLCIntf );
         return NO;
-    }
 
     if ( p_temp_item )
     {
                 else if ( i == p_playlist->all_items.i_size - 1 )
                 {
                     if(!b_locked) PL_UNLOCK;
-                    pl_Release( VLCIntf );
                     return NO;
                 }
             }
             if( p_temp_item == p_node )
             {
                 if(!b_locked) PL_UNLOCK;
-                pl_Release( VLCIntf );
                 return YES;
             }
         }
         if(!b_locked) PL_UNLOCK;
     }
-
-    pl_Release( VLCIntf );
     return NO;
 }
 
 
 - (IBAction)savePlaylist:(id)sender
 {
-    playlist_t * p_playlist = pl_Hold( VLCIntf );
+    playlist_t * p_playlist = pl_Get( VLCIntf );
 
     NSSavePanel *o_save_panel = [NSSavePanel savePanel];
     NSString * o_name = [NSString stringWithFormat: @"%@", _NS("Untitled")];
                 p_playlist->p_local_category, "export-html" );
         }
     }
-    pl_Release( VLCIntf );
 }
 
 /* When called retrieves the selected outlineview row and plays that node or item */
 - (IBAction)playItem:(id)sender
 {
     intf_thread_t * p_intf = VLCIntf;
-    playlist_t * p_playlist = pl_Hold( p_intf );
+    playlist_t * p_playlist = pl_Get( p_intf );
 
     playlist_item_t *p_item;
     playlist_item_t *p_node = NULL;
         playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, p_node, p_item );
     }
     PL_UNLOCK;
-    pl_Release( p_intf );
 }
 
 - (void)playSidebarItem:(id)item
 {
     intf_thread_t * p_intf = VLCIntf;
-    playlist_t * p_playlist = pl_Hold( p_intf );
+    playlist_t * p_playlist = pl_Get( p_intf );
     
     playlist_item_t *p_item;
     playlist_item_t *p_node = NULL;
         }
         playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Unlocked, p_node, p_item );
     }
-    pl_Release( p_intf );
 }
 
 - (IBAction)revealItemInFinder:(id)sender
     int i_count;
     NSMutableArray *o_to_preparse;
     intf_thread_t * p_intf = VLCIntf;
-    playlist_t * p_playlist = pl_Hold( p_intf );
+    playlist_t * p_playlist = pl_Get( p_intf );
  
     o_to_preparse = [NSMutableArray arrayWithArray:[[o_outline_view selectedRowEnumerator] allObjects]];
     i_count = [o_to_preparse count];
             }
         }
     }
-    pl_Release( p_intf );
     [self playlistUpdated];
 }
 
     int i_count;
     NSMutableArray *o_to_preparse;
     intf_thread_t * p_intf = VLCIntf;
-    playlist_t * p_playlist = pl_Hold( p_intf );
+    playlist_t * p_playlist = pl_Get( p_intf );
 
     o_to_preparse = [NSMutableArray arrayWithArray:[[o_outline_view selectedRowEnumerator] allObjects]];
     i_count = [o_to_preparse count];
             playlist_AskForArtEnqueue( p_playlist, p_item->p_input );
         }
     }
-    pl_Release( p_intf );
     [self playlistUpdated];
 }
 
 {
     NSMenuItem *o_mi = (NSMenuItem *)sender;
     NSString *o_string = [o_mi representedObject];
-    playlist_t * p_playlist = pl_Hold( VLCIntf );
+    playlist_t * p_playlist = pl_Get( VLCIntf );
     if( !playlist_IsServicesDiscoveryLoaded( p_playlist, [o_string UTF8String] ) )
         playlist_ServicesDiscoveryAdd( p_playlist, [o_string UTF8String] );
     else
     [o_mi setState: playlist_IsServicesDiscoveryLoaded( p_playlist,
                                           [o_string UTF8String] ) ? YES : NO];
 
-    pl_Release( VLCIntf );
     [self playlistUpdated];
     return;
 }
     o_to_delete = [NSMutableArray arrayWithArray:[[o_outline_view selectedRowEnumerator] allObjects]];
     i_count = [o_to_delete count];
 
-    p_playlist = pl_Hold( p_intf );
+    p_playlist = pl_Get( p_intf );
 
     for( int i = 0; i < i_count; i++ )
     {
     }
 
     [self playlistUpdated];
-    pl_Release( p_intf );
 }
 
 - (IBAction)sortNodeByName:(id)sender
 
 - (void)sortNode:(int)i_mode
 {
-    playlist_t * p_playlist = pl_Hold( VLCIntf );
+    playlist_t * p_playlist = pl_Get( VLCIntf );
     playlist_item_t * p_item;
 
     if( [o_outline_view selectedRow] > -1 )
                 p_item->p_parent, i_mode, ORDER_NORMAL );
     }
     PL_UNLOCK;
-    pl_Release( VLCIntf );
     [self playlistUpdated];
 }
 
 - (input_item_t *)createItem:(NSDictionary *)o_one_item
 {
     intf_thread_t * p_intf = VLCIntf;
-    playlist_t * p_playlist = pl_Hold( p_intf );
+    playlist_t * p_playlist = pl_Get( p_intf );
 
     input_item_t *p_input;
     int i;
 
     p_input = input_item_New( p_playlist, [o_uri fileSystemRepresentation], o_name ? [o_name UTF8String] : NULL );
     if( !p_input )
-    {
-        pl_Release( p_intf );
         return NULL;
-    }
 
     if( o_options )
     {
         [[NSDocumentController sharedDocumentController]
             noteNewRecentDocumentURL: o_true_file];
     }
-
-    pl_Release( p_intf );
     return p_input;
 }
 
 - (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue
 {
     int i_item;
-    playlist_t * p_playlist = pl_Hold( VLCIntf );
+    playlist_t * p_playlist = pl_Get( VLCIntf );
 
     PL_LOCK;
     for( i_item = 0; i_item < (int)[o_array count]; i_item++ )
     PL_UNLOCK;
 
     [self playlistUpdated];
-    pl_Release( VLCIntf );
 }
 
 - (void)appendNodeArray:(NSArray*)o_array inNode:(playlist_item_t *)p_node atPos:(int)i_position enqueue:(BOOL)b_enqueue
 {
     int i_item;
-    playlist_t * p_playlist = pl_Hold( VLCIntf );
+    playlist_t * p_playlist = pl_Get( VLCIntf );
 
     for( i_item = 0; i_item < (int)[o_array count]; i_item++ )
     {
         vlc_gc_decref( p_input );
     }
     [self playlistUpdated];
-    pl_Release( VLCIntf );
 }
 
 - (NSMutableArray *)subSearchItem:(playlist_item_t *)p_item
 {
-    playlist_t *p_playlist = pl_Hold( VLCIntf );
+    playlist_t *p_playlist = pl_Get( VLCIntf );
     playlist_item_t *p_selected_item;
     int i_current, i_selected_row;
 
         else if( p_selected_item == p_item->pp_children[i_current] &&
                     b_selected_item_met == YES )
         {
-            pl_Release( VLCIntf );
             return NULL;
         }
         else if( b_selected_item_met == YES &&
                       [o_current_author rangeOfString:[o_search_field
                         stringValue] options:NSCaseInsensitiveSearch].length ) )
         {
-            pl_Release( VLCIntf );
             /*Adds the parent items in the result array as well, so that we can
             expand the tree*/
             return [NSMutableArray arrayWithObject: [NSValue
                                             p_item->pp_children[i_current]];
             if( o_result != NULL )
             {
-                pl_Release( VLCIntf );
                 [o_result insertObject: [NSValue valueWithPointer:
                                 p_item->pp_children[i_current]] atIndex:0];
                 return o_result;
             }
         }
     }
-    pl_Release( VLCIntf );
     return NULL;
 }
 
 - (IBAction)searchItem:(id)sender
 {
-    playlist_t * p_playlist = pl_Hold( VLCIntf );
+    playlist_t * p_playlist = pl_Get( VLCIntf );
     id o_result;
 
     unsigned int i;
                [o_outline_view selectRowIndexes:[NSIndexSet indexSetWithIndex:i_row] byExtendingSelection:NO];
         [o_outline_view scrollRowToVisible: i_row];
     }
-    pl_Release( VLCIntf );
 }
 
 - (IBAction)recursiveExpandNode:(id)sender
     int i_mode, i_type = 0;
     intf_thread_t *p_intf = VLCIntf;
 
-    playlist_t *p_playlist = pl_Hold( p_intf );
+    playlist_t *p_playlist = pl_Get( p_intf );
 
     /* Check whether the selected table column header corresponds to a
        sortable table column*/
     if( !( o_tc == o_tc_name || o_tc == o_tc_author ) )
     {
-        pl_Release( p_intf );
         return;
     }
 
     playlist_RecursiveNodeSort( p_playlist, p_playlist->p_root_category, i_mode, i_type );
     PL_UNLOCK;
 
-    pl_Release( p_intf );
     [self playlistUpdated];
 
     o_tc_sortColumn = o_tc;
                                 forTableColumn:(NSTableColumn *)tableColumn
                                 item:(id)item
 {
-    playlist_t *p_playlist = pl_Hold( VLCIntf );
+    playlist_t *p_playlist = pl_Get( VLCIntf );
 
     id o_playing_item;
 
     {
         [cell setFont: [[NSFontManager sharedFontManager] convertFont:[cell font] toNotHaveTrait:NSBoldFontMask]];
     }
-    pl_Release( VLCIntf );
 }
 
 - (id)playingItem
 {
-    playlist_t *p_playlist = pl_Hold( VLCIntf );
+    playlist_t *p_playlist = pl_Get( VLCIntf );
     
     id o_playing_item;
 
                       [NSString stringWithFormat:@"%p",  playlist_CurrentPlayingItem( p_playlist )]];
     PL_UNLOCK;
 
-    pl_Release( VLCIntf );
-    
     return o_playing_item;
 }
 
 - (IBAction)addNode:(id)sender
 {
-    playlist_t * p_playlist = pl_Hold( VLCIntf );
+    playlist_t * p_playlist = pl_Get( VLCIntf );
     vlc_thread_set_priority( p_playlist, VLC_THREAD_PRIORITY_LOW );
 
     PL_LOCK;
                                       p_playlist->p_local_category, 0, NULL );
     PL_UNLOCK;
 
-    pl_Release( VLCIntf );
-
     [self playlistUpdated];
 }
 @end
 - (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item
 {
     id o_value = [super outlineView: outlineView child: index ofItem: item];
-    playlist_t *p_playlist = pl_Hold( VLCIntf );
+    playlist_t *p_playlist = pl_Get( VLCIntf );
 
     PL_LOCK;
     if( playlist_CurrentSize( p_playlist )  >= 2 )
     }
     PL_UNLOCK;
 
-    pl_Release( VLCIntf );
-
     [o_outline_dict setObject:o_value forKey:[NSString stringWithFormat:@"%p",
                                                     [o_value pointerValue]]];
     return o_value;
 - (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard
 {
     unsigned int i;
-    playlist_t *p_playlist = pl_Hold( VLCIntf );
+    playlist_t *p_playlist = pl_Get( VLCIntf );
 
     /* First remove the items that were moved during the last drag & drop
        operation */
             [o_item pointerValue] == p_playlist->p_local_category ||
             [o_item pointerValue] == p_playlist->p_ml_category )
         {
-            pl_Release( VLCIntf );
             return NO;
         }
         /* Fill the items and nodes to move in 2 different arrays */
         @"VLCPlaylistItemPboardType", nil] owner: self];
     [pboard setData:[NSData data] forType:@"VLCPlaylistItemPboardType"];
 
-    pl_Release( VLCIntf );
     return YES;
 }
 
 - (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(NSInteger)index
 {
-    playlist_t *p_playlist = pl_Hold( VLCIntf );
+    playlist_t *p_playlist = pl_Get( VLCIntf );
     NSPasteboard *o_pasteboard = [info draggingPasteboard];
 
     if( !p_playlist ) return NSDragOperationNone;
         if( index == NSOutlineViewDropOnItemIndex &&
                 ((playlist_item_t *)[item pointerValue])->i_children == -1 )
         {
-            pl_Release( VLCIntf );
             return NSDragOperationNone;
         }
     }
     /* Don't allow on drop on playlist root element's child */
     if( !item && index != NSOutlineViewDropOnItemIndex)
     {
-        pl_Release( VLCIntf );
         return NSDragOperationNone;
     }
 
     if( !( ([self isItem: [item pointerValue] inNode: p_playlist->p_local_category checkItemExistence: NO] || 
         ( var_CreateGetBool( p_playlist, "media-library" ) && [self isItem: [item pointerValue] inNode: p_playlist->p_ml_category checkItemExistence: NO] ) ) || item == nil ) )
     {
-        pl_Release( VLCIntf );
         return NSDragOperationNone;
     }
 
                     [[o_nodes_array objectAtIndex: i] pointerValue]
                     checkItemExistence: NO] )
             {
-                pl_Release( VLCIntf );
                 return NSDragOperationNone;
             }
         }
-        pl_Release( VLCIntf );
         return NSDragOperationMove;
     }
 
     /* Drop from the Finder */
     else if( [[o_pasteboard types] containsObject: NSFilenamesPboardType] )
     {
-        pl_Release( VLCIntf );
         return NSDragOperationGeneric;
     }
-    pl_Release( VLCIntf );
     return NSDragOperationNone;
 }
 
 - (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(NSInteger)index
 {
-    playlist_t * p_playlist =  pl_Hold( VLCIntf );
+    playlist_t * p_playlist =  pl_Get( VLCIntf );
     NSPasteboard *o_pasteboard = [info draggingPasteboard];
 
     /* Drag & Drop inside the playlist */
            (This should never be true) */
         if( p_new_parent->i_children < 0 )
         {
-            pl_Release( VLCIntf );
             return NO;
         }
 
         [o_outline_view selectRowIndexes:[NSIndexSet indexSetWithIndex:i_row] byExtendingSelection:NO];
         [o_outline_view scrollRowToVisible: i_row];
 
-        pl_Release( VLCIntf );
         return YES;
     }
 
             [self appendNodeArray:o_array inNode: p_node
                 atPos:index enqueue:YES];
         }
-        pl_Release( VLCIntf );
         return YES;
     }
-    pl_Release( VLCIntf );
     return NO;
 }
 @end
index 07e53b2c640a79dc93d2e118b6b032f93643cc6b..9e8af64b6ce516ad0ed49c56c8273118b7ffcd75 100644 (file)
@@ -252,9 +252,7 @@ static VLCInfo *_o_sharedInstance = nil;
     {
         if( !input_item_IsPreparsed( p_item ) )
         {
-            playlist_t * p_playlist = pl_Hold( VLCIntf );
-            playlist_PreparseEnqueue( p_playlist, p_item );
-            pl_Release( VLCIntf );
+            playlist_PreparseEnqueue( pl_Get( VLCIntf ), p_item );
         }
 
         /* fill uri info */
@@ -385,13 +383,12 @@ static VLCInfo *_o_sharedInstance = nil;
     input_item_SetDescription( p_item, utf8( o_description_txt ) );
     input_item_SetLanguage( p_item, utf8( o_language_txt ) );
 
-    playlist_t * p_playlist = pl_Hold( VLCIntf );
+    playlist_t * p_playlist = pl_Get( VLCIntf );
     input_item_WriteMeta( VLC_OBJECT(p_playlist), p_item );
 
     var_SetBool( p_playlist, "intf-change", true );
     [self updatePanelWithItem: p_item];
 
-    pl_Release( VLCIntf );
     [o_saveMetaData_btn setEnabled: NO];
     return;
 
@@ -403,9 +400,8 @@ error:
 
 - (IBAction)downloadCoverArt:(id)sender
 {
-    playlist_t * p_playlist = pl_Hold( VLCIntf );
+    playlist_t * p_playlist = pl_Get( VLCIntf );
     if( p_item) playlist_AskForArtEnqueue( p_playlist, p_item );
-    pl_Release( VLCIntf );
 }
 
 - (input_item_t *)item
index 16c03f23909e6fb7d62507085b85e71caa344b8a..be05431b9ee4378db6396136710c54439498cc55 100644 (file)
@@ -771,17 +771,15 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
 - (void)enterFullscreen
 {
     /* Save the settings for next playing item */
-    playlist_t * p_playlist = pl_Hold( p_real_vout );
+    playlist_t * p_playlist = pl_Get( p_real_vout );
     var_SetBool( p_playlist, "fullscreen", true );
-    pl_Release( p_real_vout );
 }
 
 - (void)leaveFullscreen
 {
     /* Save the settings for next playing item */
-    playlist_t * p_playlist = pl_Hold( p_real_vout );
+    playlist_t * p_playlist = pl_Get( p_real_vout );
     var_SetBool( p_playlist, "fullscreen", false );
-    pl_Release( p_real_vout );
 }
 
 @end
index 824c2ac112bd63f36eb6c8b0f35f722067156fb2..95d6795824bdb9d52de32904746515adeda2a618 100644 (file)
@@ -1262,7 +1262,7 @@ static VLCWizard *_o_sharedInstance = nil;
     {
         intf_thread_t * p_intf = VLCIntf;
 
-        playlist_t * p_playlist = pl_Hold( p_intf );
+        playlist_t * p_playlist = pl_Get( p_intf );
 
         int x = 0;
         int y = [[o_userSelections objectForKey:@"pathToStrm"] count];
@@ -1321,8 +1321,6 @@ static VLCWizard *_o_sharedInstance = nil;
             x += 1;
         }
 
-        pl_Release( p_intf );
-
         /* close the window, since we are done */
         [o_wizard_window close];
     }
index 13eaa6b7e209570f1fffa196f04d689a547df48b..f40f81d5a6ec044e612310983764f0650c481e48 100644 (file)
@@ -335,7 +335,6 @@ static void Close( vlc_object_t *p_this )
     {
         vlc_object_release( p_sys->p_input );
     }
-    pl_Release( p_intf );
 
     /* Close the ncurses interface */
     endwin();
@@ -352,7 +351,7 @@ static void Close( vlc_object_t *p_this )
 static void Run( intf_thread_t *p_intf )
 {
     intf_sys_t    *p_sys = p_intf->p_sys;
-    playlist_t    *p_playlist = pl_Hold( p_intf );
+    playlist_t    *p_playlist = pl_Get( p_intf );
     p_sys->p_playlist = p_playlist;
 
     int i_key;
@@ -535,7 +534,7 @@ static int HandleKey( intf_thread_t *p_intf, int i_key )
     intf_sys_t *p_sys = p_intf->p_sys;
     int i_ret = 1;
 
-    playlist_t *p_playlist = pl_Hold( p_intf );
+    playlist_t *p_playlist = pl_Get( p_intf );
 
     if( p_sys->i_box_type == BOX_PLAYLIST )
     {
@@ -1200,7 +1199,6 @@ static int HandleKey( intf_thread_t *p_intf, int i_key )
     }
 
 end:
-    pl_Release( p_intf );
     return i_ret;
 }
 
@@ -1463,7 +1461,7 @@ static void Redraw( intf_thread_t *p_intf, time_t *t_last_refresh )
 {
     intf_sys_t     *p_sys = p_intf->p_sys;
     input_thread_t *p_input = p_sys->p_input;
-    playlist_t     *p_playlist = pl_Hold( p_intf );
+    playlist_t     *p_playlist = pl_Get( p_intf );
     int y = 0;
     int h;
     int y_end;
@@ -2202,13 +2200,12 @@ static void Redraw( intf_thread_t *p_intf, time_t *t_last_refresh )
     refresh();
 
     *t_last_refresh = time( 0 );
-    pl_Release( p_intf );
 }
 
 static playlist_item_t *PlaylistGetRoot( intf_thread_t *p_intf )
 {
     intf_sys_t *p_sys = p_intf->p_sys;
-    playlist_t *p_playlist = pl_Hold( p_intf );
+    playlist_t *p_playlist = pl_Get( p_intf );
     playlist_item_t *p_item;
 
     switch( p_sys->i_current_view )
@@ -2219,14 +2216,13 @@ static playlist_item_t *PlaylistGetRoot( intf_thread_t *p_intf )
         default:
             p_item = p_playlist->p_root_onelevel;
     }
-    pl_Release( p_intf );
     return p_item;
 }
 
 static void PlaylistRebuild( intf_thread_t *p_intf )
 {
     intf_sys_t *p_sys = p_intf->p_sys;
-    playlist_t *p_playlist = pl_Hold( p_intf );
+    playlist_t *p_playlist = pl_Get( p_intf );
 
     PL_LOCK;
 
@@ -2239,8 +2235,6 @@ static void PlaylistRebuild( intf_thread_t *p_intf )
     p_sys->b_need_update = false;
 
     PL_UNLOCK;
-
-    pl_Release( p_intf );
 }
 
 static void PlaylistAddNode( intf_thread_t *p_intf, playlist_item_t *p_node,
@@ -2296,10 +2290,9 @@ static int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
     VLC_UNUSED(p_this); VLC_UNUSED(psz_variable);
     VLC_UNUSED(oval); VLC_UNUSED(nval);
     intf_thread_t *p_intf = (intf_thread_t *)param;
-    playlist_t *p_playlist = pl_Hold( p_intf );
+    playlist_t *p_playlist = pl_Get( p_intf );
     p_intf->p_sys->b_need_update = true;
     p_intf->p_sys->p_node = playlist_CurrentPlayingItem(p_playlist) ? playlist_CurrentPlayingItem(p_playlist)->p_parent : NULL;
-    pl_Release( p_intf );
     return VLC_SUCCESS;
 }
 
@@ -2368,13 +2361,12 @@ static void Eject( intf_thread_t *p_intf )
      * If it's neither of these, then return
      */
 
-    playlist_t * p_playlist = pl_Hold( p_intf );
+    playlist_t * p_playlist = pl_Get( p_intf );
     PL_LOCK;
 
     if( playlist_CurrentPlayingItem(p_playlist) == NULL )
     {
         PL_UNLOCK;
-        pl_Release( p_intf );
         return;
     }
 
@@ -2434,7 +2426,6 @@ static void Eject( intf_thread_t *p_intf )
 
     if( psz_device == NULL )
     {
-        pl_Release( p_intf );
         return;
     }
 
@@ -2457,8 +2448,6 @@ static void Eject( intf_thread_t *p_intf )
     }
 
     free( psz_device );
-    pl_Release( p_intf );
-    return;
 }
 
 static int comp_dir_entries( const void *pp_dir_entry1,
@@ -2581,7 +2570,7 @@ static void ReadDir( intf_thread_t *p_intf )
 static void PlayPause( intf_thread_t *p_intf )
 {
     input_thread_t *p_input = p_intf->p_sys->p_input;
-    playlist_t *p_playlist = pl_Hold( p_intf );
+    playlist_t *p_playlist = pl_Get( p_intf );
     vlc_value_t val;
 
     if( p_input )
@@ -2599,8 +2588,6 @@ static void PlayPause( intf_thread_t *p_intf )
     }
     else
         playlist_Play( p_playlist );
-
-    pl_Release( p_intf );
 }
 
 /****************************************************************************
index 2085e1217f3aa867b88d25ab65335968acfa7dab..9ee711796e6498bfde5d30eee694abb584d7929a 100644 (file)
@@ -152,10 +152,9 @@ void SoundWidget::userUpdateVolume( int i_sliderVolume )
 {
     /* Only if volume is set by user action on slider */
     setMuted( false );
-    playlist_t *p_playlist = pl_Hold( p_intf );
+    playlist_t *p_playlist = pl_Get( p_intf );
     int i_res = i_sliderVolume  * (AOUT_VOLUME_MAX / 2) / VOLUME_MAX;
     aout_VolumeSet( p_playlist, i_res );
-    pl_Release( p_intf );
 }
 
 /* libvlc changed value event slot */
@@ -163,10 +162,9 @@ void SoundWidget::libUpdateVolume()
 {
     /* Audio part */
     audio_volume_t i_volume;
-    playlist_t *p_playlist = pl_Hold( p_intf );
+    playlist_t *p_playlist = pl_Get( p_intf );
 
     aout_VolumeGet( p_playlist, &i_volume );
-    pl_Release( p_intf );
     i_volume = ( ( i_volume + 1 ) *  VOLUME_MAX )/ (AOUT_VOLUME_MAX/2);
     int i_gauge = volumeSlider->value();
     if ( !b_is_muted && /* do not show mute effect on volume (set to 0) */
@@ -180,9 +178,8 @@ void SoundWidget::libUpdateVolume()
 /* libvlc mute/unmute event slot */
 void SoundWidget::updateMuteStatus()
 {
-    playlist_t *p_playlist = pl_Hold( p_intf );
+    playlist_t *p_playlist = pl_Get( p_intf );
     b_is_muted = aout_IsMuted( VLC_OBJECT(p_playlist) );
-    pl_Release( p_intf );
 
     SoundSlider *soundSlider = qobject_cast<SoundSlider *>(volumeSlider);
     if( soundSlider )
@@ -200,9 +197,8 @@ void SoundWidget::showVolumeMenu( QPoint pos )
 void SoundWidget::setMuted( bool mute )
 {
     b_is_muted = mute;
-    playlist_t *p_playlist = pl_Hold( p_intf );
+    playlist_t *p_playlist = pl_Get( p_intf );
     aout_SetMute( VLC_OBJECT(p_playlist), NULL, mute );
-    pl_Release( p_intf );
 }
 
 bool SoundWidget::eventFilter( QObject *obj, QEvent *e )
index a74329d127ff506c5138e75505991fda8a532fe0..cc5c9a13f04050b87c54a843b860b509e71cf8ae 100644 (file)
@@ -267,9 +267,8 @@ void MetaPanel::saveMeta()
     input_item_SetPublisher( p_input, qtu( publisher_text->text() ) );
     input_item_SetDescription( p_input, qtu( description_text->text() ) );
 
-    playlist_t *p_playlist = pl_Hold( p_intf );
+    playlist_t *p_playlist = pl_Get( p_intf );
     input_item_WriteMeta( VLC_OBJECT(p_playlist), p_input );
-    pl_Release( p_intf );
 
     /* Reset the status of the mode. No need to emit any signal because parent
        is the only caller */
index 756b77324dc0f8bb41e3f4c2d530a8bdf5d09b06..670b3c767333c7cb6fa26ec6350a5bacc0d058ed 100644 (file)
@@ -594,9 +594,7 @@ void InputManager::requestArtUpdate()
 {
     if( hasInput() )
     {
-        playlist_t *p_playlist = pl_Hold( p_intf );
-        playlist_AskForArtEnqueue( p_playlist, input_GetItem( p_input ) );
-        pl_Release( p_intf );
+        playlist_AskForArtEnqueue( pl_Get(p_intf), input_GetItem( p_input ) );
     }
     else
     {
@@ -1041,13 +1039,11 @@ void MainInputManager::customEvent( QEvent *event )
             p_input = NULL;
         }
         /* we are working as a dialogs provider */
-        playlist_t *p_playlist = pl_Hold( p_intf );
-        p_input = playlist_CurrentInput( p_playlist );
+        p_input = playlist_CurrentInput( pl_Get(p_intf) );
         if( p_input )
         {
             emit inputChanged( p_input );
         }
-        pl_Release( p_intf );
     }
 }
 
index 02bc401eefaecd094f492de53b5eeace06dacb0d..821f5945a8e100d31762279217fe91b78427bdb8 100644 (file)
@@ -298,13 +298,12 @@ static int Open( vlc_object_t *p_this, bool isDialogProvider )
     p_intf->p_sys->b_isDialogProvider = isDialogProvider;
     p_sys->p_popup_menu = NULL;
     p_sys->p_mi = NULL;
-    p_sys->p_playlist = pl_Hold( p_intf );
+    p_sys->p_playlist = pl_Get( p_intf );
 
     /* */
     vlc_sem_init (&ready, 0);
     if( vlc_clone( &p_sys->thread, Thread, p_intf, VLC_THREAD_PRIORITY_LOW ) )
     {
-        pl_Release (p_sys->p_playlist);
         delete p_sys;
         return VLC_ENOMEM;
     }
@@ -346,7 +345,6 @@ static void Close( vlc_object_t *p_this )
     QVLCApp::triggerQuit();
 
     vlc_join (p_sys->thread, NULL);
-    pl_Release (p_this);
     delete p_sys;
 #ifdef Q_WS_X11
     free (x11_display);
index f3c8ed3e6956a10e99457078dee2b7de4729d7f2..17d68def974338478988f2aeb71ed5f59a86b1ca 100644 (file)
@@ -105,12 +105,7 @@ static int Open( vlc_object_t *p_this )
 #endif
 
     p_intf->p_sys->p_input = NULL;
-    p_intf->p_sys->p_playlist = pl_Hold( p_intf );
-    if( !p_intf->p_sys->p_playlist )
-    {
-        free( p_intf->p_sys );
-        return VLC_EGENERIC;
-    }
+    p_intf->p_sys->p_playlist = pl_Get( p_intf );
 
     // Initialize "singleton" objects
     p_intf->p_sys->p_logger = NULL;
@@ -148,7 +143,6 @@ static int Open( vlc_object_t *p_this )
         vlc_mutex_destroy( &p_intf->p_sys->init_lock );
         vlc_cond_destroy( &p_intf->p_sys->vout_wait );
         vlc_mutex_destroy( &p_intf->p_sys->vout_lock );
-        pl_Release( p_intf->p_sys->p_playlist );
         free( p_intf->p_sys );
         return VLC_EGENERIC;
     }
@@ -182,9 +176,6 @@ static void Close( vlc_object_t *p_this )
     vlc_mutex_destroy( &p_intf->p_sys->init_lock );
     vlc_cond_destroy( &p_intf->p_sys->init_wait );
 
-    if( p_intf->p_sys->p_playlist )
-        pl_Release( p_this );
-
     // Unsubscribe from messages bank
 #if 0
     msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
@@ -413,7 +404,7 @@ static int DemuxOpen( vlc_object_t *p_this )
 
     if( p_intf != NULL )
     {
-        playlist_t *p_playlist = pl_Hold( p_this );
+        playlist_t *p_playlist = pl_Get( p_this );
 
         PL_LOCK;
         // Make sure the item is deleted afterwards
@@ -421,8 +412,6 @@ static int DemuxOpen( vlc_object_t *p_this )
         playlist_CurrentPlayingItem( p_playlist )->i_flags |= PLAYLIST_REMOVE_FLAG;
         PL_UNLOCK;
 
-        pl_Release( p_this );
-
         var_SetString( p_intf, "skin-to-load", p_demux->psz_path );
         vlc_object_release( p_intf );
     }
index fbcc95a70b4b7f2cad712958ff05ab6d294f3d73..d26c09094e37e7e3760461e9adfe41417d25b36d 100644 (file)
@@ -189,11 +189,10 @@ static int Open( vlc_object_t *p_this )
     vlc_mutex_init( &p_sys->lock );
     vlc_cond_init( &p_sys->wait );
 
-    p_playlist = pl_Hold( p_intf );
+    p_playlist = pl_Get( p_intf );
     PL_LOCK;
     var_AddCallback( p_playlist, "item-current", ItemChange, p_intf );
     PL_UNLOCK;
-    pl_Release( p_intf );
 
     p_intf->pf_run = Run;
 
@@ -210,22 +209,15 @@ static void Close( vlc_object_t *p_this )
     intf_thread_t               *p_intf = ( intf_thread_t* ) p_this;
     intf_sys_t                  *p_sys  = p_intf->p_sys;
 
-    p_playlist = pl_Hold( p_intf );
-    if( p_playlist )
-    {
-
-        var_DelCallback( p_playlist, "item-current", ItemChange, p_intf );
+    p_playlist = pl_Get( p_intf );
+    var_DelCallback( p_playlist, "item-current", ItemChange, p_intf );
 
-        p_input = playlist_CurrentInput( p_playlist );
-        if ( p_input )
-        {
-            if( p_sys->b_state_cb )
-                var_DelCallback( p_input, "intf-event", PlayingChange, p_intf );
-
-            vlc_object_release( p_input );
-        }
-
-        pl_Release( p_intf );
+    p_input = playlist_CurrentInput( p_playlist );
+    if ( p_input )
+    {
+        if( p_sys->b_state_cb )
+            var_DelCallback( p_input, "intf-event", PlayingChange, p_intf );
+        vlc_object_release( p_input );
     }
 
     int i;
@@ -522,16 +514,10 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
     p_sys->b_meta_read      = false;
     p_sys->b_submit         = false;
 
-    p_playlist = pl_Hold( p_intf );
-    p_input = playlist_CurrentInput( p_playlist );
+    p_input = playlist_CurrentInput( pl_Get( p_intf ) );
 
     if( !p_input || p_input->b_dead )
-    {
-        pl_Release( p_intf );
         return VLC_SUCCESS;
-    }
-
-    pl_Release( p_intf );
 
     p_item = input_GetItem( p_input );
     if( !p_item )
@@ -951,15 +937,9 @@ static int ReadMetaData( intf_thread_t *p_this )
 
     intf_sys_t          *p_sys = p_this->p_sys;
 
-    p_playlist = pl_Hold( p_this );
-    p_input = playlist_CurrentInput( p_playlist );
+    p_input = playlist_CurrentInput( pl_Get( p_this ) );
     if( !p_input )
-    {
-        pl_Release( p_this );
         return( VLC_SUCCESS );
-    }
-
-    pl_Release( p_this );
 
     p_item = input_GetItem( p_input );
     if( !p_item )
index ef76c8b39ed181b3d272d619ef50bee250ffd0cd..31d1f41959d3b02afab309d306953c6690d213df 100644 (file)
@@ -104,7 +104,7 @@ static int Activate( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
-    p_sys->p_playlist = pl_Hold( p_intf );
+    p_sys->p_playlist = pl_Get( p_intf );
     var_AddCallback( p_sys->p_playlist, "item-current", InputChange, p_intf );
     return VLC_SUCCESS;
 }
@@ -118,7 +118,6 @@ static void Deactivate( vlc_object_t *p_this )
     intf_sys_t *p_sys = p_intf->p_sys;
 
     var_DelCallback( p_sys->p_playlist, "item-current", InputChange, p_intf );
-    pl_Release( p_intf );
 
     if( p_sys->p_input ) /* Do delete "state" after "item-changed"! */
     {
index 885edfb2282c3ad5f155a0d5f2e467250811d6b7..018779dfd7f799c3863ddc4d18eec88fa2bcdfc4 100644 (file)
@@ -242,7 +242,7 @@ static int Demux( demux_t *p_demux )
 
     input_thread_t *p_input_thread = demux_GetParentInput( p_demux );
     input_item_t *p_current_input = input_GetItem( p_input_thread );
-    playlist_t *p_playlist = pl_Hold( p_demux );
+    playlist_t *p_playlist = pl_Get( p_demux );
 
     luaL_register( L, "vlc", p_reg_parse );
 
@@ -252,7 +252,6 @@ static int Demux( demux_t *p_demux )
     {
         msg_Warn( p_demux, "Error while runing script %s, "
                   "function parse() not found", psz_filename );
-        pl_Release( p_demux );
         return VLC_EGENERIC;
     }
 
@@ -261,7 +260,6 @@ static int Demux( demux_t *p_demux )
         msg_Warn( p_demux, "Error while runing script %s, "
                   "function parse(): %s", psz_filename,
                   lua_tostring( L, lua_gettop( L ) ) );
-        pl_Release( p_demux );
         return VLC_EGENERIC;
     }
 
@@ -272,7 +270,6 @@ static int Demux( demux_t *p_demux )
         msg_Err( p_demux, "Script went completely foobar" );
 
     vlc_object_release( p_input_thread );
-    vlclua_release_playlist_internal( p_playlist );
 
     return -1; /* Needed for correct operation of go back */
 }
index 76496f7932bd996bf820c455b63b8c1210cd6d3b..3010cafbb8576b31ea373c9cfeb8b5b327bbd226 100644 (file)
@@ -64,7 +64,6 @@ input_thread_t * vlclua_get_input_internal( lua_State *L )
     }
     playlist_t *p_playlist = vlclua_get_playlist_internal( L );
     input_thread_t *p_input = playlist_CurrentInput( p_playlist );
-    vlclua_release_playlist_internal( p_playlist );
     return p_input;
 }
 
index 066129080a4981b15d4a18180c7ceb5a4bb1ebea..36c5409430d8bf9ac1c12f3e674f3b6dd9a470dc 100644 (file)
@@ -195,9 +195,9 @@ static int vlclua_get_playlist( lua_State *L )
     if( p_playlist )
     {
         vlclua_push_vlc_object( L, p_playlist, vlclua_gc_release );
+        vlc_object_hold( p_playlist );
     }
     else lua_pushnil( L );
-    //vlclua_release_playlist_internal( p_playlist );
     return 1;
 }
 
index 4c72931744db61997df864e1c9ea0e5953223669..b376ba51548ed36099c6850582473db3dd109346 100644 (file)
 playlist_t *vlclua_get_playlist_internal( lua_State *L )
 {
     vlc_object_t *p_this = vlclua_get_this( L );
-    return pl_Hold( p_this );
-}
-
-void vlclua_release_playlist_internal( playlist_t *p_playlist )
-{
-    vlc_object_release( p_playlist );
+    return pl_Get( p_this );
 }
 
 static int vlclua_playlist_prev( lua_State * L )
 {
     playlist_t *p_playlist = vlclua_get_playlist_internal( L );
     playlist_Prev( p_playlist );
-    vlclua_release_playlist_internal( p_playlist );
     return 0;
 }
 
@@ -71,7 +65,6 @@ static int vlclua_playlist_next( lua_State * L )
 {
     playlist_t *p_playlist = vlclua_get_playlist_internal( L );
     playlist_Next( p_playlist );
-    vlclua_release_playlist_internal( p_playlist );
     return 0;
 }
 
@@ -80,7 +73,6 @@ static int vlclua_playlist_skip( lua_State * L )
     int i_skip = luaL_checkint( L, 1 );
     playlist_t *p_playlist = vlclua_get_playlist_internal( L );
     playlist_Skip( p_playlist, i_skip );
-    vlclua_release_playlist_internal( p_playlist );
     return 0;
 }
 
@@ -88,7 +80,6 @@ static int vlclua_playlist_play( lua_State * L )
 {
     playlist_t *p_playlist = vlclua_get_playlist_internal( L );
     playlist_Play( p_playlist );
-    vlclua_release_playlist_internal( p_playlist );
     return 0;
 }
 
@@ -96,7 +87,6 @@ static int vlclua_playlist_pause( lua_State * L )
 {
     playlist_t *p_playlist = vlclua_get_playlist_internal( L );
     playlist_Pause( p_playlist );
-    vlclua_release_playlist_internal( p_playlist );
     return 0;
 }
 
@@ -104,7 +94,6 @@ static int vlclua_playlist_stop( lua_State * L )
 {
     playlist_t *p_playlist = vlclua_get_playlist_internal( L );
     playlist_Stop( p_playlist );
-    vlclua_release_playlist_internal( p_playlist );
     return 0;
 }
 
@@ -113,7 +102,6 @@ static int vlclua_playlist_clear( lua_State * L )
     playlist_t *p_playlist = vlclua_get_playlist_internal( L );
     playlist_Stop( p_playlist ); /* Isn't this already implied by Clear? */
     playlist_Clear( p_playlist, pl_Unlocked );
-    vlclua_release_playlist_internal( p_playlist );
     return 0;
 }
 
@@ -121,7 +109,6 @@ static int vlclua_playlist_repeat( lua_State * L )
 {
     playlist_t *p_playlist = vlclua_get_playlist_internal( L );
     int i_ret = vlclua_var_toggle_or_set( L, p_playlist, "repeat" );
-    vlclua_release_playlist_internal( p_playlist );
     return i_ret;
 }
 
@@ -129,7 +116,6 @@ static int vlclua_playlist_loop( lua_State * L )
 {
     playlist_t *p_playlist = vlclua_get_playlist_internal( L );
     int i_ret = vlclua_var_toggle_or_set( L, p_playlist, "loop" );
-    vlclua_release_playlist_internal( p_playlist );
     return i_ret;
 }
 
@@ -137,7 +123,6 @@ static int vlclua_playlist_random( lua_State * L )
 {
     playlist_t *p_playlist = vlclua_get_playlist_internal( L );
     int i_ret = vlclua_var_toggle_or_set( L, p_playlist, "random" );
-    vlclua_release_playlist_internal( p_playlist );
     return i_ret;
 }
 
@@ -150,7 +135,6 @@ static int vlclua_playlist_goto( lua_State * L )
                                   true, NULL,
                                   playlist_ItemGetById( p_playlist, i_id ) );
     PL_UNLOCK;
-    vlclua_release_playlist_internal( p_playlist );
     return vlclua_push_ret( L, i_ret );
 }
 
@@ -161,7 +145,6 @@ static int vlclua_playlist_add( lua_State *L )
     playlist_t *p_playlist = vlclua_get_playlist_internal( L );
     i_count = vlclua_playlist_add_internal( p_this, L, p_playlist,
                                             NULL, true );
-    vlclua_release_playlist_internal( p_playlist );
     lua_pushinteger( L, i_count );
     return 1;
 }
@@ -173,7 +156,6 @@ static int vlclua_playlist_enqueue( lua_State *L )
     playlist_t *p_playlist = vlclua_get_playlist_internal( L );
     i_count = vlclua_playlist_add_internal( p_this, L, p_playlist,
                                             NULL, false );
-    vlclua_release_playlist_internal( p_playlist );
     lua_pushinteger( L, i_count );
     return 1;
 }
@@ -243,7 +225,6 @@ static int vlclua_playlist_get( lua_State *L )
         if( !p_item )
         {
             PL_UNLOCK;
-            vlclua_release_playlist_internal( p_playlist );
             return 0; /* Should we return an error instead? */
         }
     }
@@ -266,7 +247,6 @@ static int vlclua_playlist_get( lua_State *L )
             if( !p_item )
             {
                 PL_UNLOCK;
-                vlclua_release_playlist_internal( p_playlist );
                 return 0; /* Should we return an error instead? */
             }
         }
@@ -277,7 +257,6 @@ static int vlclua_playlist_get( lua_State *L )
     }
     push_playlist_item( L, p_item );
     PL_UNLOCK;
-    vlclua_release_playlist_internal( p_playlist );
     return 1;
 }
 
@@ -289,7 +268,6 @@ static int vlclua_playlist_search( lua_State *L )
     playlist_LiveSearchUpdate( p_playlist, p_playlist->p_root, psz_string );
     PL_UNLOCK;
     push_playlist_item( L, p_playlist->p_root );
-    vlclua_release_playlist_internal( p_playlist );
     return 1;
 }
 
@@ -309,7 +287,6 @@ static int vlclua_playlist_current( lua_State *L )
 
 #warning Indexing input items by ID is unsafe,
     lua_pushinteger( L, id );
-    vlclua_release_playlist_internal( p_playlist );
     return 1;
 }
 
@@ -351,7 +328,6 @@ static int vlclua_playlist_sort( lua_State *L )
     int i_ret = playlist_RecursiveNodeSort( p_playlist, p_playlist->p_playing,
                                             i_mode, i_type );
     PL_UNLOCK;
-    vlclua_release_playlist_internal( p_playlist );
     return vlclua_push_ret( L, i_ret );
 }
 
@@ -375,7 +351,6 @@ static int vlclua_playlist_status( lua_State *L )
             break;
     }
     PL_UNLOCK;
-    vlclua_release_playlist_internal( p_playlist );
     return 1;
 }
 
index c0fdc73d80ad2e034571b06f07a985d8309f81a6..5015c4c4ad2fcf7fd6f7b62c2f222df5584789fa 100644 (file)
@@ -25,7 +25,6 @@
 #define VLC_LUA_PLAYLIST_H
 
 playlist_t *vlclua_get_playlist_internal( lua_State * );
-void vlclua_release_playlist_internal( playlist_t * );
 
 #endif
 
index b8f0ef56382b4cdd5e8e493ea3eaedc2d20b181c..51cacf9a71d2e3384d938d8ba4195455ec1cd610 100644 (file)
@@ -63,7 +63,6 @@ static int vlclua_sd_get_services_names( lua_State *L )
     playlist_t *p_playlist = vlclua_get_playlist_internal( L );
     char **ppsz_longnames;
     char **ppsz_names = vlc_sd_GetNames( p_playlist, &ppsz_longnames );
-    vlclua_release_playlist_internal( p_playlist );
     if( !ppsz_names )
         return 0;
 
@@ -88,7 +87,6 @@ static int vlclua_sd_add( lua_State *L )
     const char *psz_sd = luaL_checkstring( L, 1 );
     playlist_t *p_playlist = vlclua_get_playlist_internal( L );
     int i_ret = playlist_ServicesDiscoveryAdd( p_playlist, psz_sd );
-    vlclua_release_playlist_internal( p_playlist );
     return vlclua_push_ret( L, i_ret );
 }
 
@@ -97,7 +95,6 @@ static int vlclua_sd_remove( lua_State *L )
     const char *psz_sd = luaL_checkstring( L, 1 );
     playlist_t *p_playlist = vlclua_get_playlist_internal( L );
     int i_ret = playlist_ServicesDiscoveryRemove( p_playlist, psz_sd );
-    vlclua_release_playlist_internal( p_playlist );
     return vlclua_push_ret( L, i_ret );
 }
 
@@ -106,7 +103,6 @@ static int vlclua_sd_is_loaded( lua_State *L )
     const char *psz_sd = luaL_checkstring( L, 1 );
     playlist_t *p_playlist = vlclua_get_playlist_internal( L );
     lua_pushboolean( L, playlist_IsServicesDiscoveryLoaded( p_playlist, psz_sd ));
-    vlclua_release_playlist_internal( p_playlist );
     return 1;
 }
 
index 906fbea8222e62630b5043f3960e14c84de38eee..afa15dceb472a39b90163673bc81741784592179 100644 (file)
@@ -55,7 +55,6 @@ static int vlclua_volume_set( lua_State *L )
     int i_volume = __MAX(__MIN(luaL_checkint( L, 1 ), AOUT_VOLUME_MAX),
                          AOUT_VOLUME_MIN);
     int i_ret = aout_VolumeSet( p_this, i_volume );
-    vlclua_release_playlist_internal( p_this );
     return vlclua_push_ret( L, i_ret );
 }
 
@@ -67,7 +66,6 @@ static int vlclua_volume_get( lua_State *L )
         lua_pushnumber( L, i_volume );
     else
         lua_pushnil( L );
-    vlclua_release_playlist_internal( p_this );
     return 1;
 }
 
@@ -77,7 +75,6 @@ static int vlclua_volume_up( lua_State *L )
     playlist_t *p_this = vlclua_get_playlist_internal( L );
     aout_VolumeUp( p_this, luaL_optint( L, 1, 1 ), &i_volume );
     lua_pushnumber( L, i_volume );
-    vlclua_release_playlist_internal( p_this );
     return 1;
 }
 
@@ -87,7 +84,6 @@ static int vlclua_volume_down( lua_State *L )
     playlist_t *p_this = vlclua_get_playlist_internal( L );
     aout_VolumeDown( p_this, luaL_optint( L, 1, 1 ), &i_volume );
     lua_pushnumber( L, i_volume );
-    vlclua_release_playlist_internal( p_this );
     return 1;
 }
 
index 65d632861381041e4bc504e55b75bf4daa3a0281..a0275cb077d27f9d4c38238a9fe3556dc7851c2e 100644 (file)
@@ -234,15 +234,11 @@ int FindArt( vlc_object_t *p_this )
 {
     art_finder_t *p_finder = (art_finder_t *)p_this;
     input_item_t *p_item = p_finder->p_item;
-    playlist_t *p_playlist = pl_Hold( p_this );
-    if( !p_playlist )
-        return VLC_EGENERIC;
 
     lua_State *L = init( p_this, p_item );
     int i_ret = vlclua_scripts_batch_execute( p_this, "meta/art", &fetch_art, L, p_item );
     lua_close( L );
 
-    pl_Release( p_this );
     return i_ret;
 }
 
index 319c7ebe275b928ea3232e0eb02a9939fddeed0c..fa2376039900f2d7ed73d2930ec0f44fbe121d9e 100644 (file)
@@ -121,9 +121,7 @@ static int Open( vlc_object_t *p_this )
     free( data_path );
     p_sys->default_icon = (CFDataRef) readFile( buf );
 
-    playlist_t *p_playlist = pl_Hold( p_intf );
-    var_AddCallback( p_playlist, "item-current", ItemChange, p_intf );
-    pl_Release( p_intf );
+    var_AddCallback( pl_Get( p_intf ), "item-current", ItemChange, p_intf );
 
     RegisterToGrowl( p_this );
     return VLC_SUCCESS;
@@ -142,9 +140,7 @@ static void Close( vlc_object_t *p_this )
     [p_sys->p_pool release];
     free( p_sys );
 
-    playlist_t *p_playlist = pl_Hold( p_this );
-    var_DelCallback( p_playlist, "item-current", ItemChange, p_this );
-    pl_Release( p_this );
+    var_DelCallback( pl_Get( p_this ), "item-current", ItemChange, p_this );
 }
 
 /*****************************************************************************
index 2717a096d669c79cbc1896fa1eaa6f137e76d253..7a2a38ef27332d2f80e12e397f7d002975fbf93f 100644 (file)
@@ -89,9 +89,7 @@ static int Open( vlc_object_t *p_this )
 {
     intf_thread_t *p_intf = (intf_thread_t *)p_this;
 
-    playlist_t *p_playlist = pl_Hold( p_intf );
-    var_AddCallback( p_playlist, "item-current", ItemChange, p_intf );
-    pl_Release( p_intf );
+    var_AddCallback( pl_Get( p_intf ), "item-current", ItemChange, p_intf );
 
     RegisterToGrowl( p_this );
     return VLC_SUCCESS;
@@ -102,9 +100,7 @@ static int Open( vlc_object_t *p_this )
  *****************************************************************************/
 static void Close( vlc_object_t *p_this )
 {
-    playlist_t *p_playlist = pl_Hold( p_this );
-    var_DelCallback( p_playlist, "item-current", ItemChange, p_this );
-    pl_Release( p_this );
+    var_DelCallback( pl_Get( p_this ), "item-current", ItemChange, p_this );
 }
 
 /*****************************************************************************
index afc0c71b158c1905e58f8e54985c1e339c44b473..ba3d3c2420b7e42dd98d12d0131e83f9761dfea7 100644 (file)
@@ -101,10 +101,9 @@ static int Open( vlc_object_t *p_this )
     }
     msg_Dbg( p_intf, "using format: %s", p_intf->p_sys->psz_format );
 
-    p_playlist = pl_Hold( p_intf );
+    p_playlist = pl_Get( p_intf );
     var_AddCallback( p_playlist, "item-change", ItemChange, p_intf );
     var_AddCallback( p_playlist, "item-current", ItemChange, p_intf );
-    pl_Release( p_intf );
 
     return VLC_SUCCESS;
 }
@@ -115,7 +114,7 @@ static int Open( vlc_object_t *p_this )
 static void Close( vlc_object_t *p_this )
 {
     intf_thread_t *p_intf = (intf_thread_t *)p_this;
-    playlist_t *p_playlist = pl_Hold( p_this );
+    playlist_t *p_playlist = pl_Get( p_this );
 
     /* clear the MSN stuff ... else it looks like we're still playing
      * something although VLC (or the MSN plugin) is closed */
@@ -123,7 +122,6 @@ static void Close( vlc_object_t *p_this )
 
     var_DelCallback( p_playlist, "item-change", ItemChange, p_intf );
     var_DelCallback( p_playlist, "item-current", ItemChange, p_intf );
-    pl_Release( p_this );
 
     /* Destroy structure */
     free( p_intf->p_sys->psz_format );
index cd79bc00fdd2b33dabae2eaa753415b13e9c7c60..850d6df6f2e0d6cdfdb7eb5ae7edadefeba8c51c 100644 (file)
@@ -116,9 +116,7 @@ static int Open( vlc_object_t *p_this )
     }
 
     /* */
-    playlist_t *p_playlist = pl_Hold( p_intf );
-    var_AddCallback( p_playlist, "item-current", ItemChange, p_intf );
-    pl_Release( p_intf );
+    var_AddCallback( pl_Get( p_intf ), "item-current", ItemChange, p_intf );
 
     return VLC_SUCCESS;
 }
@@ -131,9 +129,7 @@ static void Close( vlc_object_t *p_this )
     intf_thread_t   *p_intf = ( intf_thread_t* ) p_this;
     intf_sys_t      *p_sys  = p_intf->p_sys;
 
-    playlist_t *p_playlist = pl_Hold( p_this );
-    var_DelCallback( p_playlist, "item-current", ItemChange, p_this );
-    pl_Release( p_this );
+    var_DelCallback( pl_Get( p_this ), "item-current", ItemChange, p_this );
 
     if( p_sys->notification )
     {
@@ -272,9 +268,7 @@ static void Next( NotifyNotification *notification, gchar *psz, gpointer p )
 
     VLC_UNUSED(psz);
     notify_notification_close( notification, NULL );
-    playlist_t *p_playlist = pl_Hold( p_object );
-    playlist_Next( p_playlist );
-    pl_Release( p_object );
+    playlist_Next( pl_Get( p_object ) );
 }
 
 /* libnotify callback, called when the "Previous" button is pressed */
@@ -284,9 +278,7 @@ static void Prev( NotifyNotification *notification, gchar *psz, gpointer p )
 
     VLC_UNUSED(psz);
     notify_notification_close( notification, NULL );
-    playlist_t *p_playlist = pl_Hold( p_object );
-    playlist_Prev( p_playlist );
-    pl_Release( p_object );
+    playlist_Prev( pl_Get( p_object ) );
 }
 
 static int Notify( vlc_object_t *p_this, const char *psz_temp, GdkPixbuf *pix,
index c6233ac7d54ed43192f0b90b7169fc463bc09dc4..4f538c858116f34c24b455d1b13d5364d389473b 100644 (file)
@@ -122,10 +122,9 @@ static int Open( vlc_object_t *p_this )
 
     p_intf->p_sys->i_id = -1;
 
-    p_playlist = pl_Hold( p_intf );
+    p_playlist = pl_Get( p_intf );
     var_AddCallback( p_playlist, "item-change", ItemChange, p_intf );
     var_AddCallback( p_playlist, "item-current", ItemChange, p_intf );
-    pl_Release( p_intf );
 
     return VLC_SUCCESS;
 }
@@ -136,7 +135,7 @@ static int Open( vlc_object_t *p_this )
 static void Close( vlc_object_t *p_this )
 {
     intf_thread_t *p_intf = (intf_thread_t *)p_this;
-    playlist_t *p_playlist = pl_Hold( p_this );
+    playlist_t *p_playlist = pl_Get( p_this );
     input_thread_t *p_input = NULL;
 
     var_DelCallback( p_playlist, "item-change", ItemChange, p_intf );
@@ -146,7 +145,6 @@ static void Close( vlc_object_t *p_this )
         var_DelCallback( p_input, "state", StateChange, p_intf );
         vlc_object_release( p_input );
     }
-    pl_Release( p_this );
 
     /* Clears the Presence message ... else it looks like we're still playing
      * something although VLC (or the Telepathy plugin) is closed */
index 24e0ff413e393a59ddd84b16ee75b39ad9b4e3c0..587bc23aac24df930a6ea56f869f9a3bd0913b11 100644 (file)
@@ -160,10 +160,9 @@ static int Open( vlc_object_t *p_this )
     vlc_mutex_init( &p_sys->lock );
     vlc_cond_init( &p_sys->cond );
     // Add the callbacks
-    playlist_t *p_playlist = pl_Hold( p_intf );
+    playlist_t *p_playlist = pl_Get( p_intf );
     var_AddCallback( p_playlist, "item-current", PlaylistNext, p_this );
     var_AddCallback( p_playlist, "item-change", PlaylistNext, p_this );
-    pl_Release( p_intf );
 
     p_sys->b_need_update = true;
     p_intf->pf_run = Run;
@@ -177,10 +176,9 @@ static void Close( vlc_object_t *p_this )
 {
     intf_thread_t *p_intf = (intf_thread_t *)p_this;
 
-    playlist_t *p_playlist = pl_Hold( p_intf );
+    playlist_t *p_playlist = pl_Get( p_intf );
     var_DelCallback( p_playlist, "item-current", PlaylistNext, p_this );
     var_DelCallback( p_playlist, "item-change", PlaylistNext, p_this );
-    pl_Release( p_intf );
 
     /* Uninitialize library */
     xosd_destroy( p_intf->p_sys->p_osd );
@@ -216,14 +214,13 @@ static void Run( intf_thread_t *p_intf )
 
         // Compute the signal
         cancel = vlc_savecancel();
-        p_playlist = pl_Hold( p_intf );
+        p_playlist = pl_Get( p_intf );
         PL_LOCK;
 
         // If the playlist is empty don't do anything
         if( playlist_IsEmpty( p_playlist ) )
         {
             PL_UNLOCK;
-            pl_Release( p_intf );
             continue;
         }
 
@@ -244,7 +241,6 @@ static void Run( intf_thread_t *p_intf )
             {
                 psz_display = NULL;
                 PL_UNLOCK;
-                pl_Release( p_intf );
                 continue;
             }
             input_item_t *p_input = p_item->p_input;
@@ -261,7 +257,6 @@ static void Run( intf_thread_t *p_intf )
                 psz_display = strdup( p_input->psz_name );
         }
         PL_UNLOCK;
-        pl_Release( p_intf );
 
         /* Display */
         xosd_display( p_intf->p_sys->p_osd, 0, /* first line */
index 07d5f6018f1150edf58367bfeb3679f7429503fb..931699708e34175630bdc343af2231b56ceaa485 100644 (file)
@@ -2491,14 +2491,12 @@ static int StateCallback( vlc_object_t *p_this, char const *psz_cmd,
 *****************************************************************************/
 static void AddStateVariableCallback(filter_t *p_filter)
 {
-    playlist_t *p_playlist = pl_Hold( p_filter );
-    input_thread_t *p_input = playlist_CurrentInput( p_playlist );
+    input_thread_t *p_input = playlist_CurrentInput( pl_Get( p_filter ) );
     if(p_input)
     {
         var_AddCallback( p_input, "state", StateCallback, p_filter );
         vlc_object_release( p_input );
     }
-    pl_Release( p_filter );
 }
 
 /*****************************************************************************
@@ -2510,14 +2508,12 @@ static void AddStateVariableCallback(filter_t *p_filter)
 *****************************************************************************/
 static void DelStateVariableCallback( filter_t *p_filter )
 {
-    playlist_t *p_playlist = pl_Hold( p_filter );
-    input_thread_t *p_input = playlist_CurrentInput( p_playlist );
+    input_thread_t *p_input = playlist_CurrentInput( pl_Get ( p_filter ) );
     if(p_input)
     {
         var_DelCallback( p_input, "state", StateCallback, p_filter );
         vlc_object_release( p_input );
     }
-    pl_Release( p_filter );
 }
 
 
index 8a329ecdf1c915774810383a41c64876ee2f4baa..3fe1c4720d1a304a852080fe135603362367456e 100644 (file)
@@ -1214,14 +1214,11 @@ static int DesktopCallback(vlc_object_t *object, char const *psz_cmd,
 
     /* FIXME we should have a way to export variable to be saved */
     if (ch_desktop) {
-        playlist_t *p_playlist = pl_Hold(vd);
-        if (p_playlist) {
-            /* Modify playlist as well because the vout might have to be
-             * restarted */
-            var_Create(p_playlist, "direct3d-desktop", VLC_VAR_BOOL);
-            var_SetBool(p_playlist, "direct3d-desktop", newval.b_bool);
-            pl_Release(vd);
-        }
+        playlist_t *p_playlist = pl_Get(vd);
+        /* Modify playlist as well because the vout might have to be
+         * restarted */
+        var_Create(p_playlist, "direct3d-desktop", VLC_VAR_BOOL);
+        var_SetBool(p_playlist, "direct3d-desktop", newval.b_bool);
     }
     return VLC_SUCCESS;
 }
index 5f7cfaabb3800f176716a8abc1cb77fe015273f9..5e05a2fc5c09e964b0c98cecbe7ac1304772ee1f 100644 (file)
@@ -1421,14 +1421,11 @@ static int WallpaperCallback(vlc_object_t *object, char const *cmd,
 
     /* FIXME we should have a way to export variable to be saved */
     if (ch_wallpaper) {
-        playlist_t *p_playlist = pl_Hold(vd);
-        if (p_playlist) {
-            /* Modify playlist as well because the vout might have to be
-             * restarted */
-            var_Create(p_playlist, "video-wallpaper", VLC_VAR_BOOL);
-            var_SetBool(p_playlist, "video-wallpaper", newval.b_bool);
-            pl_Release(vd);
-        }
+        playlist_t *p_playlist = pl_Get(vd);
+        /* Modify playlist as well because the vout might have to be
+         * restarted */
+        var_Create(p_playlist, "video-wallpaper", VLC_VAR_BOOL);
+        var_SetBool(p_playlist, "video-wallpaper", newval.b_bool);
     }
     return VLC_SUCCESS;
 }
index 8384b51181bd5c2660bf0dd4b630133b89340c50..cb847e4e6249c7e853e6862223c92e7221b6927d 100644 (file)
@@ -406,12 +406,7 @@ static void Close( vlc_object_t *p_this )
 
 static char *TitleGet( vlc_object_t *p_this )
 {
-    playlist_t *pl = pl_Hold( p_this );
-    if( !pl )
-        return NULL;
-
-    input_thread_t *p_input = playlist_CurrentInput( pl );
-    pl_Release( p_this );
+    input_thread_t *p_input = playlist_CurrentInput( pl_Get( p_this ) );
     if( !p_input )
         return NULL;
 
index 3940842647bcb271375de8ad7507915517e450cc..331f37b41662621c27d12c365f1bce7557c48a26 100644 (file)
 
 static aout_instance_t *findAout (vlc_object_t *obj)
 {
-    playlist_t *pl = pl_Hold (obj->p_libvlc);
-    if (pl == NULL)
-        return NULL;
-
-    input_thread_t *p_input = playlist_CurrentInput (pl);
-    pl_Release (obj->p_libvlc);
+    input_thread_t *p_input = playlist_CurrentInput (pl_Get (obj));
     if (p_input == NULL)
        return NULL;
 
index 52b27c1ac3ddbe3740bcb51e5853456ee4cbb71c..f6eaed6fa6123dc3c60520c611a5ba79fb96f238 100644 (file)
@@ -205,13 +205,7 @@ void input_ExtractAttachmentAndCacheArt( input_thread_t *p_input )
         return;
     }
 
-    playlist_t *p_playlist = pl_Hold( p_input );
-    if( !p_playlist )
-    {
-        free( psz_arturl );
-        return;
-    }
-
+    playlist_t *p_playlist = pl_Get( p_input );
 
     if( input_item_IsArtFetched( p_item ) )
     {
@@ -259,7 +253,6 @@ void input_ExtractAttachmentAndCacheArt( input_thread_t *p_input )
     vlc_input_attachment_Delete( p_attachment );
 
 exit:
-    pl_Release( p_input );
     free( psz_arturl );
 }
 
index 91e16cb65cdb733320e343e9b4dd4914c8d3949d..cbc575e498584cd04a0b44cb9c955063d941cc2f 100644 (file)
@@ -816,11 +816,9 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     if( psz_modules )
     {
         char *p = psz_modules, *m;
-        playlist_t *p_playlist = pl_Hold( p_libvlc );
         while( ( m = strsep( &p, " :," ) ) != NULL )
             playlist_ServicesDiscoveryAdd( p_playlist, m );
         free( psz_modules );
-        pl_Release (p_libvlc);
     }
 
 #ifdef ENABLE_VLM
@@ -975,10 +973,8 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     psz_val = var_InheritString( p_libvlc, "open" );
     if ( psz_val != NULL )
     {
-        playlist_t *p_playlist = pl_Hold( p_libvlc );
         playlist_AddExt( p_playlist, psz_val, NULL, PLAYLIST_INSERT, 0,
                          -1, 0, NULL, 0, true, pl_Unlocked );
-        pl_Release( p_libvlc );
         free( psz_val );
     }
 
@@ -1220,11 +1216,9 @@ static int GetFilenames( libvlc_int_t *p_vlc, int i_argc, const char *ppsz_argv[
         if( !mrl )
             continue;
 
-        playlist_t *p_playlist = pl_Hold( p_vlc );
-        playlist_AddExt( p_playlist, mrl, NULL, PLAYLIST_INSERT,
+        playlist_AddExt( pl_Get( p_vlc ), mrl, NULL, PLAYLIST_INSERT,
                 0, -1, i_options, ( i_options ? &ppsz_argv[i_opt + 1] : NULL ),
                 VLC_INPUT_OPTION_TRUSTED, true, pl_Unlocked );
-        pl_Release( p_vlc );
         free( mrl );
     }
 
index e0c53b3d5102a6d24ecebd758eae4fe3e71e331b..d293878c176696a24b7cb72fd44fe00f08b9c941 100644 (file)
@@ -349,8 +349,7 @@ playlist_Status
 playlist_TreeMove
 playlist_TreeMoveMany
 playlist_Unlock
-pl_Hold
-pl_Release
+pl_Get
 resolve_xml_special_chars
 sdp_AddAttribute
 sdp_AddMedia
index b8684166d03fbd54c630fd2ce8aaddee2109a1a8..38ddf485646668a97440732351a857bd6b2a64f0 100644 (file)
@@ -41,8 +41,8 @@ static int PlaylistVAControl( playlist_t * p_playlist, int i_query, va_list args
 
 static vlc_mutex_t global_lock = VLC_STATIC_MUTEX;
 
-#undef pl_Hold
-playlist_t *pl_Hold (vlc_object_t *obj)
+#undef pl_Get
+playlist_t *pl_Get (vlc_object_t *obj)
 {
     playlist_t *pl;
     libvlc_int_t *p_libvlc = obj->p_libvlc;
@@ -56,28 +56,10 @@ playlist_t *pl_Hold (vlc_object_t *obj)
          playlist_Activate (pl);
          libvlc_priv (p_libvlc)->playlist_active = true;
     }
-
-    /* The playlist should hold itself with vlc_object_hold() if ever. */
-    assert (VLC_OBJECT (pl) != obj);
-    if (pl)
-        vlc_object_hold (pl);
     vlc_mutex_unlock (&global_lock);
     return pl;
 }
 
-#undef pl_Release
-void pl_Release( vlc_object_t *p_this )
-{
-    playlist_t *pl = libvlc_priv (p_this->p_libvlc)->p_playlist;
-    assert( pl != NULL );
-
-    /* The rule is that pl_Release() should act on
-       the same object than pl_Hold() */
-    assert( VLC_OBJECT(pl) != p_this);
-
-    vlc_object_release( pl );
-}
-
 void pl_Deactivate (libvlc_int_t *p_libvlc)
 {
     bool deactivate;
index c09056403b88046e725fa26c8f0aaebc8d6b156f..4b8d7925e5915ce8f17d0da4debbb265322466a7 100644 (file)
@@ -637,10 +637,8 @@ char *str_format_meta( vlc_object_t *p_object, const char *string )
     if( !dst ) return NULL;
     int d = 0;
 
-    playlist_t *p_playlist = pl_Hold( p_object );
-    input_thread_t *p_input = playlist_CurrentInput( p_playlist );
+    input_thread_t *p_input = playlist_CurrentInput( pl_Get(p_object) );
     input_item_t *p_item = NULL;
-    pl_Release( p_object );
     if( p_input )
     {
         p_item = input_GetItem(p_input);
index e0d75b833c40ad7a69c6b225a5721e85b9451d40..2ac3b3f0753b5babb96abda62887caca5448635a 100644 (file)
@@ -47,11 +47,8 @@ static inline void vout_SendEventClose(vout_thread_t *vout)
     /* Ask to stop
      * FIXME works only for input handled by the playlist
      */
-    playlist_t *playlist = pl_Hold(vout);
-    if (playlist) {
-        playlist_Stop(playlist);
-        pl_Release(vout);
-    }
+    playlist_t *playlist = pl_Get(vout);
+    playlist_Stop(playlist);
 }
 static inline void vout_SendEventKey(vout_thread_t *vout, int key)
 {
index 1478ca870e9a2af4f0cd66dff4cc7ec4a306e666..5662e222cb0e670d94094710b89f9b408728b4e2 100644 (file)
@@ -322,8 +322,7 @@ LRESULT CALLBACK WMCOPYWNDPROC( HWND hwnd, UINT uMsg, WPARAM wParam,
         if( !p_this ) return 0;
 
         /* Add files to the playlist */
-        p_playlist = pl_Hold( p_this );
-        if( !p_playlist ) return 0;
+        p_playlist = pl_Get( p_this );
 
         if( pwm_data->lpData )
         {
@@ -363,8 +362,6 @@ LRESULT CALLBACK WMCOPYWNDPROC( HWND hwnd, UINT uMsg, WPARAM wParam,
 
             free( ppsz_argv );
         }
-
-        vlc_object_release( p_playlist );
     }
 
     return DefWindowProc( hwnd, uMsg, wParam, lParam );