]> git.sesse.net Git - vlc/commitdiff
Fix playlist crasher and simplify a few things
authorClément Stenac <zorglub@videolan.org>
Wed, 31 May 2006 20:40:54 +0000 (20:40 +0000)
committerClément Stenac <zorglub@videolan.org>
Wed, 31 May 2006 20:40:54 +0000 (20:40 +0000)
(Remove ITEMPLAY method, which had become redundant)

17 files changed:
include/vlc_common.h
modules/access/cdda.c
modules/access/cdda/info.c
modules/control/hotkeys.c
modules/control/http/macro.c
modules/control/http/rpn.c
modules/demux/playlist/playlist.h
modules/gui/macosx/playlist.m
modules/gui/macosx/wizard.m
modules/gui/ncurses.c
modules/gui/qt4/main_interface.cpp
modules/gui/skins2/vars/playtree.cpp
modules/gui/wince/open.cpp
modules/gui/wxwidgets/dialogs/playlist.cpp
modules/video_filter/motiondetect.c
src/playlist/control.c
src/playlist/tree.c

index 7c8dbb259d7db70a4728ce8f5753274b57570324..661f72c39dbd9574d2cc331bab0822a9610aa5a2 100644 (file)
@@ -220,14 +220,11 @@ typedef struct msg_subscription_t msg_subscription_t;
 typedef enum {
     PLAYLIST_PLAY,      /**< No arg.                            res=can fail*/
     PLAYLIST_AUTOPLAY,  /**< No arg.                            res=cant fail*/
-    PLAYLIST_VIEWPLAY,  /**< arg1= int, arg2= playlist_item_t*,*/
-                        /**  arg3 = playlist_item_t*          , res=can fail */
-    PLAYLIST_ITEMPLAY,  /** <arg1 = playlist_item_t *         , res=can fail */
+    PLAYLIST_VIEWPLAY,  /**< arg1= playlist_item_t*,*/
+                        /**  arg2 = playlist_item_t*          , res=can fail */
     PLAYLIST_PAUSE,     /**< No arg                             res=can fail*/
     PLAYLIST_STOP,      /**< No arg                             res=can fail*/
     PLAYLIST_SKIP,      /**< arg1=int,                          res=can fail*/
-    PLAYLIST_GOTO,      /**< arg1=int                           res=can fail */
-    PLAYLIST_VIEWGOTO   /**< arg1=int                           res=can fail */
 } playlist_command_t;
 
 
index 76cb40991ee98a53429d2088aeed82d5a80c9ba6..9576c2be571961d813c0bb8f5d60a11843d4fc10 100644 (file)
@@ -291,9 +291,8 @@ static int Open( vlc_object_t *p_this )
 
     if( b_play )
     {
-          playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, 1242,
+          playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,
                             p_playlist->request.p_node, NULL );
-//        playlist_Play( p_playlist );
     }
 
     if( p_playlist ) vlc_object_release( p_playlist );
index 5d06afe899193b0fd6868903aae559b3f83ec076..1211850ae4c8ce684bf305b8feacadb61010f623 100644 (file)
@@ -1037,7 +1037,7 @@ CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
 
     if( b_play )
     {
-        playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, 0,
+        playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,
                           p_playlist->status.p_item, NULL );
     }
 
index ea7c7e5a88b0a37b47c04fc5c61761a13dbd57bf..5f319495ab379debc4ccdabac3a3ee123f7e77b7 100644 (file)
@@ -921,7 +921,7 @@ static void PlayBookmark( intf_thread_t *p_intf, int i_num )
             if( !strcmp( psz_bookmark,
                          p_playlist->pp_items[i]->p_input->psz_uri ) )
             {
-                playlist_LockControl( p_playlist, PLAYLIST_ITEMPLAY,
+                playlist_LockControl( p_playlist, PLAYLIST_VIEWPLAY, NULL,
                                       p_playlist->pp_items[i] );
                 break;
             }
index 34795bb65ccbec37b09245a661f96941ab730eeb..bab1964f4d5fdbfcdbe86acd280755a650b3e509 100644 (file)
@@ -195,7 +195,8 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
                         msg_Dbg( p_intf, "requested playlist play" );
                         break;
                     }
-                    playlist_Control( p_sys->p_playlist, PLAYLIST_ITEMPLAY,
+                    playlist_Control( p_sys->p_playlist, PLAYLIST_VIEWPLAY,
+                                      NULL,
                                       playlist_ItemGetById( p_sys->p_playlist,
                                       i_item ) );
                     msg_Dbg( p_intf, "requested playlist item: %i", i_item );
index 894f3509813c9c8879c9a2a043bc7043b04da8af..5d857d475c9e36c2a8d973da524c14539a03bc9a 100644 (file)
@@ -490,7 +490,8 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t  *vars,
             int i_id = E_(SSPopN)( st, vars );
             int i_ret;
 
-            i_ret = playlist_Control( p_sys->p_playlist, PLAYLIST_ITEMPLAY,
+            i_ret = playlist_Control( p_sys->p_playlist, PLAYLIST_VIEWPLAY,
+                                      NULL,
                                       playlist_ItemGetById( p_sys->p_playlist,
                                       i_id ) );
             msg_Dbg( p_intf, "requested playlist item: %i", i_id );
index 3103ae8d71965ef4cef43acbefe7c64bd2e64922..288f56cf0b364d5969bbb699957ec148b10a914f 100644 (file)
@@ -83,7 +83,7 @@ void E_(Close_Shoutcast) ( vlc_object_t * );
     if( b_play && p_playlist->status.p_item && \
                   p_playlist->status.p_item->i_children > 0 ) \
     { \
-        playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, 1242, \
+        playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,  \
                           p_playlist->status.p_item, NULL ); \
     } \
     vlc_object_release( p_playlist );
index e884ab2ae0c54716dcec3f0949a0d6423cceaaec..bc315e084f4a3e1d669b99bad82e8603c08fd55f 100644 (file)
@@ -788,7 +788,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
                     p_item = NULL;
                 }
             }
-            playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, 0, p_node, p_item );
+            playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, p_node, p_item );
         }
         vlc_object_release( p_playlist );
     }
@@ -1086,7 +1086,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
         {
             playlist_item_t *p_item;
             p_item = playlist_ItemGetByInput( p_playlist, p_input );
-            playlist_Control( p_playlist, PLAYLIST_ITEMPLAY, p_item );
+            playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, NULL, p_item );
         }
         else
         {
@@ -1133,7 +1133,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
         {
             playlist_item_t *p_item;
             p_item = playlist_ItemGetByInput( p_playlist, p_input );
-            playlist_Control( p_playlist, PLAYLIST_ITEMPLAY, p_item );
+            playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, NULL, p_item );
         }
         else
         {
index 388c02f33c754f26af612bded51077cd1c8f7656..8e6c66d07bfdfe66eaa58cf58f4d86f9a323bc3f 100644 (file)
@@ -1322,7 +1322,8 @@ static VLCWizard *_o_sharedInstance = nil;
                 {
                     /* play the first item and add the others afterwards */
                     playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input );
-                    playlist_Control( p_playlist, PLAYLIST_ITEMPLAY, p_item );
+                    playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, NULL,
+                                     p_item );
                 }
 
                 x += 1;
index 35f82e43dde996a8e6368e6dd3f0c222a6eb8ad8..101d4cf01c5974086afa85cb95da51036fcc98ff 100644 (file)
@@ -565,13 +565,13 @@ static int HandleKey( intf_thread_t *p_intf, int i_key )
                 if( p_sys->pp_plist[p_sys->i_box_plidx]->p_item->i_children
                         == -1 )
                 {
-                    playlist_Control( p_sys->p_playlist, PLAYLIST_ITEMPLAY,
+                    playlist_Control( p_sys->p_playlist, PLAYLIST_VIEWPLAY,
+                        NULL,
                         p_sys->pp_plist[p_sys->i_box_plidx]->p_item );
                 }
                 else
                 {
                     playlist_Control( p_sys->p_playlist, PLAYLIST_VIEWPLAY,
-                        p_sys->i_current_view,
                         p_sys->pp_plist[p_sys->i_box_plidx]->p_item,
                         NULL );
                 }
index 89cc9e81e12f07f97689fa3e6bb211f3a57f1aed..4a5c0652b19ba4069db66304eef42f69b106ed9c 100644 (file)
@@ -47,6 +47,10 @@ void MainInterface::init()
     QObject::connect( this, SIGNAL( inputChanged( input_thread_t * ) ),
                    main_input_manager, SLOT( setInput( input_thread_t * ) ) );
 
+    /* Connect the slider and the input manager */
+    // both ways 
+
+    /* Connect the display and the input manager */
 }
 
 MainInterface::~MainInterface()
index bf12c7538a58a4963a2334451e28654e4074abb7..c0bda1cd5a02f2220d3e76f30d9cf16e8a47070f 100644 (file)
@@ -119,8 +119,7 @@ void Playtree::action( VarTree *pItem )
 
     if( p_parent )
     {
-        playlist_Control( m_pPlaylist, PLAYLIST_VIEWPLAY, 1242,
-                          p_parent, p_item );
+        playlist_Control( m_pPlaylist, PLAYLIST_VIEWPLAY, p_parent, p_item );
     }
     vlc_mutex_unlock( &m_pPlaylist->object_lock );
 }
index 44b36baab77402f559b0cdc527a694c3da36d0fc..73ed9d2b1dd14bac7182c8b990ea04bfa522ea6d 100644 (file)
@@ -636,12 +636,16 @@ void OpenDialog::OnOk()
             }
         }
 
-        playlist_AddItem( p_playlist, p_item,
-                          PLAYLIST_APPEND, PLAYLIST_END );
 
         if( b_start )
         {
-            playlist_Control( p_playlist, PLAYLIST_ITEMPLAY , p_item );
+            playlist_AddItem( p_playlist, p_item,
+                              PLAYLIST_APPEND|PLAYLIST_GO, PLAYLIST_END );
+        }
+        else
+        {
+            playlist_AddItem( p_playlist, p_item,
+                              PLAYLIST_APPEND, PLAYLIST_END );
         }
     }
 
index 272fdcb63aa1483bc69d0dbf6d34cb7755e0970e..3971ab19b31cdb396841cf3f74b35a243fd1bd30 100644 (file)
@@ -1124,8 +1124,7 @@ void Playlist::OnActivateItem( wxTreeEvent& event )
 
     if( p_parent )
     {
-        playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, 1242,
-                          p_parent, p_item );
+        playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, p_parent, p_item );
     }
     UnlockPlaylist( p_intf->p_sys, p_playlist );
 }
@@ -1522,8 +1521,8 @@ void Playlist::OnPopupPlay( wxCommandEvent& event )
 
     if( p_popup_parent )
     {
-        playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, 1242,
-                          p_popup_parent, p_popup_item );
+        playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, p_popup_parent,
+                          p_popup_item );
     }
     UnlockPlaylist( p_intf->p_sys, p_playlist );
 }
index f8347c31722bbbbfa51de8a6ac346e521e170ccb..fb386be1c853609aca1aaf78ee047ba773ce1b39 100644 (file)
@@ -407,7 +407,7 @@ static void MotionDetect( vout_thread_t *p_vout, picture_t *p_inpic,
                     msg_Dbg( p_vout, "Area(%d) matched, going to %s\n", i_area,
                                         pp_curent_area->psz_mrl );
                     playlist_Control( p_vout->p_sys->p_playlist,
-                                        PLAYLIST_ITEMPLAY, p_item );
+                                        PLAYLIST_VIEWPLAY, NULL, p_item );
                     pp_curent_area->i_matches = 0;
                 }
             }
index 9e453490c4c1a19deea22e83dc4d23c03d8e9d33..82e62e322a65af57407fa13b7e60e0dfc6672fd2 100644 (file)
@@ -24,6 +24,7 @@
 #include <vlc/vlc.h>
 #include <vlc/input.h>
 #include "vlc_playlist.h"
+#include <assert.h>
 
 /*****************************************************************************
  * Local prototypes
@@ -96,31 +97,15 @@ int PlaylistVAControl( playlist_t * p_playlist, int i_query, va_list args )
         p_playlist->request.p_item = NULL;
         break;
 
-    case PLAYLIST_ITEMPLAY:
-        p_item = (playlist_item_t *)va_arg( args, playlist_item_t * );
-        if ( p_item == NULL || p_item->p_input->psz_uri == NULL )
-            return VLC_EGENERIC;
-        p_playlist->request.i_status = PLAYLIST_RUNNING;
-        p_playlist->request.i_skip = 0;
-        p_playlist->request.b_request = VLC_TRUE;
-        p_playlist->request.p_item = p_item;
-        p_playlist->request.p_node = p_playlist->status.p_node;
-        break;
-
+    // Node can be null, it will keep the same. Use with care ...
+    // Item null = take the first child of node
     case PLAYLIST_VIEWPLAY:
-        i_view = (int) va_arg( args, playlist_item_t *);
         p_node = (playlist_item_t *)va_arg( args, playlist_item_t * );
         p_item = (playlist_item_t *)va_arg( args, playlist_item_t * );
         if ( p_node == NULL )
         {
             p_node = p_playlist->status.p_node;
-            if( !p_node )
-            {
-                p_playlist->status.i_status = PLAYLIST_STOPPED;
-                p_playlist->request.b_request = VLC_TRUE;
-                msg_Err( p_playlist, "null node" );
-                return VLC_SUCCESS;
-            }
+            assert( p_node );
         }
         p_playlist->request.i_status = PLAYLIST_RUNNING;
         p_playlist->request.i_skip = 0;
@@ -130,23 +115,27 @@ int PlaylistVAControl( playlist_t * p_playlist, int i_query, va_list args )
         break;
 
     case PLAYLIST_PLAY:
-        p_playlist->request.i_status = PLAYLIST_RUNNING;
-        p_playlist->request.b_request = VLC_TRUE;
-
         if( p_playlist->p_input )
         {
             val.i_int = PLAYING_S;
             var_Set( p_playlist->p_input, "state", val );
             break;
         }
-        p_playlist->request.p_node = p_playlist->status.p_node;
-        p_playlist->request.p_item = p_playlist->status.p_item;
-        p_playlist->request.i_skip = 0;
+        else
+        {
+            p_playlist->request.i_status = PLAYLIST_RUNNING;
+            p_playlist->request.b_request = VLC_TRUE;
+            p_playlist->request.p_node = p_playlist->status.p_node;
+            p_playlist->request.p_item = p_playlist->status.p_item;
+            p_playlist->request.i_skip = 0;
+        }
         break;
 
     case PLAYLIST_AUTOPLAY:
+        // AUTOPLAY is an ugly hack for initial status.
+        // Hopefully it will disappear
         p_playlist->status.i_status = PLAYLIST_RUNNING;
-        p_playlist->status.p_node = p_playlist->p_local_category;
+        p_playlist->request.p_node = p_playlist->status.p_node;
         p_playlist->request.b_request = VLC_FALSE;
         break;
 
@@ -260,7 +249,6 @@ playlist_item_t * playlist_NextItem( playlist_t *p_playlist )
     vlc_bool_t b_playstop = var_GetBool( p_playlist, "play-and-stop" );
 
     /* Handle quickly a few special cases */
-
     /* No items to play */
     if( p_playlist->i_size == 0 )
     {
@@ -341,14 +329,12 @@ playlist_item_t * playlist_NextItem( playlist_t *p_playlist )
         p_new = p_playlist->request.p_item;
         i_skip = p_playlist->request.i_skip;
 
-        p_playlist->status.p_node = p_playlist->request.p_node;
+        if( p_playlist->request.p_node )
+            p_playlist->status.p_node = p_playlist->request.p_node;
 
-        /* If we are asked for a node, take its first item */
-        if( i_skip == 0 &&
-              ( p_new == NULL || p_new->i_children != -1 ) )
-        {
+        /* If we are asked for a node, dont take it */
+        if( i_skip == 0 && ( p_new == NULL || p_new->i_children != -1 ) )
             i_skip++;
-        }
 
         if( i_skip > 0 )
         {
index 120ef099869fdc05c685fcb0a3f6c41a149ffff4..c54014a9c8ee85783924972ced7361d43bf211a1 100644 (file)
@@ -354,6 +354,8 @@ playlist_item_t *playlist_GetNextLeaf( playlist_t *p_playlist,
 {
     playlist_item_t *p_next;
 
+    assert( p_root && p_root->i_children != -1 );
+
 #ifdef PLAYLIST_DEBUG
     if( p_item != NULL )
         msg_Dbg( p_playlist, "finding next of %s within %s",
@@ -363,7 +365,6 @@ playlist_item_t *playlist_GetNextLeaf( playlist_t *p_playlist,
                          p_root->p_input->psz_name );
 #endif
 
-    assert( p_root && p_root->i_children != -1 );
 
     /* Now, walk the tree until we find a suitable next item */
     p_next = p_item;