]> git.sesse.net Git - vlc/commitdiff
* Playlist :
authorClément Stenac <zorglub@videolan.org>
Wed, 13 Apr 2005 17:43:12 +0000 (17:43 +0000)
committerClément Stenac <zorglub@videolan.org>
Wed, 13 Apr 2005 17:43:12 +0000 (17:43 +0000)
  - fix crash when deleting current item
  - SAP: don't store pointers
  - don't pass pointers to interface in item-appended
  - remove VIEW_SIMPLE that was confusing and bug-generating

* wx:
  - Fix open layout
  - Fix slider behaviour, patch by Greg Hazel

12 files changed:
include/vlc_playlist.h
modules/gui/macosx/playlist.m
modules/gui/ncurses.c
modules/gui/wxwindows/interface.cpp
modules/gui/wxwindows/open.cpp
modules/gui/wxwindows/playlist.cpp
modules/gui/wxwindows/timer.cpp
modules/gui/wxwindows/wxwindows.h
modules/services_discovery/sap.c
src/playlist/item-ext.c
src/playlist/playlist.c
src/playlist/view.c

index e46e92771bbb401a6d320acacd1b1a3f1f2fd548..7c65e5543bbf11cecaee865c9e1f6732536ab85c 100644 (file)
@@ -84,6 +84,7 @@ struct playlist_item_t
 #define PLAYLIST_ENA_FLAG       0x04     /**< Is it enabled ? */
 #define PLAYLIST_DEL_FLAG       0x08     /**< Autodelete ? */
 #define PLAYLIST_RO_FLAG        0x10    /**< Write-enabled ? */
+#define PLAYLIST_REMOVE_FLAG    0x20    /**< Remove this item at the end */
 
 /**
  * playlist view
@@ -215,8 +216,8 @@ struct playlist_t
 /* Helper to add an item */
 struct playlist_add_t
 {
-    playlist_item_t *p_node;
-    playlist_item_t *p_item;
+    int i_node;
+    int i_item;
     int i_view;
     int i_position;
 };
index 3fe224f9c3b0c62171e9038b01f01bf0d6fdc962..4766847d3eaa2da6f22fee2b46d31e846d42c823 100644 (file)
                                         FIND_ANYWHERE );
 
     int i_index;
-    i_current_view = VIEW_SIMPLE;
+    i_current_view = VIEW_CATEGORY;
     playlist_ViewUpdate( p_playlist, i_current_view );
 
     [o_outline_view setTarget: self];
index bdc5d3439f263d14909ffc11507416839cbb53e5..ee9e3302e67109985325991fcd79f509d996473f 100644 (file)
@@ -224,7 +224,7 @@ static int Open( vlc_object_t *p_this )
     var_Set( p_intf->p_vlc, "verbose", val );
 
     /* Set defaul playlist view */
-    p_sys->i_current_view = VIEW_SIMPLE;
+    p_sys->i_current_view = VIEW_CATEGORY;
     p_sys->pp_plist = NULL;
     p_sys->i_plist_entries = 0;
     p_sys->b_need_update = VLC_FALSE;
@@ -439,14 +439,11 @@ static int HandleKey( intf_thread_t *p_intf, int i_key )
             case 'v':
                 switch( p_sys->i_current_view )
                 {
-                    case VIEW_SIMPLE:
-                        p_sys->i_current_view = VIEW_CATEGORY;
-                        break;
                     case VIEW_CATEGORY:
                         p_sys->i_current_view = VIEW_ALL;
                         break;
                     default:
-                        p_sys->i_current_view = VIEW_SIMPLE;
+                        p_sys->i_current_view = VIEW_CATEGORY;
                 }
                 PlaylistRebuild( p_intf );
                 FindIndex( p_intf );
index b5f6551fec60212ec85223e1e50dc60231cb4a3d..1abe88478ad8ec6e332a3d1140f00eb4c30fcb76 100644 (file)
@@ -212,6 +212,7 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
     EVT_COMMAND(1, wxEVT_INTF, Interface::OnControlEvent)
 
     EVT_TIMER(ID_CONTROLS_TIMER, Interface::OnControlsTimer)
+    EVT_TIMER(ID_SLIDER_TIMER, Interface::OnSliderTimer)
 END_EVENT_TABLE()
 
 /*****************************************************************************
@@ -303,6 +304,7 @@ Interface::Interface( intf_thread_t *_p_intf, long style ):
     SetupHotkeys();
 
     m_controls_timer.SetOwner(this, ID_CONTROLS_TIMER);
+    m_slider_timer.SetOwner(this, ID_SLIDER_TIMER);
 
     /* Start timer */
     timer = new Timer( p_intf, this );
@@ -677,6 +679,73 @@ void Interface::SetupHotkeys()
     delete [] p_entries;
 }
 
+void Interface::HideSlider(bool layout)
+{
+  ShowSlider(false, layout);
+}
+
+void Interface::ShowSlider(bool show, bool layout)
+{
+  int size_to_video = config_GetInt( p_intf, "wxwin-size-to-video" );
+
+  if (show)
+  {
+    //prevent the hide timers from hiding it now
+    m_slider_timer.Stop();
+    m_controls_timer.Stop();
+
+    slider_frame->Show();
+    frame_sizer->Show( slider_frame );
+  }
+  else
+  {
+    slider_frame->Hide();
+    frame_sizer->Hide( slider_frame );
+  }
+
+  if (layout)
+  {
+    frame_sizer->Layout();
+    if (size_to_video)
+    {
+      frame_sizer->Fit( this );
+    }
+  }
+}
+
+void Interface::HideDiscFrame(bool layout)
+{
+  ShowDiscFrame(false, layout);
+}
+
+void Interface::ShowDiscFrame(bool show, bool layout)
+{
+  int size_to_video = config_GetInt( p_intf, "wxwin-size-to-video" );
+
+  if (show)
+  {
+    //prevent the hide timer from hiding it now
+    m_controls_timer.Stop();
+
+    disc_frame->Show();
+    slider_sizer->Show( disc_frame );
+  }
+  else
+  {
+    disc_frame->Hide();
+    slider_sizer->Hide( disc_frame );
+  }
+
+  if (layout)
+  {
+    slider_sizer->Layout();
+    if (size_to_video)
+    {
+      slider_sizer->Fit( slider_frame );
+    }
+  }
+}
+
 /*****************************************************************************
  * Event Handlers.
  *****************************************************************************/
@@ -686,21 +755,20 @@ void Interface::OnControlsTimer(wxTimerEvent& WXUNUSED(event))
   int size_to_video = config_GetInt( p_intf, "wxwin-size-to-video" );
   
   /* Hide slider and Disc Buttons */
-  disc_frame->Hide();
-  slider_sizer->Hide( disc_frame );
+  //postpone layout, we'll do it ourselves
+  HideDiscFrame(false);
+  HideSlider(false);
+
   slider_sizer->Layout();
   if (size_to_video)
   {
     slider_sizer->Fit( slider_frame );
   }
+}
 
-  slider_frame->Hide();
-  frame_sizer->Hide( slider_frame );
-  frame_sizer->Layout();
-  if (size_to_video)
+void Interface::OnSliderTimer(wxTimerEvent& WXUNUSED(event))
   {
-    frame_sizer->Fit( this );
-  }
+  HideSlider();
 }
 
 void Interface::OnMenuOpen(wxMenuEvent& event)
index 05084873bc90bf7fc2626b9a01ce8c77ded7c774..8d356555bb4fea161d65f6d94ee1df85fc53a347 100644 (file)
@@ -542,6 +542,8 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
     panel_sizer->Add( label, 0, wxEXPAND | wxALL, 5 );
 #if (!wxCHECK_VERSION(2,5,0))
     panel_sizer->Add( notebook_sizer, 1, wxEXPAND | wxALL, 5 );
+#else
+    panel_sizer->Add( notebook, 1, wxEXPAND | wxALL, 5 );
 #endif
     panel_sizer->Add( common_opt_sizer, 0, wxALIGN_LEFT | wxALL, 5 );
     panel_sizer->Add( static_line, 0, wxEXPAND | wxALL, 5 );
index 2d155e3c1355f94603e968d39ced4131b623bce5..9d03671bab88756ced838872120b62571164f01a 100644 (file)
@@ -216,7 +216,7 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
     p_view_menu = NULL;
     p_sd_menu = SDMenu();
 
-    i_current_view = VIEW_SIMPLE;
+    i_current_view = VIEW_CATEGORY;
     b_changed_view = VLC_FALSE;
 
     i_title_sorted = 0;
@@ -540,26 +540,31 @@ void Playlist::UpdateTreeItem( wxTreeItemId item )
 void Playlist::AppendItem( wxCommandEvent& event )
 {
     playlist_add_t *p_add = (playlist_add_t *)event.GetClientData();
+    playlist_item_t *p_item = NULL;
 
     wxTreeItemId item,node;
 
-    if( p_add->i_view != i_current_view || !p_add->p_node )
+    if( p_add->i_view != i_current_view )
     {
         goto update;
     }
 
-    node = FindItem( treectrl->GetRootItem(), p_add->p_node->input.i_id );
+    node = FindItem( treectrl->GetRootItem(), p_add->i_node );
     if( !node.IsOk() )
     {
         goto update;
     }
 
+    p_item = playlist_ItemGetById( p_playlist, p_add->i_item );
+    if( !p_item )
+        goto update;
+
     item = treectrl->AppendItem( node,
-                                 wxL2U( p_add->p_item->input.psz_name ), -1,-1,
-                                 new PlaylistItem( p_add->p_item ) );
-    treectrl->SetItemImage( item, p_add->p_item->input.i_type );
+                                 wxL2U( p_item->input.psz_name ), -1,-1,
+                                 new PlaylistItem( p_item ) );
+    treectrl->SetItemImage( item, p_item->input.i_type );
 
-    if( item.IsOk() && p_add->p_item->i_children == -1 )
+    if( item.IsOk() && p_item->i_children == -1 )
     {
         UpdateTreeItem( item );
     }
@@ -1175,10 +1180,6 @@ wxMenu * Playlist::ViewMenu()
     /* FIXME : have a list of "should have" views */
     p_view_menu->Append( FirstView_Event + VIEW_CATEGORY,
                            wxU(_("Normal") ) );
-/*    p_view_menu->Append( FirstView_Event + VIEW_SIMPLE,
-                           wxU(_("Manually added") ) );
-    p_view_menu->Append( FirstView_Event + VIEW_ALL,
-                           wxU(_("All items, unsorted") ) ); */
     p_view_menu->Append( FirstView_Event + VIEW_S_AUTHOR,
                            wxU(_("Sorted by artist") ) );
 
index ad8ce193c4bd69055db2a70308eaef820655c7c0..1428a549c6abe7a190036a00bea54846aa53f70c 100644 (file)
@@ -132,8 +132,6 @@ void Timer::Notify()
         if( p_intf->p_sys->p_input )
         {
             p_main_interface->slider->SetValue( 0 );
-            b_slider_shown = VLC_FALSE;
-            b_disc_shown = VLC_FALSE;
 
             char *psz_now_playing = vlc_input_item_GetInfo(
                 p_intf->p_sys->p_input->input.p_item,
@@ -221,9 +219,8 @@ void Timer::Notify()
             var_Get( p_input, "position", &pos );
 
             var_Change( p_input, "title", VLC_VAR_CHOICESCOUNT, &val, NULL );
-            if( val.i_int > 0 && !b_disc_shown )
+            if( val.i_int > 0 && !p_main_interface->disc_menu_button->IsShown() )
             {
-                b_disc_shown = VLC_TRUE;
                 vlc_value_t val;
 
                     #define HELP_MENU N_("Menu")
@@ -262,47 +259,21 @@ void Timer::Notify()
                         wxU(_( HELP_NTR ) ) );
                 }
 
-                p_main_interface->disc_frame->Show();
-                p_main_interface->slider_sizer->Show(
-                    p_main_interface->disc_frame );
+                p_main_interface->ShowDiscFrame();
             }
 
-                if( pos.f_float > 0.0 )
-                {
-                    /* Done like this, as it's the only way to know if the */
-                    /* slider has to be displayed */
-
-                if( !b_slider_shown )
-                {
-                  b_slider_shown = VLC_TRUE;
-                    p_main_interface->slider_frame->Show();
-                    p_main_interface->frame_sizer->Show(
-                        p_main_interface->slider_frame );
 
-                    p_main_interface->frame_sizer->Layout();
-                  if (size_to_video)
+            if( pos.f_float > 0.0 )
                   {
-                    p_main_interface->frame_sizer->Fit( p_main_interface );
-                }
-            }
+                /* Show the slider if it's position is significant */
+                p_main_interface->ShowSlider();
             }
             else
             {
-                if( b_slider_shown )
-                {
-                  p_main_interface->slider_frame->Hide();
-                  p_main_interface->frame_sizer->Hide(
-                      p_main_interface->slider_frame );
-
-                  p_main_interface->frame_sizer->Layout();
-                  if (size_to_video)
-                  {
-                    p_main_interface->frame_sizer->Fit( p_main_interface );
-                  }
-                }
+                p_main_interface->m_slider_timer.Start(1000, wxTIMER_ONE_SHOT);
             }
 
-            if( p_intf->p_sys->b_playing && b_slider_shown )
+            if( p_intf->p_sys->b_playing && p_main_interface->slider_frame->IsShown() )
             {
                 /* Update the slider if the user isn't dragging it. */
                 if( p_intf->p_sys->b_slider_free )
@@ -337,16 +308,12 @@ void Timer::Notify()
             }
 #if 0
         vlc_mutex_lock( &p_input->stream.stream_lock );
-            if( p_intf->p_sys->p_input->stream.b_seekable && !b_slider_shown )
+            if( p_intf->p_sys->p_input->stream.b_seekable &&
+                !p_main_interface->slider_frame->IsShown() )
             {
                 /* Done like this because b_seekable is set slightly after
                  * the new input object is available. */
-                b_slider_shown = VLC_TRUE;
-                p_main_interface->slider_frame->Show();
-                p_main_interface->frame_sizer->Show(
-                    p_main_interface->slider_frame );
-                p_main_interface->frame_sizer->Layout();
-                p_main_interface->frame_sizer->Fit( p_main_interface );
+                p_main_interface->ShowSlider();
             }
             if( p_input->stream.b_seekable && p_intf->p_sys->b_playing )
             {
index bad3b2877a2d2227e69ce084a231d1f45d8c3eed..8782b765265c50347ff06552be054db9e515afb4 100644 (file)
@@ -89,6 +89,7 @@ DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 );
 
 enum{
   ID_CONTROLS_TIMER,
+  ID_SLIDER_TIMER,
 };
 
 class DialogsProvider;
@@ -184,13 +185,14 @@ public:
     virtual void Notify();
 
 private:
+    //use wxWindow::IsShown instead
+    //vlc_bool_t b_slider_shown;
+    //vlc_bool_t b_disc_shown;
     intf_thread_t *p_intf;
     Interface *p_main_interface;
     vlc_bool_t b_init;
     int i_old_playing_status;
     int i_old_rate;
-    vlc_bool_t b_slider_shown;
-    vlc_bool_t b_disc_shown;
 };
 
 
@@ -333,11 +335,17 @@ public:
     wxBoxSizer  *frame_sizer;
     wxStatusBar *statusbar;
 
+    void HideSlider(bool layout = true);
+    void ShowSlider(bool show = true, bool layout = true);
+
     wxSlider    *slider;
     wxWindow    *slider_frame;
     wxBoxSizer  *slider_sizer;
     wxPanel     *extra_frame;
 
+    void HideDiscFrame(bool layout = true);
+    void ShowDiscFrame(bool show = true, bool layout = true);
+
     wxPanel         *disc_frame;
     wxBoxSizer      *disc_sizer;
     wxBitmapButton  *disc_menu_button;
@@ -356,6 +364,7 @@ public:
 #endif
 
     wxTimer m_controls_timer;
+    wxTimer m_slider_timer;
 
 private:
     void SetupHotkeys();
@@ -367,6 +376,7 @@ private:
 
     /* Event handlers (these functions should _not_ be virtual) */
     void OnControlsTimer(wxTimerEvent& WXUNUSED(event));
+    void OnSliderTimer(wxTimerEvent& WXUNUSED(event));
 
     void OnExit( wxCommandEvent& event );
     void OnAbout( wxCommandEvent& event );
index c8158a6e65b19b8ed6db329780e00aeec23455f1..ce8fb7a25d550c1fb721578cb0cd3762b60fec74 100644 (file)
@@ -191,7 +191,8 @@ struct sap_announce_t
     /* SAP annnounces must only contain one SDP */
     sdp_t       *p_sdp;
 
-    playlist_item_t *p_item;
+    int i_item_id;
+//    playlist_item_t *p_item;
 };
 
 struct services_discovery_sys_t
@@ -527,18 +528,23 @@ static void Run( services_discovery_t *p_sd )
             if( mdate() - p_sd->p_sys->pp_announces[i]->i_last > i_timeout )
             {
                 struct sap_announce_t *p_announce;
+                playlist_item_t * p_item;
                 p_announce = p_sd->p_sys->pp_announces[i];
 
-                msg_Dbg( p_sd, "Time out for %s, deleting (%i/%i)",
-                        p_announce->p_item->input.psz_name,
-                        i , p_sd->p_sys->i_announces );
-
                 /* Remove the playlist item */
                 p_playlist = vlc_object_find( p_sd, VLC_OBJECT_PLAYLIST,
                               FIND_ANYWHERE );
                 if( p_playlist )
                 {
-                    playlist_Delete( p_playlist, p_announce->p_item->input.i_id );
+                    p_item = playlist_ItemGetById( p_playlist,
+                                                   p_announce->i_item_id );
+                    if( !p_item ) continue;
+
+                    msg_Dbg( p_sd, "Time out for %s, deleting (%i/%i)",
+                                   p_item->input.psz_name,
+                                   i , p_sd->p_sys->i_announces );
+
+                    playlist_Delete( p_playlist, p_announce->i_item_id );
                     vlc_object_release( p_playlist );
                 }
 
@@ -802,7 +808,7 @@ sap_announce_t *CreateAnnounce( services_discovery_t *p_sd, uint16_t i_hash,
     p_sap->i_last = mdate();
     p_sap->i_hash = i_hash;
     p_sap->p_sdp = p_sdp;
-    p_sap->p_item = NULL;
+    p_sap->i_item_id = -1;
 
     /* Create the playlist item here */
     p_item = playlist_ItemNew( p_sd, p_sap->p_sdp->psz_uri, psz_value );
@@ -877,7 +883,7 @@ sap_announce_t *CreateAnnounce( services_discovery_t *p_sd, uint16_t i_hash,
 
     vlc_object_release( p_playlist );
 
-    p_sap->p_item = p_item;
+    p_sap->i_item_id = p_item->input.i_id;
 
     TAB_APPEND( p_sd->p_sys->i_announces,
                 p_sd->p_sys->pp_announces, p_sap );
@@ -1432,9 +1438,9 @@ static int RemoveAnnounce( services_discovery_t *p_sd,
         return VLC_EGENERIC;
     }
 
-    if( p_announce->p_item )
+    if( p_announce->i_item_id > -1 )
     {
-        playlist_LockDelete( p_playlist, p_announce->p_item->input.i_id );
+        playlist_LockDelete( p_playlist, p_announce->i_item_id );
     }
 
     for( i = 0; i< p_sd->p_sys->i_announces; i++)
index 99199c9865365d5cb9199f5bcc7730347ee4b6ef..880e659c469d1d9888fc664a491bc73334f73faf 100644 (file)
@@ -200,8 +200,8 @@ int playlist_AddItem( playlist_t *p_playlist, playlist_item_t *p_item,
         {
             playlist_NodeAppend( p_playlist, VIEW_CATEGORY, p_item,
                                  p_playlist->p_general );
-            p_add->p_item = p_item;
-            p_add->p_node = p_playlist->p_general;
+            p_add->i_item = p_item->input.i_id;
+            p_add->i_node = p_playlist->p_general->input.i_id;
             p_add->i_view = VIEW_CATEGORY;
             val.p_address = p_add;
             var_Set( p_playlist, "item-append", val );
@@ -216,26 +216,6 @@ int playlist_AddItem( playlist_t *p_playlist, playlist_item_t *p_item,
         p_view = playlist_ViewFind( p_playlist, VIEW_ALL );
         playlist_ItemAddParent( p_item, VIEW_ALL, p_view->p_root );
 
-        /* Also add the item to the "simple" view */
-        p_view = playlist_ViewFind( p_playlist, VIEW_SIMPLE );
-
-        if( b_end == VLC_TRUE )
-        {
-            playlist_NodeAppend( p_playlist, VIEW_SIMPLE,p_item,
-                                  p_view->p_root );
-            p_add->p_item = p_item;
-            p_add->p_node = p_view->p_root;
-            p_add->i_view = VIEW_SIMPLE;
-            val.p_address = p_add;
-            var_Set( p_playlist, "item-append", val );
-        }
-        else
-        {
-            playlist_NodeInsert( p_playlist, VIEW_SIMPLE,p_item,
-                                  p_view->p_root, i_pos );
-        }
-
-
         /* FIXME : Update sorted views */
 
         if( p_playlist->i_index >= i_pos )
@@ -252,7 +232,7 @@ int playlist_AddItem( playlist_t *p_playlist, playlist_item_t *p_item,
     {
         p_playlist->request.b_request = VLC_TRUE;
         /* FIXME ... */
-        p_playlist->request.i_view = VIEW_SIMPLE;
+        p_playlist->request.i_view = VIEW_CATEGORY;
         p_playlist->request.p_node = p_view->p_root;
         p_playlist->request.p_item = p_item;
 
@@ -356,8 +336,8 @@ int playlist_NodeAddItem( playlist_t *p_playlist, playlist_item_t *p_item,
     /* TODO: Handle modes */
     playlist_NodeAppend( p_playlist, i_view, p_item, p_parent );
 
-    p_add->p_item = p_item;
-    p_add->p_node = p_parent;
+    p_add->i_item = p_item->input.i_id;
+    p_add->i_node = p_parent->input.i_id;
     p_add->i_view = i_view;
     val.p_address = p_add;
     var_Set( p_playlist, "item-append", val );
@@ -480,7 +460,6 @@ playlist_item_t * playlist_ItemGetById( playlist_t * p_playlist , int i_id )
     {
         return p_playlist->pp_all_items[i];
     }
-        
     return NULL;
 }
 
@@ -643,6 +622,7 @@ int playlist_Replace( playlist_t *p_playlist, playlist_item_t *p_olditem,
 int playlist_Delete( playlist_t * p_playlist, int i_id )
 {
     int i, i_top, i_bottom;
+    vlc_bool_t b_flag = VLC_FALSE;
 
     playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_id );
 
@@ -672,14 +652,15 @@ int playlist_Delete( playlist_t * p_playlist, int i_id )
         REMOVE_ELEM( p_playlist->pp_all_items, p_playlist->i_all_size, i );
     }
 
-    
     /* Check if it is the current item */
     if( p_playlist->status.p_item == p_item )
     {
         /* Hack we don't call playlist_Control for lock reasons */
         p_playlist->status.i_status = PLAYLIST_STOPPED;
         p_playlist->request.b_request = VLC_TRUE;
-        p_playlist->status.p_item = NULL;
+//        p_playlist->status.p_item = NULL;
+        msg_Info( p_playlist, "stopping playback" );
+        b_flag = VLC_TRUE;
     }
 
     msg_Info( p_playlist, "deleting playlist item `%s'",
@@ -698,7 +679,10 @@ int playlist_Delete( playlist_t * p_playlist, int i_id )
 
     /* TODO : Update views */
 
-    playlist_ItemDelete( p_item );
+    if( b_flag == VLC_FALSE )
+        playlist_ItemDelete( p_item );
+    else
+        p_item->i_flags |= PLAYLIST_REMOVE_FLAG;
 
     return VLC_SUCCESS;
 }
index 0188a6e47d0f470650c6ef17fa0cb09fd491b5c0..de12ab234771ff4b1363670a329b92b61b2ec88c 100644 (file)
@@ -123,7 +123,6 @@ playlist_t * __playlist_Create ( vlc_object_t *p_parent )
     p_playlist->pp_all_items = 0;
 
     playlist_ViewInsert( p_playlist, VIEW_CATEGORY, TITLE_CATEGORY );
-    playlist_ViewInsert( p_playlist, VIEW_SIMPLE, TITLE_SIMPLE );
     playlist_ViewInsert( p_playlist, VIEW_ALL, TITLE_ALL );
 
     p_view = playlist_ViewFind( p_playlist, VIEW_CATEGORY );
@@ -135,8 +134,8 @@ playlist_t * __playlist_Create ( vlc_object_t *p_parent )
     /* Set startup status
      * We set to simple view on startup for interfaces that don't do
      * anything */
-    p_view = playlist_ViewFind( p_playlist, VIEW_SIMPLE );
-    p_playlist->status.i_view = VIEW_SIMPLE;
+    p_view = playlist_ViewFind( p_playlist, VIEW_CATEGORY );
+    p_playlist->status.i_view = VIEW_CATEGORY;
     p_playlist->status.p_item = NULL;
     p_playlist->status.p_node = p_view->p_root;
     p_playlist->request.b_request = VLC_FALSE;
@@ -544,6 +543,13 @@ static void RunThread ( playlist_t *p_playlist )
                 i_vout_destroyed_date = 0;
                 i_sout_destroyed_date = 0;
 
+                if( p_playlist->status.p_item->i_flags
+                    & PLAYLIST_REMOVE_FLAG )
+                {
+                     playlist_ItemDelete( p_item );
+                     p_playlist->status.p_item = NULL;
+                }
+
                 continue;
             }
             /* This input is dying, let him do */
index fc0f81f0a2c996bbdeef03b80db64513faa8f5cc..b42bbdd4048ce769e3eff1fea2bee65a1f2cdd16 100644 (file)
@@ -309,8 +309,8 @@ playlist_item_t * playlist_NodeCreate( playlist_t *p_playlist, int i_view,
         playlist_NodeAppend( p_playlist, i_view, p_item, p_parent );
     }
 
-    p_add->p_node = p_parent;
-    p_add->p_item = p_item;
+    p_add->i_node = p_parent ? p_parent->input.i_id : -1;
+    p_add->i_item = p_item->input.i_id;
     p_add->i_view = i_view;
     val.p_address = p_add;
     var_Set( p_playlist, "item-append", val);
@@ -419,7 +419,6 @@ int playlist_NodeDelete( playlist_t *p_playlist, playlist_item_t *p_root,
         {
             REMOVE_ELEM( p_playlist->pp_all_items, p_playlist->i_all_size, i );
         }
-        
         playlist_ItemDelete( p_root );
     }
     return VLC_SUCCESS;