[vlc-commits] playlist: factor common code in playlist_AddInput()

Rémi Denis-Courmont git at videolan.org
Wed Nov 16 23:05:07 CET 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Nov 16 22:34:32 2016 +0200| [a0214475ebf6250bdab7be7ab4d717c2e56b72e1] | committer: Rémi Denis-Courmont

playlist: factor common code in playlist_AddInput()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a0214475ebf6250bdab7be7ab4d717c2e56b72e1
---

 src/playlist/item.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/src/playlist/item.c b/src/playlist/item.c
index e2c25fe..450f834 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -444,24 +444,15 @@ int playlist_AddInput( playlist_t* p_playlist, input_item_t *p_input,
                        int i_mode, int i_pos, bool b_playlist,
                        bool b_locked )
 {
-    playlist_item_t *p_item;
+    playlist_item_t *item;
 
     PL_LOCK_IF( !b_locked );
+    item = b_playlist ? p_playlist->p_playing
+                      : p_playlist->p_media_library;
 
-    p_item = playlist_ItemNewFromInput( p_playlist, p_input );
-    if( p_item == NULL )
-    {
-        PL_UNLOCK_IF( !b_locked );
-        return VLC_ENOMEM;
-    }
-    AddItem( p_playlist, p_item,
-             b_playlist ? p_playlist->p_playing :
-                          p_playlist->p_media_library , i_mode, i_pos );
-
-    GoAndPreparse( p_playlist, i_mode, p_item );
-
+    item = playlist_NodeAddInput( p_playlist, p_input, item, i_mode, i_pos );
     PL_UNLOCK_IF( !b_locked );
-    return VLC_SUCCESS;
+    return (item != NULL) ? VLC_SUCCESS : VLC_ENOMEM;
 }
 
 /**



More information about the vlc-commits mailing list