]> git.sesse.net Git - vlc/commitdiff
Use pl_Yield and pl_Release instead of vlc_object_find.
authorRémi Duraffort <ivoire@videolan.org>
Thu, 24 Jul 2008 10:54:21 +0000 (12:54 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Thu, 24 Jul 2008 16:34:54 +0000 (18:34 +0200)
14 files changed:
modules/gui/beos/InterfaceWindow.cpp
modules/gui/beos/ListViews.cpp
modules/gui/beos/PlayListWindow.cpp
modules/gui/pda/pda.c
modules/gui/pda/pda_callbacks.c
modules/gui/wince/dialogs.cpp
modules/gui/wince/interface.cpp
modules/gui/wince/iteminfo.cpp
modules/gui/wince/menus.cpp
modules/gui/wince/open.cpp
modules/gui/wince/playlist.cpp
modules/gui/wince/timer.cpp
modules/video_output/caca.c
modules/video_output/msw/directx.c

index 9e6a7dd730bd9931376693c7274e17246376e80d..82c7563e6f1ba0d3c90250d74f8702a9c2d3ba0c 100644 (file)
@@ -203,8 +203,7 @@ InterfaceWindow::InterfaceWindow( intf_thread_t * _p_intf, BRect frame,
       fLastUpdateTime( system_time() ),
       fSettings( new BMessage( 'sett' ) )
 {
-    p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    p_playlist = pl_Yield( p_intf );
 
     var_AddCallback( p_playlist, "intf-change", PlaylistChanged, this );
     var_AddCallback( p_playlist, "item-change", PlaylistChanged, this );
@@ -355,7 +354,7 @@ InterfaceWindow::~InterfaceWindow()
     }
     if( p_playlist )
     {
-        vlc_object_release( p_playlist );
+        pl_Release( p_playlist );
     }
 #if 0
     if( fPlaylistWindow )
index ebe147674d411ecd5ed52e639a155ff01b55c4cb..bcf245192b0d4ec94a8583f8c4b106e890646ef9 100644 (file)
@@ -690,13 +690,11 @@ PlaylistView::MouseDown( BPoint where )
                 // only do something if user clicked the same item twice
                 if ( fLastClickedItem == item )
                 {
-                    playlist_t * p_playlist;
-                    p_playlist = (playlist_t *) vlc_object_find( p_intf,
-                        VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+                    playlist_t * p_playlist = pl_Yield( p_intf );
                     if( p_playlist )
                     {
                         playlist_Goto( p_playlist, i );
-                        vlc_object_release( p_playlist );
+                        pl_Release( p_playlist );
                     }
                     handled = true;
                 }
@@ -1079,9 +1077,7 @@ PlaylistView::SetDisplayMode( uint32 mode )
 BListItem*
 PlaylistView::_PlayingItem() const
 {
-    playlist_t * p_playlist;
-    p_playlist = (playlist_t *) vlc_object_find( p_intf,
-        VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t * p_playlist = pl_Yield( p_intf );
 
     if( !p_playlist )
     {
@@ -1089,7 +1085,7 @@ PlaylistView::_PlayingItem() const
     }
 
     BListItem * item = ItemAt( p_playlist->i_index );
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
     return item;
 }
 
@@ -1103,9 +1099,7 @@ PlaylistView::_SetPlayingIndex( BListItem* playingItem )
     {
         if ( item == playingItem )
         {
-            playlist_t * p_playlist;
-            p_playlist = (playlist_t *) vlc_object_find( p_intf,
-                VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+            playlist_t * p_playlist = pl_Yield( p_intf );
  
             if( !p_playlist )
             {
@@ -1115,7 +1109,7 @@ PlaylistView::_SetPlayingIndex( BListItem* playingItem )
             playlist_Goto( p_playlist, i );
             SetCurrent( i );
 
-            vlc_object_release( p_playlist );
+            pl_Release( p_playlist );
             break;
         }
     }
index 585523810d07063f59dc8a6a076b501506e069d1..d05036fc196d6b9fee0ee4ea18abb31576ab22e9 100644 (file)
@@ -291,11 +291,10 @@ PlayListWindow::UpdatePlaylist( bool rebuild )
     if( rebuild )
         fListView->RebuildList();
 
-    p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    p_playlist = pl_Yield( p_intf );
     fListView->SetCurrent( p_playlist->i_index );
     fListView->SetPlaying( p_playlist->status.i_status == PLAYLIST_RUNNING );
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 
     _CheckItemsEnableState();
 }
index 7b35818ccd01a564ec29f8f76bc1c7fa634c6754..541054b28f7adad5e871183645136fc1e35851df 100644 (file)
@@ -288,7 +288,7 @@ static void Run( intf_thread_t *p_intf )
     gtk_tree_view_column_set_sort_column_id(p_column, 2);
 #endif
     /* update the playlist */
-    p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    p_playlist = pl_Yield( p_intf );
     p_playlist_store = gtk_list_store_new (3,
                 G_TYPE_STRING, /* Filename */
                 G_TYPE_STRING, /* Time */
@@ -296,7 +296,7 @@ static void Run( intf_thread_t *p_intf )
     PlaylistRebuildListStore(p_intf,p_playlist_store, p_playlist);
     gtk_tree_view_set_model(GTK_TREE_VIEW(p_intf->p_sys->p_tvplaylist), GTK_TREE_MODEL(p_playlist_store));
     g_object_unref(p_playlist_store);
-    vlc_object_release(p_playlist); /* Free the playlist */
+    pl_Release(p_playlist); /* Free the playlist */
     gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(p_intf->p_sys->p_tvplaylist)),GTK_SELECTION_MULTIPLE);
 
     /* Column properties */
@@ -426,8 +426,7 @@ static int Manage( intf_thread_t *p_intf )
             p_intf->p_sys->b_playing = 1;
 
             /* update playlist interface */
-            p_playlist = (playlist_t *) vlc_object_find(
-                    p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+            p_playlist = pl_Yield( p_intf );
             if (p_playlist != NULL)
             {
                 p_liststore = gtk_list_store_new (3,
@@ -437,7 +436,7 @@ static int Manage( intf_thread_t *p_intf )
                 PlaylistRebuildListStore(p_intf, p_liststore, p_playlist);
                 gtk_tree_view_set_model(p_intf->p_sys->p_tvplaylist, (GtkTreeModel*) p_liststore);
                 g_object_unref(p_liststore);
-                vlc_object_release( p_playlist );
+                pl_Release( p_playlist );
             }
 
             /* Manage the slider */
index b0cc1d1f92cefcd3fc7afa08353e4a7f881ac86f..15b3f63508a158662e5f4767a9ee9e80a41f4633 100644 (file)
@@ -94,8 +94,7 @@ static void PlaylistAddItem(GtkWidget *widget, gchar *name, char **ppsz_options,
     int           i_id , i_pos=0;
     GtkTreeView   *p_tvplaylist = NULL;
 
-    p_playlist = (playlist_t *)
-             vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    p_playlist = pl_Yield( p_intf );
 
     if( p_playlist ==  NULL)
     {   /* Bail out when VLC's playlist object is not found. */
@@ -147,7 +146,7 @@ static void PlaylistAddItem(GtkWidget *widget, gchar *name, char **ppsz_options,
             free(ppsz_options);
         }
     }
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 void PlaylistRebuildListStore( intf_thread_t *p_intf,
@@ -379,7 +378,7 @@ void onPause(GtkButton *button, gpointer user_data)
 void onPlay(GtkButton *button, gpointer user_data)
 {
     intf_thread_t *p_intf = GtkGetIntf( GTK_WIDGET( button ) );
-    playlist_t *p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
 
     if (p_playlist)
     {
@@ -394,19 +393,18 @@ void onPlay(GtkButton *button, gpointer user_data)
         {
             vlc_object_unlock( p_playlist );
         }
-        vlc_object_release( p_playlist );
+        pl_Release( p_playlist );
     }
 }
 
 void onStop(GtkButton *button, gpointer user_data)
 {
     intf_thread_t *p_intf = GtkGetIntf( GTK_WIDGET( button ) );
-    playlist_t *p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
-                                                       FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if (p_playlist)
     {
         playlist_Stop( p_playlist );
-        vlc_object_release( p_playlist );
+        pl_Release( p_playlist );
         gdk_window_raise( p_intf->p_sys->p_window->window );
     }
 }
@@ -773,8 +771,7 @@ void onPlaylistRow(GtkTreeView *treeview, GtkTreePath *path,
 {
     intf_thread_t *p_intf = GtkGetIntf( GTK_WIDGET(treeview) );
     GtkTreeSelection *p_selection = gtk_tree_view_get_selection(treeview);
-    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
-                                                       FIND_ANYWHERE );
+    playlist_t * p_playlist = pl_Yield( p_intf );
 
     if( p_playlist == NULL )
     {
@@ -805,15 +802,14 @@ void onPlaylistRow(GtkTreeView *treeview, GtkTreePath *path,
         i_skip = i_row - p_playlist->i_current_index;
         playlist_Skip( p_playlist, i_skip );
     }
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 
 void onUpdatePlaylist(GtkButton *button, gpointer user_data)
 {
     intf_thread_t *  p_intf = GtkGetIntf( button );
-    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
-                                                       FIND_ANYWHERE );
+    playlist_t * p_playlist = pl_Yield( p_intf );
     GtkTreeView *p_tvplaylist = NULL;
 
     if( p_playlist == NULL )
@@ -838,7 +834,7 @@ void onUpdatePlaylist(GtkButton *button, gpointer user_data)
             g_object_unref(p_model);
         }
     }
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 static void deleteItemFromPlaylist(gpointer data, gpointer user_data)
@@ -849,8 +845,7 @@ static void deleteItemFromPlaylist(gpointer data, gpointer user_data)
 void onDeletePlaylist(GtkButton *button, gpointer user_data)
 {
     intf_thread_t *p_intf = GtkGetIntf( button );
-    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
-                                                       FIND_ANYWHERE );
+    playlist_t * p_playlist = pl_Yield( p_intf );
     GtkTreeView    *p_tvplaylist;
 
     /* Delete an arbitrary item from the playlist */
@@ -912,15 +907,14 @@ void onDeletePlaylist(GtkButton *button, gpointer user_data)
             g_object_unref(p_store);
         }
     }
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 
 void onClearPlaylist(GtkButton *button, gpointer user_data)
 {
     intf_thread_t *p_intf = GtkGetIntf( button );
-    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
-                                                       FIND_ANYWHERE );
+    playlist_t * p_playlist = pl_Yield( p_intf );
     GtkTreeView    *p_tvplaylist;
     int item;
 
@@ -933,7 +927,7 @@ void onClearPlaylist(GtkButton *button, gpointer user_data)
     {
         msg_Err( p_playlist, "fix pda delete" );
     }
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 
     // Remove all entries from the Playlist widget.
     p_tvplaylist = (GtkTreeView*) lookup_widget( GTK_WIDGET(button), "tvPlaylist");
@@ -1045,7 +1039,7 @@ void onAddTranscodeToPlaylist(GtkButton *button, gpointer user_data)
     }
 
     /* Update the playlist */
-    playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     /* Get all the options. */
index e3d581144aa71dc77adbad336d09bf586e6334c5..1fa35cdbc82b72b72e9842818dc54144cd29e629 100644 (file)
@@ -332,8 +332,7 @@ void DialogsProvider::OnOpenFileSimple( int i_arg )
     TCHAR szFile[MAX_PATH] = _T("\0");
     static TCHAR szFilter[] = _T("All (*.*)\0*.*\0");
 
-    playlist_t *p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     memset( &ofn, 0, sizeof(OPENFILENAME) );
@@ -367,7 +366,7 @@ void DialogsProvider::OnOpenFileSimple( int i_arg )
                       PLAYLIST_APPEND | (i_arg?PLAYLIST_GO:0), PLAYLIST_END );
     }
 
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 void DialogsProvider::OnOpenDirectory( int i_arg )
@@ -406,8 +405,7 @@ void DialogsProvider::OnOpenDirectory( int i_arg )
 
     if( !SUCCEEDED( SHGetMalloc(&p_malloc) ) ) goto error;
 
-    p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    p_playlist = pl_Yield( p_intf );
     if( !p_playlist ) goto error;
 
     memset( &bi, 0, sizeof(BROWSEINFO) );
@@ -433,7 +431,7 @@ void DialogsProvider::OnOpenDirectory( int i_arg )
  error:
 
     if( p_malloc) p_malloc->Release();
-    if( p_playlist ) vlc_object_release( p_playlist );
+    if( p_playlist ) pl_Release( p_playlist );
 
 #ifdef UNDER_CE
     FreeLibrary( ceshell_dll );
index 854848ec3aeaadebfe4162b4463c8032c0cb692f..660e43214a8b8dde49d79d68b41045a482225bfd 100644 (file)
@@ -637,8 +637,7 @@ void Interface::OnShowDialog( int i_dialog_event )
 
 void Interface::OnPlayStream( void )
 {
-    playlist_t *p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     if( p_playlist->i_size )
@@ -653,7 +652,7 @@ void Interface::OnPlayStream( void )
             /* No stream was playing, start one */
             playlist_Play( p_playlist );
             TogglePlayButton( PLAYING_S );
-            vlc_object_release( p_playlist );
+            pl_Release( p_playlist );
             return;
         }
 
@@ -673,14 +672,13 @@ void Interface::OnPlayStream( void )
 
         TogglePlayButton( state.i_int );
         vlc_object_release( p_input );
-        vlc_object_release( p_playlist );
     }
     else
     {
         /* If the playlist is empty, open a file requester instead */
-        vlc_object_release( p_playlist );
         OnShowDialog( ID_FILE_QUICKOPEN );
     }
+    pl_Release( p_playlist );
 }
 
 void Interface::TogglePlayButton( int i_playing_status )
@@ -812,33 +810,30 @@ void Interface::VolumeUpdate()
 
 void Interface::OnStopStream( void )
 {
-    playlist_t * p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t * p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     playlist_Stop( p_playlist );
     TogglePlayButton( PAUSE_S );
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 void Interface::OnPrevStream( void )
 {
-    playlist_t * p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t * p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     playlist_Prev( p_playlist );
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 void Interface::OnNextStream( void )
 {
-    playlist_t * p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t * p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     playlist_Next( p_playlist );
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 void Interface::OnSlowStream( void )
index 5b4062370de868b2d1bbcc93ded3d088aa03d50f..160f72a2103cdc9731c20a295e05c8f4f3eefeee 100644 (file)
@@ -269,12 +269,11 @@ void ItemInfoDialog::OnOk()
     vlc_mutex_lock( &p_item->input.lock );
     bool b_old_enabled = p_item->b_enabled;
 
-    playlist_t * p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t * p_playlist = pl_Yield( p_intf );
     if( p_playlist != NULL )
     {
         b_state = SendMessage( enabled_checkbox, BM_GETCHECK, 0, 0 );
-        vlc_object_release( p_playlist );
+        pl_Release( p_playlist );
     }
 
     p_item->b_enabled = (b_state & BST_CHECKED) ? true : false ;
index 5616fdb97dd95d09e7fa47f4c6b8f9b8db4f692a..db7306c283be42f6a4801bef0a7fbbafb5df3c59 100644 (file)
@@ -221,15 +221,13 @@ void PopupMenu( intf_thread_t *p_intf, HWND p_parent, POINT point )
     }
     else
     {
-        playlist_t * p_playlist =
-            (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
-                                           FIND_ANYWHERE );
+        playlist_t * p_playlist = pl_Yield( p_intf );
         if( p_playlist && p_playlist->i_size )
         {
             AppendMenu( hmenu, MF_SEPARATOR, 0, _T("") );
             AppendMenu( hmenu, MF_STRING, PlayStream_Event, _T("Play") );
         }
-        if( p_playlist ) vlc_object_release( p_playlist );
+        if( p_playlist ) pl_Release( p_playlist );
     }
 
     AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)MiscMenu( p_intf ),
index 5d76b9bf1e50f664a60fdb08337968b0fc751f84..911b4524b891e37b274aa5cc3eb5f33b8795e86e 100644 (file)
@@ -609,9 +609,7 @@ void OpenDialog::OnOk()
     ComboBox_SetCurSel( mrl_combo, ComboBox_GetCount( mrl_combo ) - 1 );
 
     /* Update the playlist */
-    playlist_t *p_playlist =
-        (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
-                                       FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     for( int i = 0; i < i_args; i++ )
@@ -657,7 +655,7 @@ void OpenDialog::OnOk()
         free( pp_args[i_args] );
         if( !i_args ) free( pp_args );
     }
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 /*****************************************************************************
index d6af2a5badd66751039b8f6e49888076bc1e4922..dca6f6c10ea5feeed4d6f6f32b5b9cf254fea678 100644 (file)
@@ -288,8 +288,7 @@ LRESULT Playlist::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
 
         // random, loop, repeat buttons states
         vlc_value_t val;
-        p_playlist = (playlist_t *)
-            vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+        p_playlist = pl_Yield( p_intf );
         if( !p_playlist ) break;
 
         var_Get( p_playlist , "random", &val );
@@ -304,7 +303,7 @@ LRESULT Playlist::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
         bState = val.b_bool ? TBSTATE_CHECKED : 0;
         SendMessage( hwndTB, TB_SETSTATE, Repeat_Event,
                      MAKELONG(bState | TBSTATE_ENABLED, 0) );
-        vlc_object_release( p_playlist );
+        pl_Release( p_playlist );
 
         GetClientRect( hwnd, &rect );
         hListView = CreateWindow( WC_LISTVIEW, NULL, WS_VISIBLE | WS_CHILD |
@@ -517,13 +516,12 @@ LRESULT Playlist::ProcessCustomDraw( LPARAM lParam )
         return CDRF_NOTIFYITEMDRAW;
 
     case CDDS_ITEMPREPAINT: //Before an item is drawn
-        playlist_t *p_playlist = (playlist_t *)
-            vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+        playlist_t *p_playlist = pl_Yield( p_intf );
         if( p_playlist == NULL ) return CDRF_DODEFAULT;
         if( (int)lplvcd->nmcd.dwItemSpec == p_playlist->i_index )
         {
             lplvcd->clrText = RGB(255,0,0);
-            vlc_object_release(p_playlist);
+            pl_Release( p_playlist );
             return CDRF_NEWFONT;
         }
  
@@ -531,15 +529,16 @@ LRESULT Playlist::ProcessCustomDraw( LPARAM lParam )
                                         (int)lplvcd->nmcd.dwItemSpec );
         if( !p_item )
         {
-            vlc_object_release(p_playlist);
+            pl_Release( p_playlist );
             return CDRF_DODEFAULT;
         }
         if( p_item->b_enabled == false )
         {
             lplvcd->clrText = RGB(192,192,192);
-            vlc_object_release(p_playlist);
+            pl_Release( p_playlist );
             return CDRF_NEWFONT;
         }
+        pl_Release( p_playlist );
     }
 
     return CDRF_DODEFAULT;
@@ -589,8 +588,7 @@ void Playlist::UpdatePlaylist()
         b_need_update = false;
     }
  
-    playlist_t *p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
  
     /* Update the colour of items */
@@ -606,7 +604,7 @@ void Playlist::UpdatePlaylist()
     }
     vlc_object_unlock( p_playlist );
 
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 /**********************************************************************
@@ -614,8 +612,7 @@ void Playlist::UpdatePlaylist()
  **********************************************************************/
 void Playlist::Rebuild()
 {
-    playlist_t *p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     int i_focused =
@@ -648,7 +645,7 @@ void Playlist::Rebuild()
         ListView_SetItemState( hListView, i_focused, LVIS_FOCUSED,
                                LVIS_STATEIMAGEMASK );
 
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 /**********************************************************************
@@ -656,8 +653,7 @@ void Playlist::Rebuild()
  **********************************************************************/
 void Playlist::UpdateItem( int i )
 {
-    playlist_t *p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
 
     if( p_playlist == NULL ) return;
 
@@ -665,7 +661,7 @@ void Playlist::UpdateItem( int i )
 
     if( !p_item )
     {
-        vlc_object_release(p_playlist);
+        pl_Release(p_playlist);
         return;
     }
 
@@ -681,7 +677,7 @@ void Playlist::UpdateItem( int i )
 
     ListView_SetItemText( hListView, i, 3, _FROMMB(psz_duration) );
 
-    vlc_object_release(p_playlist);
+    pl_Release(p_playlist);
 }
 
 /**********************************************************************
@@ -689,14 +685,13 @@ void Playlist::UpdateItem( int i )
  **********************************************************************/
 void Playlist::DeleteItem( int item )
 {
-    playlist_t *p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     playlist_Delete( p_playlist, item );
     ListView_DeleteItem( hListView, item );
 
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 /**********************************************************************
@@ -708,15 +703,13 @@ static void OnOpenCB( intf_dialog_args_t *p_arg )
 
     if( p_arg->i_results && p_arg->psz_results[0] )
     {
-        playlist_t * p_playlist = (playlist_t *)
-            vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+        playlist_t * p_playlist = pl_Yield( p_intf );
 
         if( p_playlist )
         {
             playlist_Import( p_playlist, p_arg->psz_results[0] );
+            pl_Release( p_playlist );
         }
-
-        if( p_playlist ) vlc_object_release( p_playlist );
     }
 }
 
@@ -742,8 +735,7 @@ static void OnSaveCB( intf_dialog_args_t *p_arg )
 
     if( p_arg->i_results && p_arg->psz_results[0] )
     {
-        playlist_t * p_playlist = (playlist_t *)
-            vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+        playlist_t * p_playlist = pl_Yield( p_intf );
 
         if( p_playlist )
         {
@@ -755,9 +747,8 @@ static void OnSaveCB( intf_dialog_args_t *p_arg )
             else psz_export = "export-m3u";
 
             playlist_Export( p_playlist, p_arg->psz_results[0], psz_export );
+            pl_Release( p_playlist );
         }
-
-        if( p_playlist ) vlc_object_release( p_playlist );
     }
 }
 
@@ -809,8 +800,7 @@ void Playlist::OnInvertSelection()
 
 void Playlist::OnEnableSelection()
 {
-    playlist_t *p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     for( long item = ListView_GetItemCount( hListView ) - 1;
@@ -824,13 +814,12 @@ void Playlist::OnEnableSelection()
             UpdateItem( item );
         }
     }
-    vlc_object_release( p_playlist);
+    pl_Release( p_playlist);
 }
 
 void Playlist::OnDisableSelection()
 {
-    playlist_t *p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     for( long item = ListView_GetItemCount( hListView ) - 1;
@@ -845,7 +834,7 @@ void Playlist::OnDisableSelection()
             UpdateItem( item );
         }
     }
-    vlc_object_release( p_playlist);
+    pl_Release( p_playlist);
 }
 
 void Playlist::OnSelectAll()
@@ -859,19 +848,17 @@ void Playlist::OnSelectAll()
 
 void Playlist::OnActivateItem( int i_item )
 {
-    playlist_t *p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     playlist_Goto( p_playlist, i_item );
 
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 void Playlist::ShowInfos( HWND hwnd, int i_item )
 {
-    playlist_t *p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     vlc_object_lock( p_playlist);
@@ -887,7 +874,7 @@ void Playlist::ShowInfos( HWND hwnd, int i_item )
         delete iteminfo_dialog;
     }
 
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 /********************************************************************
@@ -895,8 +882,7 @@ void Playlist::ShowInfos( HWND hwnd, int i_item )
  ********************************************************************/
 void Playlist::OnUp()
 {
-    playlist_t *p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     /* We use the first selected item, so find it */
@@ -917,15 +903,14 @@ void Playlist::OnUp()
                                    LVIS_STATEIMAGEMASK );
         }
     }
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 
     return;
 }
 
 void Playlist::OnDown()
 {
-    playlist_t *p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     /* We use the first selected item, so find it */
@@ -938,7 +923,7 @@ void Playlist::OnDown()
         ListView_SetItemState( hListView, i_item + 1, LVIS_FOCUSED,
                                LVIS_STATEIMAGEMASK );
     }
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 
     return;
 }
@@ -952,12 +937,11 @@ void Playlist::OnRandom()
     int bState = SendMessage( hwndTB, TB_GETSTATE, Random_Event, 0 );
     val.b_bool = (bState & TBSTATE_CHECKED) ? true : false;
 
-    playlist_t *p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     var_Set( p_playlist , "random", val );
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 void Playlist::OnLoop ()
@@ -966,12 +950,11 @@ void Playlist::OnLoop ()
     int bState = SendMessage( hwndTB, TB_GETSTATE, Loop_Event, 0 );
     val.b_bool = (bState & TBSTATE_CHECKED) ? true : false;
 
-    playlist_t *p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     var_Set( p_playlist , "loop", val );
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 void Playlist::OnRepeat ()
@@ -980,12 +963,11 @@ void Playlist::OnRepeat ()
     int bState = SendMessage( hwndTB, TB_GETSTATE, Repeat_Event, 0 );
     val.b_bool = (bState & TBSTATE_CHECKED) ? true : false;
 
-    playlist_t *p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     var_Set( p_playlist , "repeat", val );
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 /********************************************************************
@@ -993,8 +975,7 @@ void Playlist::OnRepeat ()
  ********************************************************************/
 void Playlist::OnSort( UINT event )
 {
-    playlist_t *p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     switch( event )
@@ -1016,7 +997,7 @@ void Playlist::OnSort( UINT event )
         break;
     }
 
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 
     b_need_update = true;
 
@@ -1025,8 +1006,7 @@ void Playlist::OnSort( UINT event )
 
 void Playlist::OnColSelect( int iSubItem )
 {
-    playlist_t *p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     switch( iSubItem )
@@ -1059,7 +1039,7 @@ void Playlist::OnColSelect( int iSubItem )
         break;
     }
 
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 
     b_need_update = true;
 
@@ -1074,8 +1054,7 @@ void Playlist::OnPopupPlay()
     int i_popup_item =
         ListView_GetNextItem( hListView, -1, LVIS_SELECTED | LVNI_ALL );
 
-    playlist_t *p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     if( i_popup_item != -1 )
@@ -1083,7 +1062,7 @@ void Playlist::OnPopupPlay()
         playlist_Goto( p_playlist, i_popup_item );
     }
 
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 void Playlist::OnPopupDel()
@@ -1099,8 +1078,7 @@ void Playlist::OnPopupEna()
     int i_popup_item =
         ListView_GetNextItem( hListView, -1, LVIS_SELECTED | LVNI_ALL );
 
-    playlist_t *p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     playlist_item_t *p_item =
@@ -1116,7 +1094,7 @@ void Playlist::OnPopupEna()
         playlist_Enable( p_playlist, p_item );
     }
 
-    vlc_object_release( p_playlist);
+    pl_Release( p_playlist);
     UpdateItem( i_popup_item );
 }
 
index 5047f0cc4e9835be9cfdbb06313e70ca5ebcf66b..df58e803b089b9556a017124096f024172171b3e 100644 (file)
@@ -52,13 +52,11 @@ Timer::Timer( intf_thread_t *_p_intf, HWND hwnd, Interface *_p_main_interface)
     i_old_rate = INPUT_RATE_DEFAULT;
 
     /* Register callback for the intf-popupmenu variable */
-    playlist_t *p_playlist =
-        (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
-                                       FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist != NULL )
     {
         var_AddCallback( p_playlist, "intf-popupmenu", PopupMenuCB, p_intf );
-        vlc_object_release( p_playlist );
+        pl_Release( p_playlist );
     }
 
     SetTimer( hwnd, 1, 200 /*milliseconds*/, NULL );
@@ -67,13 +65,11 @@ Timer::Timer( intf_thread_t *_p_intf, HWND hwnd, Interface *_p_main_interface)
 Timer::~Timer()
 {
     /* Unregister callback */
-    playlist_t *p_playlist =
-        (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
-                                       FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist != NULL )
     {
         var_DelCallback( p_playlist, "intf-popupmenu", PopupMenuCB, p_intf );
-        vlc_object_release( p_playlist );
+        pl_Release( p_playlist );
     }
 }
 
index 888414a9eaa1784566a5f279e637396f9b66e89b..c0287b3707f1b5117f3cb7b4adb8e156d5b95e8e 100644 (file)
@@ -371,12 +371,11 @@ static int Manage( vout_thread_t *p_vout )
             break;
         case CACA_EVENT_QUIT:
         {
-            p_playlist = vlc_object_find( p_vout,
-                                         VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+            p_playlist = pl_Yield( p_vout );
             if( p_playlist )
             {
                 playlist_Stop( p_playlist );
-                vlc_object_release( p_playlist );
+                pl_Release( p_vout );
             }
             vlc_object_kill( p_vout->p_libvlc );
             break;
index aab3e883c725e34ccf0bee7f4be9798c4b9a5926..1418a1b73428e68ae62d206f0322324313ea9142 100644 (file)
@@ -2123,17 +2123,15 @@ static int WallpaperCallback( vlc_object_t *p_this, char const *psz_cmd,
     if( (newval.b_bool && !p_vout->p_sys->b_wallpaper) ||
         (!newval.b_bool && p_vout->p_sys->b_wallpaper) )
     {
-        playlist_t *p_playlist;
+        playlist_t *p_playlist = pl_Yield( p_vout );
 
-        p_playlist = vlc_object_find( p_this,
-                                     VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
         if( p_playlist )
         {
             /* Modify playlist as well because the vout might have to be
              * restarted */
             var_Create( p_playlist, "directx-wallpaper", VLC_VAR_BOOL );
             var_Set( p_playlist, "directx-wallpaper", newval );
-            vlc_object_release( p_playlist );
+            pl_Release( p_playlist );
         }
 
         p_vout->p_sys->i_changes |= DX_WALLPAPER_CHANGE;