[vlc-devel] [PATCH 25/40] playlist: use boolean for playlist_AddInput() mode parameter

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


---
 include/vlc_playlist.h                                 | 2 +-
 modules/control/oldrc.c                                | 5 ++---
 modules/gui/macosx/VLCConvertAndSaveWindowController.m | 2 +-
 modules/lua/libs/playlist.c                            | 2 +-
 src/playlist/item.c                                    | 9 ++++-----
 src/playlist/loadsave.c                                | 2 +-
 6 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h
index caa559c849..0c401a9224 100644
--- a/include/vlc_playlist.h
+++ b/include/vlc_playlist.h
@@ -363,7 +363,7 @@ VLC_API int playlist_ServicesDiscoveryControl( playlist_t *, const char *, int,
 /******************** Item addition ********************/
 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 *, int, 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 int playlist_NodeAddCopy( playlist_t *, playlist_item_t *, playlist_item_t *, int );
 
diff --git a/modules/control/oldrc.c b/modules/control/oldrc.c
index 4f085e4fcc..083118cdd2 100644
--- a/modules/control/oldrc.c
+++ b/modules/control/oldrc.c
@@ -1296,8 +1296,7 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
         if( p_item )
         {
             msg_rc( "Trying to add %s to playlist.", newval.psz_string );
-            int i_ret = playlist_AddInput( p_playlist, p_item,
-                                           PLAYLIST_GO, true );
+            int i_ret = playlist_AddInput( p_playlist, p_item, true, true );
             input_item_Release( p_item );
             if( i_ret != VLC_SUCCESS )
             {
@@ -1313,7 +1312,7 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
         if( p_item )
         {
             msg_rc( "trying to enqueue %s to playlist", newval.psz_string );
-            int ret =  playlist_AddInput( p_playlist, p_item, 0, true );
+            int ret =  playlist_AddInput( p_playlist, p_item, false, true );
             input_item_Release( p_item );
             if( ret != VLC_SUCCESS )
             {
diff --git a/modules/gui/macosx/VLCConvertAndSaveWindowController.m b/modules/gui/macosx/VLCConvertAndSaveWindowController.m
index 82ec2f93a1..f203a5e78a 100644
--- a/modules/gui/macosx/VLCConvertAndSaveWindowController.m
+++ b/modules/gui/macosx/VLCConvertAndSaveWindowController.m
@@ -287,7 +287,7 @@
         input_item_AddOption(p_input, [[NSString stringWithFormat:@"ttl=%@", [_streamTTLField stringValue]] UTF8String], VLC_INPUT_OPTION_TRUSTED);
 
     int returnValue;
-    returnValue = playlist_AddInput(p_playlist, p_input, 0, true );
+    returnValue = playlist_AddInput(p_playlist, p_input, false, true );
 
     if (returnValue == VLC_SUCCESS) {
         /* let's "play" */
diff --git a/modules/lua/libs/playlist.c b/modules/lua/libs/playlist.c
index be6643cd86..eede9e2235 100644
--- a/modules/lua/libs/playlist.c
+++ b/modules/lua/libs/playlist.c
@@ -195,7 +195,7 @@ static int vlclua_playlist_add_common(lua_State *L, bool play)
         {
             /* Play or Enqueue (preparse) */
             /* FIXME: playlist_AddInput() can fail */
-            playlist_AddInput(playlist, item, play ? PLAYLIST_GO : 0, true);
+            playlist_AddInput(playlist, item, play, true);
             input_item_Release(item);
             count++;
         }
diff --git a/src/playlist/item.c b/src/playlist/item.c
index b193d45d98..bbc3fca970 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -463,8 +463,7 @@ int playlist_AddExt( playlist_t *p_playlist, const char * psz_uri,
     if( p_input == NULL )
         return VLC_ENOMEM;
     input_item_AddOptions( p_input, i_options, ppsz_options, i_option_flags );
-    i_ret = playlist_AddInput( p_playlist, p_input,
-                               play_now ? PLAYLIST_GO : 0, b_playlist );
+    i_ret = playlist_AddInput( p_playlist, p_input, play_now, b_playlist );
     input_item_Release( p_input );
     return i_ret;
 }
@@ -479,7 +478,7 @@ int playlist_AddExt( playlist_t *p_playlist, const char * psz_uri,
  * \return VLC_SUCCESS or VLC_ENOMEM or VLC_EGENERIC
 */
 int playlist_AddInput( playlist_t* p_playlist, input_item_t *p_input,
-                       int i_mode, bool b_playlist )
+                       bool play_now, bool b_playlist )
 {
     playlist_item_t *item;
 
@@ -487,8 +486,8 @@ 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, i_mode,
-                                  PLAYLIST_END );
+    item = playlist_NodeAddInput( p_playlist, p_input, item,
+                                  play_now ? PLAYLIST_GO : 0, PLAYLIST_END );
     PL_UNLOCK;
     return (item != NULL) ? VLC_SUCCESS : VLC_ENOMEM;
 }
diff --git a/src/playlist/loadsave.c b/src/playlist/loadsave.c
index bb3ae6afb2..5b1ae883e3 100644
--- a/src/playlist/loadsave.c
+++ b/src/playlist/loadsave.c
@@ -100,7 +100,7 @@ int playlist_Import( playlist_t *p_playlist, const char *psz_file )
     p_input = input_item_New( psz_uri, psz_file );
     free( psz_uri );
 
-    playlist_AddInput( p_playlist, p_input, 0, true );
+    playlist_AddInput( p_playlist, p_input, false, true );
 
     vlc_object_t *dummy = vlc_object_create( p_playlist, sizeof (*dummy) );
     var_Create( dummy, "meta-file", VLC_VAR_VOID );
-- 
2.11.0



More information about the vlc-devel mailing list