]> git.sesse.net Git - vlc/commitdiff
Replace vlc_object_find() and vlc_object_release() of VLC_OBJECT_PLAYLIST with pl_Yie...
authorJean-Paul Saman <jpsaman@videolan.org>
Sun, 15 Jun 2008 16:46:33 +0000 (18:46 +0200)
committerJean-Paul Saman <jpsaman@videolan.org>
Wed, 18 Jun 2008 09:39:22 +0000 (11:39 +0200)
modules/gui/wxwidgets/dialogs.cpp
modules/gui/wxwidgets/dialogs/bookmarks.cpp
modules/gui/wxwidgets/dialogs/fileinfo.cpp
modules/gui/wxwidgets/dialogs/open.cpp
modules/gui/wxwidgets/dialogs/playlist.cpp
modules/gui/wxwidgets/dialogs/wizard.cpp
modules/gui/wxwidgets/input_manager.cpp
modules/gui/wxwidgets/interface.cpp
modules/gui/wxwidgets/menus.cpp
modules/gui/wxwidgets/playlist_manager.cpp
modules/gui/wxwidgets/timer.cpp

index 5bd482a41a1ce5df453b97bb3f46da6a7ee74eef..2204abf445f9d6a6ab1ba8c675a2c4eeb7d27e49 100644 (file)
@@ -435,9 +435,7 @@ void DialogsProvider::OnOpenFileGeneric( wxCommandEvent& event )
 
 void DialogsProvider::OnOpenFileSimple( wxCommandEvent& 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;
@@ -473,15 +471,12 @@ void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event )
             wxLocaleFree( psz_utf8 );
         }
     }
-
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 void DialogsProvider::OnOpenDirectory( wxCommandEvent& 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;
@@ -499,8 +494,7 @@ void DialogsProvider::OnOpenDirectory( wxCommandEvent& event )
                       PLAYLIST_END, true, false );
         wxLocaleFree( psz_utf8 );
     }
-
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 void DialogsProvider::OnOpenFile( wxCommandEvent& event )
index e2f138c4e8ae2a87d03ba04f3a2118de3ed045a7..13dfa1d45d29f3fb3ed36aba452070f95e284d07 100644 (file)
@@ -204,28 +204,24 @@ BookmarksDialog::BookmarksDialog( intf_thread_t *_p_intf, wxWindow *p_parent )
     main_sizer->Add( main_panel, 1, wxEXPAND );
     SetSizer( main_sizer );
 
-    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 )
     {
        /* Some global changes happened -> Rebuild all */
        var_AddCallback( p_playlist, "playlist-current",
                         PlaylistChanged, this );
-       vlc_object_release( p_playlist );
+       pl_Release( p_playlist );
     }
 }
 
 BookmarksDialog::~BookmarksDialog()
 {
-    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 )
     {
        var_DelCallback( p_playlist, "playlist-current",
                         PlaylistChanged, this );
-       vlc_object_release( p_playlist );
+       pl_Release( p_playlist );
     }
 }
 
index 76f697eba68d26de79e9e67a09a0905b31e502b1..df06c633c32065d570c0fcadca50af5b0698e1bc 100644 (file)
@@ -55,9 +55,8 @@ FileInfo::FileInfo( intf_thread_t *_p_intf, wxWindow *p_parent ):
              wxDefaultSize, wxDEFAULT_FRAME_STYLE )
 {
     p_intf = _p_intf;
-    playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf,
-                                                 VLC_OBJECT_PLAYLIST,
-                                                 FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
+
     b_stats = config_GetInt(p_intf, "stats");
     /* Initializations */
     SetIcon( *p_intf->p_sys->p_icon );
@@ -102,7 +101,7 @@ FileInfo::FileInfo( intf_thread_t *_p_intf, wxWindow *p_parent ):
     if( p_playlist )
     {
         var_AddCallback( p_playlist, "item-change", ItemChanged, this );
-        vlc_object_release( p_playlist );
+        pl_Release( p_playlist );
     }
 
     last_update = 0L;
@@ -115,22 +114,20 @@ void FileInfo::Update()
     if( mdate() - last_update < 400000L ) return;
     last_update = mdate();
 
-    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 ) return;
 
     input_thread_t *p_input = p_playlist->p_input ;
-
     if( !p_input || p_input->b_dead || !input_GetItem(p_input)->psz_name )
     {
         item_info->Clear();
         advanced_info->Clear();
         if( b_stats )
             stats_info->Clear();
-        vlc_object_release( p_playlist );
+        pl_Release( p_playlist );
         return;
     }
+    pl_Release( p_playlist );
 
     vlc_object_yield( p_input );
     vlc_mutex_lock( &input_GetItem(p_input)->lock );
@@ -146,7 +143,7 @@ void FileInfo::Update()
     vlc_mutex_unlock( &input_GetItem(p_input)->lock );
 
     vlc_object_release(p_input);
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
     b_need_update = false;
     panel_sizer->Layout();
 
index 715bcc72c7eef048c9c700b717ad3412ec498193..562f81f62bcc22ef8ccddb092ab76b5e332febd1 100644 (file)
@@ -1158,9 +1158,7 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
     }
 
     /* 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 < (int)mrl.GetCount(); i++ )
@@ -1209,10 +1207,9 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
         playlist_AddInput( p_playlist, p_input,
                PLAYLIST_APPEND | ( b_start ? PLAYLIST_GO : PLAYLIST_PREPARSE ),
                PLAYLIST_END, true, false );
-       vlc_gc_decref( p_input );
+        vlc_gc_decref( p_input );
     }
-
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 
     Hide();
 
index 17d0022d107ab19f25f999a8f295bffcf22cab12..4faf317afdb90945f19f83a05ced3fa2f23efdc6 100644 (file)
@@ -217,8 +217,7 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
     i_sort_mode = MODE_NONE;
     b_need_update = false;
     i_items_to_append = 0;
-    p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
-                                                FIND_ANYWHERE );
+    p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     SetIcon( *p_intf->p_sys->p_icon );
@@ -425,7 +424,7 @@ Playlist::~Playlist()
     var_DelCallback( p_playlist, "intf-change", PlaylistChanged, this );
     var_DelCallback( p_playlist, "item-append", ItemAppended, this );
     var_DelCallback( p_playlist, "item-deleted", ItemDeleted, this );
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 /**********************************************************************
index 792a24e7c2d4c75f7624c0857de76f45eaca2146..95921b7cb39858f4962f0fff7810f69faf0b9052 100644 (file)
@@ -577,9 +577,7 @@ wizInputPage::wizInputPage( wxWizard *parent, wxWizardPage *prev, intf_thread_t
     openSizer->Fit(open_panel);
     mainSizer->Add( open_panel );
 
-    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 )
     {
         if( !playlist_IsEmpty( p_playlist ) )
@@ -601,7 +599,7 @@ wizInputPage::wizInputPage( wxWizard *parent, wxWizardPage *prev, intf_thread_t
         {
             input_radios[1]->Disable();
         }
-        vlc_object_release( p_playlist );
+        pl_Release( p_playlist );
     }
     else
     {
@@ -717,11 +715,10 @@ void wizInputPage::OnWizardPageChanging(wxWizardEvent& event)
         if( i != -1 )
         {
             long data = listview->GetItemData( 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 )
             {
-                playlist_item_t * p_item = playlist_ItemGetById(                                                   p_playlist, (int)data, false );
+                playlist_item_t * p_item = playlist_ItemGetById( p_playlist, (int)data, false );
                 if( p_item )
                 {
                     const char *psz_uri = input_item_GetURI( p_item->p_input );
@@ -730,6 +727,7 @@ void wizInputPage::OnWizardPageChanging(wxWizardEvent& event)
                 }
                 else
                     event.Veto();
+                pl_Release( p_playlist );
             }
             else
                 event.Veto();
@@ -1608,8 +1606,7 @@ void WizardDialog::Run()
             free( psz_sap_option );
         }
 
-        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 )
         {
             input_item_t *p_input = input_ItemNew( p_playlist, mrl,
@@ -1636,7 +1633,7 @@ void WizardDialog::Run()
             playlist_AddInput( p_playlist, p_input,
                                PLAYLIST_GO, PLAYLIST_END, true, false );
             vlc_gc_decref( p_input );
-            vlc_object_release(p_playlist);
+            pl_Release( p_playlist );
         }
         else
         {
index ed79ec9d9ca89ad7e94142be1c9f884853c04428..9419e2ef07e74d20b21ed4076b515ee8741ce60d 100644 (file)
@@ -194,9 +194,7 @@ bool InputManager::IsPlaying()
  *****************************************************************************/
 void InputManager::UpdateInput()
 {
-    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 )
     {
         LockPlaylist( p_intf->p_sys, p_playlist );
@@ -204,7 +202,7 @@ void InputManager::UpdateInput()
         if( p_intf->p_sys->p_input )
              vlc_object_yield( p_intf->p_sys->p_input );
         UnlockPlaylist( p_intf->p_sys, p_playlist );
-        vlc_object_release( p_playlist );
+        pl_Release( p_playlist );
     }
 }
 
index 256cf2a8bf30b17b0f1a7891f71b0acff8658c1e..60b1973bfedbf96e09f9b84a3a6b8b6474f9baf8 100644 (file)
@@ -1075,9 +1075,7 @@ void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) )
 void Interface::PlayStream()
 {
     wxCommandEvent dummy;
-    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( !playlist_IsEmpty(p_playlist) )
@@ -1091,7 +1089,7 @@ void Interface::PlayStream()
         {
             /* No stream was playing, start one */
             playlist_Play( p_playlist );
-            vlc_object_release( p_playlist );
+            pl_Release( p_playlist );
             input_manager->Update();
             return;
         }
@@ -1110,13 +1108,13 @@ void Interface::PlayStream()
         var_Set( p_input, "state", state );
 
         vlc_object_release( p_input );
-        vlc_object_release( p_playlist );
+        pl_Release( p_playlist );
         input_manager->Update();
     }
     else
     {
         /* If the playlist is empty, open a file requester instead */
-        vlc_object_release( p_playlist );
+        pl_Release( p_playlist );
         OnShowDialog( dummy );
         GetToolBar()->ToggleTool( PlayStream_Event, false );
     }
@@ -1128,16 +1126,14 @@ void Interface::OnStopStream( wxCommandEvent& WXUNUSED(event) )
 }
 void Interface::StopStream()
 {
-    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 );
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
     input_manager->Update();
 }
 
@@ -1148,16 +1144,14 @@ void Interface::OnPrevStream( wxCommandEvent& WXUNUSED(event) )
 
 void Interface::PrevStream()
 {
-    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( wxCommandEvent& WXUNUSED(event) )
@@ -1167,15 +1161,13 @@ void Interface::OnNextStream( wxCommandEvent& WXUNUSED(event) )
 
 void Interface::NextStream()
 {
-    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( wxCommandEvent& WXUNUSED(event) )
@@ -1323,10 +1315,7 @@ bool DragAndDrop::OnDropFiles( wxCoord, wxCoord,
                                const wxArrayString& filenames )
 {
     /* Add dropped files to 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 FALSE;
@@ -1344,7 +1333,7 @@ bool DragAndDrop::OnDropFiles( wxCoord, wxCoord,
             {
                 vlc_object_release( p_input );
                 wxDnDLocaleFree( psz_utf8 );
-                vlc_object_release( p_playlist );
+                pl_Release( p_playlist );
                 return TRUE;
             }
             vlc_object_release( p_input );
@@ -1362,8 +1351,7 @@ bool DragAndDrop::OnDropFiles( wxCoord, wxCoord,
 
         wxDnDLocaleFree( psz_utf8 );
     }
-
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 
     return TRUE;
 }
index 7d681b77001bda2463f89d9e5f007b578c4b8ab7..9d02544e3cc6d64a87b02f682720cfae582a464f 100644 (file)
@@ -229,8 +229,7 @@ int IntfAutoMenuBuilder( intf_thread_t *p_intf, ArrayOfInts &ri_objects,
     unsigned int i_last_separator = 0; \
     ArrayOfInts ai_objects; \
     ArrayOfStrings as_varnames; \
-    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 ) \
         return; \
     input_thread_t *p_input = p_playlist->p_input
@@ -270,7 +269,7 @@ int IntfAutoMenuBuilder( intf_thread_t *p_intf, ArrayOfInts &ri_objects,
             popupmenu.InsertSeparator( 0 ); \
             popupmenu.Insert( 0, Play_Event, wxU(_("Play")) ); \
         } \
-        if( p_playlist ) vlc_object_release( p_playlist ); \
+        if( p_playlist ) pl_Release( p_playlist ); \
     } \
     \
     popupmenu.Append( MenuDummy_Event, wxU(_("Miscellaneous")), \
@@ -297,7 +296,7 @@ void VideoPopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
         }
         vlc_object_release( p_input );
     }
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
     CREATE_POPUP;
 }
 
@@ -319,7 +318,7 @@ void AudioPopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
         }
         vlc_object_release( p_input );
     }
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
     CREATE_POPUP;
 }
 
@@ -348,7 +347,7 @@ void MiscPopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
     p_intf->p_sys->p_popup_menu = &popupmenu;
     p_parent->PopupMenu( &popupmenu, pos.x, pos.y );
     p_intf->p_sys->p_popup_menu = NULL;
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
@@ -404,7 +403,7 @@ void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
     p_intf->p_sys->p_popup_menu = &popupmenu;
     p_parent->PopupMenu( &popupmenu, pos.x, pos.y );
     p_intf->p_sys->p_popup_menu = NULL;
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 /*****************************************************************************
@@ -937,9 +936,7 @@ void MenuEvtHandler::OnMenuEvent( wxCommandEvent& event )
     if( event.GetId() >= Play_Event && event.GetId() <= Stop_Event )
     {
         input_thread_t *p_input;
-        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 ) return;
 
         switch( event.GetId() )
@@ -970,8 +967,7 @@ void MenuEvtHandler::OnMenuEvent( wxCommandEvent& event )
             playlist_Next( p_playlist );
             break;
         }
-
-        vlc_object_release( p_playlist );
+        pl_Release( p_playlist );
         return;
     }
 
index d8d77e982ac29b75c3f0ca548c5068c52cbf0c80..d853bf9b7eda911fe1f69f103a605bed92942028 100644 (file)
@@ -111,8 +111,7 @@ PlaylistManager::PlaylistManager( intf_thread_t *_p_intf, wxWindow *p_parent ):
     i_cached_item_id = -1;
     i_update_counter = 0;
 
-    p_playlist = (playlist_t *)
-        vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     var_Create( p_intf, "random", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
@@ -188,7 +187,7 @@ PlaylistManager::~PlaylistManager()
     var_DelCallback( p_playlist, "intf-change", PlaylistChanged, this );
     var_DelCallback( p_playlist, "item-append", ItemAppended, this );
     var_DelCallback( p_playlist, "item-deleted", ItemDeleted, this );
-    vlc_object_release( p_playlist );
+    pl_Release( p_playlist );
 }
 
 /*****************************************************************************
index 897476536f4adf0ebaa8a8ad76a01ce77d917594..b9f4e0e0ad21da4cc53acac0cd34782c37b43ff5 100644 (file)
@@ -49,13 +49,11 @@ Timer::Timer( intf_thread_t *_p_intf, Interface *_p_main_interface )
     var_AddCallback( p_intf->p_libvlc, "intf-show", IntfShowCB, p_intf );
 
     /* 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 );
     }
 
     Start( 100 /*milliseconds*/, wxTIMER_CONTINUOUS );
@@ -66,13 +64,11 @@ Timer::~Timer()
     var_DelCallback( p_intf->p_libvlc, "intf-show", IntfShowCB, p_intf );
 
     /* 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 );
     }
 }