Use pl_Locked and pl_Unlocked
authorRémi Duraffort <ivoire@videolan.org>
Mon, 21 Jul 2008 07:37:36 +0000 (09:37 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Mon, 21 Jul 2008 07:56:10 +0000 (09:56 +0200)
15 files changed:
modules/access/cdda.c
modules/access/cdda/info.c
modules/access/directory.c
modules/control/dbus.c
modules/gui/macosx/wizard.m
modules/gui/pda/pda_callbacks.c
modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/dialogs_provider.cpp
modules/gui/skins2/vars/playtree.cpp
modules/services_discovery/upnp_intel.cpp
src/control/playlist.c
src/libvlc.c
src/misc/win32_specific.c
src/playlist/item.c

index 449d6b6..29c5ea2 100644 (file)
@@ -201,7 +201,7 @@ static int Open( vlc_object_t *p_this )
                 if( p_playlist->status.p_item->p_input == p_current )
                     p_item = p_playlist->status.p_item;
                 else
-                    p_item = playlist_ItemGetByInput( p_playlist, p_current, false );
+                    p_item = playlist_ItemGetByInput( p_playlist, p_current, pl_Unlocked );
 
                 if( p_item )
                     i_ret = GetTracks( p_access, p_playlist, p_item );
@@ -420,7 +420,7 @@ static int GetTracks( access_t *p_access,
         return VLC_EGENERIC;
     }
 
-    p_item_in_category = playlist_ItemToNode( p_playlist, p_parent, false );
+    p_item_in_category = playlist_ItemToNode( p_playlist, p_parent, pl_Unlocked );
     playlist_ItemSetName( p_parent, "Audio CD" );
     var_SetInteger( p_playlist, "item-change", p_parent->p_input->i_id );
 
@@ -495,7 +495,7 @@ static int GetTracks( access_t *p_access,
         int i_ret = playlist_BothAddInput( p_playlist, p_input_item,
                                p_item_in_category,
                                PLAYLIST_APPEND, PLAYLIST_END, NULL, NULL,
-                               false );
+                               pl_Unlocked );
         vlc_gc_decref( p_input_item );
         free( psz_uri ); free( psz_opt ); free( psz_name );
         free( psz_first ); free( psz_last );
index 19d0dd0..e13c6d8 100644 (file)
@@ -882,7 +882,7 @@ CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
         input_thread_t *p_input = (input_thread_t*)vlc_object_find( p_access, VLC_OBJECT_INPUT, FIND_PARENT );
         if( p_input )
         {
-            p_item = playlist_ItemGetByInput( p_playlist, input_GetItem(p_input), false );
+            p_item = playlist_ItemGetByInput( p_playlist, input_GetItem(p_input), pl_Unlocked );
 
             if( p_item == p_playlist->status.p_item && !b_single_track )
                 b_play = true;
@@ -924,7 +924,7 @@ CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
         input_title_t *t;
 
         if( !p_cdda->b_nav_mode )
-            playlist_ItemToNode( p_playlist, p_item, false );
+            playlist_ItemToNode( p_playlist, p_item, pl_Unlocked );
 
         for( i = 0 ; i < p_cdda->i_tracks ; i++ )
         {
index 7beb5e4..124bba8 100644 (file)
@@ -220,7 +220,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len)
     }
 
     p_current_input = input_GetItem( p_input );
-    p_current = playlist_ItemGetByInput( p_playlist, p_current_input, false );
+    p_current = playlist_ItemGetByInput( p_playlist, p_current_input, pl_Unlocked );
 
     if( !p_current )
     {
@@ -254,7 +254,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len)
 
     p_current->p_input->i_type = ITEM_TYPE_DIRECTORY;
     p_item_in_category = playlist_ItemToNode( p_playlist, p_current,
-                                              false );
+                                              pl_Unlocked );
 
     ReadDir( p_access, p_playlist, psz_name, i_mode,
              p_item_in_category,
@@ -540,7 +540,7 @@ static int ReadDir( access_t *p_access, playlist_t *p_playlist,
                                            PLAYLIST_APPEND|PLAYLIST_PREPARSE|
                                            PLAYLIST_NO_REBUILD,
                                            PLAYLIST_END, NULL, NULL,
-                                           false );
+                                           pl_Unlocked );
                     vlc_gc_decref( p_input );
                     if( i_ret != VLC_SUCCESS )
                         return VLC_EGENERIC;
index bd998d5..abb58fa 100644 (file)
@@ -877,7 +877,7 @@ static int TrackListChangeEmit( vlc_object_t *p_this, const char *psz_var,
         playlist_t *p_playlist = (playlist_t*)p_this;
         playlist_add_t *p_add = newval.p_address;
         playlist_item_t *p_item;
-        p_item = playlist_ItemGetById( p_playlist, p_add->i_node, false );
+        p_item = playlist_ItemGetById( p_playlist, p_add->i_node, pl_Unlocked );
         assert( p_item );
         while( p_item->p_parent )
             p_item = p_item->p_parent;
index ee7a94e..2534304 100644 (file)
@@ -1299,7 +1299,7 @@ static VLCWizard *_o_sharedInstance = nil;
             if( x == 0 )
             {
                 /* play the first item and add the others afterwards */
-                playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input, true );
+                playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input, pl_Locked );
                 playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, true, NULL,
                           p_item );
             }
index 334c749..b0cc1d1 100644 (file)
@@ -138,7 +138,7 @@ static void PlaylistAddItem(GtkWidget *widget, gchar *name, char **ppsz_options,
                               PLAYLIST_APPEND, PLAYLIST_END,
                               (mtime_t) 0,
                               (const char **) ppsz_options, i_pos,
-                              true, false );
+                              true, pl_Unlocked );
             }
 
             /* Cleanup memory */
@@ -165,7 +165,7 @@ void PlaylistRebuildListStore( intf_thread_t *p_intf,
     vlc_object_lock( p_playlist );
     for( i_dummy = 0; i_dummy < playlist_CurrentSize(p_playlist) ; i_dummy++ )
     {
-        playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_dummy, true );
+        playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_dummy, pl_Locked );
         if( p_item )
         {
             ppsz_text[0] = p_item->p_input->psz_name;
index 60ffb4f..a4a16db 100644 (file)
@@ -168,9 +168,9 @@ bool PLModel::dropMimeData( const QMimeData *data, Qt::DropAction action,
             PL_LOCK;
             playlist_item_t *p_target =
                         playlist_ItemGetById( p_playlist, targetItem->i_id,
-                                              true );
+                                              pl_Locked );
             playlist_item_t *p_src = playlist_ItemGetById( p_playlist, srcId,
-                                                           true );
+                                                           pl_Locked );
 
             if( !p_target || !p_src )
             {
@@ -183,7 +183,7 @@ bool PLModel::dropMimeData( const QMimeData *data, Qt::DropAction action,
                 assert( parentItem );
                 playlist_item_t *p_parent =
                          playlist_ItemGetById( p_playlist, parentItem->i_id,
-                                               true );
+                                               pl_Locked );
                 if( !p_parent )
                 {
                     PL_UNLOCK;
@@ -260,7 +260,7 @@ void PLModel::activateItem( const QModelIndex &index )
     assert( item );
     PL_LOCK;
     playlist_item_t *p_item = playlist_ItemGetById( p_playlist, item->i_id,
-                                                    true);
+                                                    pl_Locked );
     activateItem( p_item );
     PL_UNLOCK;
 }
@@ -548,7 +548,7 @@ void PLModel::ProcessItemAppend( playlist_add_t *p_add )
     PL_LOCK;
     if( !nodeItem ) goto end;
 
-    p_item = playlist_ItemGetById( p_playlist, p_add->i_item, true );
+    p_item = playlist_ItemGetById( p_playlist, p_add->i_item, pl_Locked );
     if( !p_item || p_item->i_flags & PLAYLIST_DBL_FLAG ) goto end;
     if( i_depth == DEPTH_SEL && p_item->p_parent &&
                         p_item->p_parent->i_id != rootItem->i_id )
@@ -617,7 +617,7 @@ void PLModel::rebuild( playlist_item_t *p_root )
 void PLModel::UpdateNodeChildren( PLItem *root )
 {
     playlist_item_t *p_node = playlist_ItemGetById( p_playlist, root->i_id,
-                                                    true );
+                                                    pl_Locked );
     UpdateNodeChildren( p_node, root );
 }
 
@@ -639,7 +639,7 @@ void PLModel::UpdateNodeChildren( playlist_item_t *p_node, PLItem *root )
 void PLModel::UpdateTreeItem( PLItem *item, bool signal, bool force )
 {
     playlist_item_t *p_item = playlist_ItemGetById( p_playlist, item->i_id,
-                                                    true );
+                                                    pl_Locked );
     UpdateTreeItem( p_item, item, signal, force );
 }
 
@@ -699,7 +699,7 @@ void PLModel::doDeleteItem( PLItem *item, QModelIndexList *fullList )
 
     PL_LOCK;
     playlist_item_t *p_item = playlist_ItemGetById( p_playlist, item->i_id,
-                                                    true );
+                                                    pl_Locked );
     if( !p_item )
     {
         PL_UNLOCK; return;
@@ -756,7 +756,7 @@ next:
     {
         playlist_item_t *p_root = playlist_ItemGetById( p_playlist,
                                                         rootItem->i_id,
-                                                        true );
+                                                        pl_Locked );
         if( p_root )
         {
             playlist_RecursiveNodeSort( p_playlist, p_root,
@@ -777,7 +777,7 @@ void PLModel::search( QString search_text )
     {
         playlist_item_t *p_root = playlist_ItemGetById( p_playlist,
                                                         rootItem->i_id,
-                                                        true );
+                                                        pl_Locked );
         assert( p_root );
         char *psz_name = search_text.toUtf8().data();
         playlist_LiveSearchUpdate( p_playlist , p_root, psz_name );
@@ -792,7 +792,7 @@ void PLModel::popup( QModelIndex & index, QPoint &point, QModelIndexList list )
     assert( index.isValid() );
     PL_LOCK;
     playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
-                                                    itemId( index ), true );
+                                                    itemId( index ), pl_Locked );
     if( p_item )
     {
         i_popup_item = p_item->i_id;
@@ -870,7 +870,8 @@ void PLModel::popupPlay()
     PL_LOCK;
     {
         playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
-                                                        i_popup_item,true );
+                                                        i_popup_item,
+                                                        pl_Locked );
         activateItem( p_item );
     }
     PL_UNLOCK;
@@ -880,7 +881,7 @@ void PLModel::popupInfo()
 {
     playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
                                                     i_popup_item,
-                                                    false );
+                                                    pl_Unlocked );
     if( p_item )
     {
         MediaInfoDialog *mid = new MediaInfoDialog( p_intf, p_item->p_input );
index f268d64..6bea1c9 100644 (file)
@@ -317,7 +317,7 @@ void StandardPLPanel::setRoot( int i_root_id )
 {
     QPL_LOCK;
     playlist_item_t *p_item = playlist_ItemGetById( THEPL, i_root_id,
-                                                    true );
+                                                    pl_Locked );
     assert( p_item );
     p_item = playlist_GetPreferredNode( THEPL, p_item );
     assert( p_item );
index dd4f69d..c278b55 100644 (file)
@@ -447,7 +447,7 @@ void DialogsProvider::streamingDialog( QWidget *parent, QString mrl,
 
         playlist_AddExt( THEPL, qtu( mrl ), "Streaming",
                          PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END,
-                        -1, &psz_option, 1, true, false );
+                        -1, &psz_option, 1, true, pl_Unlocked );
     }
 }
 
index 037d078..0033e1c 100644 (file)
@@ -175,7 +175,7 @@ void Playtree::onAppend( playlist_add_t *p_add )
         if( item == end() )
         {
             playlist_item_t *p_item = playlist_ItemGetById(
-                                        m_pPlaylist, p_add->i_item, false );
+                                        m_pPlaylist, p_add->i_item, pl_Unlocked );
             if( !p_item ) return;
             UString *pName = new UString( getIntf(),
                                           p_item->p_input->psz_name );
index d269e04..a65036a 100644 (file)
@@ -881,7 +881,7 @@ void MediaServer::_buildPlaylist( Container* parent )
         /* FIXME: playlist_AddInput() can fail */
         playlist_BothAddInput( p_playlist, p_input, parentNode,
                                PLAYLIST_APPEND, PLAYLIST_END, &i_cat, NULL,
-                               false );
+                               pl_Unlocked );
         vlc_gc_decref( p_input );
         /* TODO: do this better by storing ids */
         playlist_item_t *p_node = playlist_ItemGetById( p_playlist, i_cat, false );
index 8e98dbc..4cd0ecc 100644 (file)
@@ -172,7 +172,7 @@ int libvlc_playlist_add_extended( libvlc_instance_t *p_instance,
     }
     return playlist_AddExt( PL, psz_uri, psz_name,
                             PLAYLIST_INSERT, PLAYLIST_END, -1, ppsz_options,
-                            i_options, 1, false );
+                            i_options, 1, pl_Unlocked );
 }
 
 
index b10d13e..22d1183 100644 (file)
@@ -962,7 +962,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     {
         playlist_t *p_playlist = pl_Yield( p_libvlc );
         playlist_AddExt( p_playlist, val.psz_string, NULL, PLAYLIST_INSERT, 0,
-                         -1, NULL, 0, true, false );
+                         -1, NULL, 0, true, pl_Unlocked );
         pl_Release( p_libvlc );
     }
     free( val.psz_string );
@@ -1295,7 +1295,7 @@ static int GetFilenames( libvlc_int_t *p_vlc, int i_argc, const char *ppsz_argv[
         playlist_t *p_playlist = pl_Yield( p_vlc );
         playlist_AddExt( p_playlist, ppsz_argv[i_opt], NULL, PLAYLIST_INSERT,
                          0, -1, ( i_options ? &ppsz_argv[i_opt + 1] : NULL ),
-                         i_options, true, false );
+                         i_options, true, pl_Unlocked );
         pl_Release( p_vlc );
     }
 
index 96bb776..9b53f77 100644 (file)
@@ -336,7 +336,7 @@ LRESULT CALLBACK WMCOPYWNDPROC( HWND hwnd, UINT uMsg, WPARAM wParam,
                         ( ( i_opt || p_data->enqueue ) ? 0 : PLAYLIST_GO ),
                   PLAYLIST_END, -1,
                   (char const **)( i_options ? &ppsz_argv[i_opt+1] : NULL ),
-                  i_options, true, false );
+                  i_options, true, pl_Unlocked );
 
                 i_opt += i_options;
             }
index d9d9e9d..6146af9 100644 (file)
@@ -87,14 +87,14 @@ static void input_item_subitem_added( const vlc_event_t * p_event,
         if( p_item_in_category->i_children == -1 )
         {
             p_item_in_category = playlist_ItemToNode( p_playlist,
-                    p_item_in_category, true );
+                    p_item_in_category, pl_Locked );
             p_item_in_category->p_input->i_type = ITEM_TYPE_PLAYLIST;
         }
 
         int i_ret = playlist_BothAddInput( p_playlist, p_child,
                 p_item_in_category,
                 PLAYLIST_APPEND | PLAYLIST_SPREPARSE , PLAYLIST_END,
-                NULL, NULL,  true );
+                NULL, NULL, pl_Locked );
 
         if( i_ret == VLC_SUCCESS && b_play )
         {
@@ -313,7 +313,7 @@ void playlist_Clear( playlist_t * p_playlist, bool b_locked )
 int playlist_DeleteFromItemId( playlist_t *p_playlist, int i_id )
 {
     playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_id,
-                                                    true );
+                                                    pl_Locked );
     if( !p_item ) return VLC_EGENERIC;
     return DeleteInner( p_playlist, p_item, true );
 }