[vlc-devel] [PATCH 39/40] playlist: remove mode parameter from playlist_NodeAddInput()

RĂ©mi Denis-Courmont remi at remlab.net
Sun May 14 17:46:09 CEST 2017


---
 include/vlc_playlist.h                |  2 +-
 modules/control/dbus/dbus_tracklist.c |  2 +-
 modules/gui/macosx/VLCPlaylist.m      |  4 ++--
 modules/gui/ncurses.c                 |  2 +-
 modules/gui/skins2/vars/playtree.cpp  |  2 +-
 src/interface/interface.c             |  2 +-
 src/playlist/item.c                   | 30 +++++++++---------------------
 src/playlist/services_discovery.c     |  2 +-
 8 files changed, 17 insertions(+), 29 deletions(-)

diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h
index a487cdfd62..d4176542f8 100644
--- a/include/vlc_playlist.h
+++ b/include/vlc_playlist.h
@@ -370,7 +370,7 @@ VLC_API int playlist_ServicesDiscoveryControl( playlist_t *, const char *, int,
 VLC_API int playlist_Add( playlist_t *, const char *, bool );
 VLC_API int playlist_AddExt( playlist_t *, const char *, const char *, bool, int, const char *const *, unsigned, bool );
 VLC_API int playlist_AddInput( playlist_t *, input_item_t *, bool, bool );
-VLC_API playlist_item_t * playlist_NodeAddInput( playlist_t *, input_item_t *, playlist_item_t *, int, int );
+VLC_API playlist_item_t * playlist_NodeAddInput( playlist_t *, input_item_t *, playlist_item_t *, int );
 VLC_API int playlist_NodeAddCopy( playlist_t *, playlist_item_t *, playlist_item_t *, int );
 
 /********************************** Item search *************************/
diff --git a/modules/control/dbus/dbus_tracklist.c b/modules/control/dbus/dbus_tracklist.c
index aa3b6ba037..6dedc1b750 100644
--- a/modules/control/dbus/dbus_tracklist.c
+++ b/modules/control/dbus/dbus_tracklist.c
@@ -109,7 +109,7 @@ DBUS_METHOD( AddTrack )
         }
     }
 
-    plitem = playlist_NodeAddInput( p_playlist, item, node, 0, i_pos );
+    plitem = playlist_NodeAddInput( p_playlist, item, node, i_pos );
     if( likely(plitem != NULL) && b_play )
         playlist_ViewPlay( p_playlist, NULL, plitem );
 
diff --git a/modules/gui/macosx/VLCPlaylist.m b/modules/gui/macosx/VLCPlaylist.m
index d6e89b9ceb..80a7297112 100644
--- a/modules/gui/macosx/VLCPlaylist.m
+++ b/modules/gui/macosx/VLCPlaylist.m
@@ -639,8 +639,8 @@
             continue;
 
         int i_pos = (i_position == -1) ? PLAYLIST_END : i_position + i_current_offset++;
-        playlist_item_t *p_item = playlist_NodeAddInput(p_playlist, p_input, p_parent,
-                                                        0, i_pos);
+        playlist_item_t *p_item = playlist_NodeAddInput(p_playlist, p_input,
+                                                        p_parent, i_pos);
         if (!p_item)
             continue;
 
diff --git a/modules/gui/ncurses.c b/modules/gui/ncurses.c
index 5c4d893303..179072549d 100644
--- a/modules/gui/ncurses.c
+++ b/modules/gui/ncurses.c
@@ -1312,7 +1312,7 @@ static void AddItem(intf_thread_t *intf, const char *path)
     if (node == NULL)
         node = playlist->p_playing;
 
-    playlist_NodeAddInput(playlist, item, node, 0, PLAYLIST_END);
+    playlist_NodeAddInput(playlist, item, node, PLAYLIST_END);
     playlist_Unlock(playlist);
 
     input_item_Release(item);
diff --git a/modules/gui/skins2/vars/playtree.cpp b/modules/gui/skins2/vars/playtree.cpp
index 08f5a0d362..9ef679e06e 100644
--- a/modules/gui/skins2/vars/playtree.cpp
+++ b/modules/gui/skins2/vars/playtree.cpp
@@ -338,7 +338,7 @@ void Playtree::insertItems( VarTree& elem, const std::list<std::string>& files,
         if( pItem == NULL)
             continue;
 
-        pPlItem = playlist_NodeAddInput( m_pPlaylist, pItem, p_node, 0, i_pos );
+        pPlItem = playlist_NodeAddInput( m_pPlaylist, pItem, p_node, i_pos );
 
         if( likely(pPlItem != NULL) && first )
         {
diff --git a/src/interface/interface.c b/src/interface/interface.c
index 6306c04a99..a100e048e4 100644
--- a/src/interface/interface.c
+++ b/src/interface/interface.c
@@ -177,7 +177,7 @@ int intf_InsertItem(libvlc_int_t *libvlc, const char *mrl, unsigned optc,
     if (input_item_AddOptions(item, optc, optv, flags) == VLC_SUCCESS)
     {
         playlist_Lock(playlist);
-        if (playlist_NodeAddInput(playlist, item, playlist->p_playing, 0,
+        if (playlist_NodeAddInput(playlist, item, playlist->p_playing,
                                   0) != NULL)
             ret = 0;
         playlist_Unlock(playlist);
diff --git a/src/playlist/item.c b/src/playlist/item.c
index 6365169d65..33f3d8bea5 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -36,8 +36,7 @@
 #include <vlc_rand.h>
 #include "playlist_internal.h"
 
-static void GoAndPreparse( playlist_t *p_playlist, int i_mode,
-                           playlist_item_t * );
+static void playlist_Preparse( playlist_t *, playlist_item_t * );
 static void ChangeToNode( playlist_t *p_playlist, playlist_item_t *p_item );
 
 static int RecursiveAddIntoParent (
@@ -483,7 +482,7 @@ int playlist_AddInput( playlist_t* p_playlist, input_item_t *p_input,
     item = b_playlist ? p_playlist->p_playing
                       : p_playlist->p_media_library;
 
-    item = playlist_NodeAddInput( p_playlist, p_input, item, 0, PLAYLIST_END );
+    item = playlist_NodeAddInput( p_playlist, p_input, item, PLAYLIST_END );
 
     if( likely(item != NULL) && play_now )
         playlist_ViewPlay( p_playlist, NULL, item );
@@ -497,7 +496,6 @@ int playlist_AddInput( playlist_t* p_playlist, input_item_t *p_input,
  * \param p_playlist the playlist to add into
  * \param p_input the input item to add
  * \param p_parent the parent item to add into
- * \param i_mode the mode used when addin
  * \param i_pos the position in the playlist where to add. If this is
  *        PLAYLIST_END the item will be added at the end of the playlist
  *        regardless of its size
@@ -505,8 +503,7 @@ int playlist_AddInput( playlist_t* p_playlist, input_item_t *p_input,
  */
 playlist_item_t * playlist_NodeAddInput( playlist_t *p_playlist,
                                          input_item_t *p_input,
-                                         playlist_item_t *p_parent,
-                                         int i_mode, int i_pos )
+                                         playlist_item_t *p_parent, int i_pos )
 {
     PL_ASSERT_LOCKED;
 
@@ -521,8 +518,8 @@ playlist_item_t * playlist_NodeAddInput( playlist_t *p_playlist,
 
     playlist_NodeInsert( p_parent, p_item, i_pos );
     playlist_SendAddNotify( p_playlist, p_item );
+    playlist_Preparse( p_playlist, p_item );
 
-    GoAndPreparse( p_playlist, i_mode, p_item );
     return p_item;
 }
 
@@ -715,22 +712,13 @@ mtime_t playlist_GetNodeDuration( playlist_item_t* node )
  * The following functions are local
  ***************************************************************************/
 
-/* Enqueue an item for preparsing, and play it, if needed */
-static void GoAndPreparse( playlist_t *p_playlist, int i_mode,
-                           playlist_item_t *p_item )
+/* Enqueue an item for preparsing */
+static void playlist_Preparse( playlist_t *p_playlist,
+                               playlist_item_t *p_item )
 {
     playlist_private_t *sys = pl_priv(p_playlist);
 
     PL_ASSERT_LOCKED;
-    if( (i_mode & PLAYLIST_GO ) )
-    {
-        sys->request.b_request = true;
-        sys->request.i_skip = 0;
-        sys->request.p_item = p_item;
-        if( sys->p_input != NULL )
-            input_Stop( sys->p_input );
-        vlc_cond_signal( &sys->signal );
-    }
     /* Preparse if no artist/album info, and hasn't been preparsed already
        and if user has some preparsing option (auto-preparse variable)
        enabled*/
@@ -789,7 +777,7 @@ static int RecursiveAddIntoParent (
         {
             p_new_item = playlist_NodeAddInput( p_playlist,
                                                 p_child_node->p_item,
-                                                p_parent, 0, i_pos );
+                                                p_parent, i_pos );
             if( !p_new_item ) return i_pos;
 
             i_pos++;
@@ -838,7 +826,7 @@ static int RecursiveInsertCopy (
             if( likely(p_new_input != NULL) )
             {
                 p_new_item = playlist_NodeAddInput( p_playlist, p_new_input,
-                                                    p_parent, 0, i_pos );
+                                                    p_parent, i_pos );
                 input_item_Release( p_new_input );
             }
         }
diff --git a/src/playlist/services_discovery.c b/src/playlist/services_discovery.c
index 0a5575f83e..55573fdc73 100644
--- a/src/playlist/services_discovery.c
+++ b/src/playlist/services_discovery.c
@@ -71,7 +71,7 @@ static void playlist_sd_item_added(services_discovery_t *sd,
                                        PLAYLIST_END, PLAYLIST_RO_FLAG);
     }
 
-    playlist_NodeAddInput(playlist, p_input, node, 0, PLAYLIST_END);
+    playlist_NodeAddInput(playlist, p_input, node, PLAYLIST_END);
     playlist_Unlock(playlist);
 }
 
-- 
2.11.0



More information about the vlc-devel mailing list