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

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


---
 include/vlc_playlist.h     |  2 +-
 modules/control/win_msg.c  |  3 +--
 modules/gui/qt/recents.cpp |  4 +---
 src/os2/specific.c         |  3 +--
 src/playlist/item.c        | 11 ++++++-----
 5 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h
index 7f9ec66382..caa559c849 100644
--- a/include/vlc_playlist.h
+++ b/include/vlc_playlist.h
@@ -362,7 +362,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 *, int, int, const char *const *, unsigned, 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 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/win_msg.c b/modules/control/win_msg.c
index 12011a850d..0bf29ebead 100644
--- a/modules/control/win_msg.c
+++ b/modules/control/win_msg.c
@@ -100,8 +100,7 @@ static LRESULT CALLBACK WMCOPYWNDPROC(HWND hwnd, UINT uMsg,
                     psz_URI = vlc_path2uri( ppsz_argv[i_opt], NULL );
                 playlist_AddExt( pl_Get(intf),
                         (psz_URI != NULL) ? psz_URI : ppsz_argv[i_opt],
-                        NULL,
-                        ( ( i_opt || p_data->enqueue ) ? 0 : PLAYLIST_GO ),
+                        NULL, (i_opt == 0 && !p_data->enqueue),
                         i_options,
                         (char const **)( i_options ? &ppsz_argv[i_opt+1] : NULL ),
                         VLC_INPUT_OPTION_TRUSTED,
diff --git a/modules/gui/qt/recents.cpp b/modules/gui/qt/recents.cpp
index 4bd8ce3227..7bfadf1ca9 100644
--- a/modules/gui/qt/recents.cpp
+++ b/modules/gui/qt/recents.cpp
@@ -212,9 +212,7 @@ int Open::openMRLwithOptions( intf_thread_t* p_intf,
     }
 
     /* Add to playlist */
-    int i_ret = playlist_AddExt( THEPL,
-                  qtu(mrl), title,
-                  (b_start ? PLAYLIST_GO : 0),
+    int i_ret = playlist_AddExt( THEPL, qtu(mrl), title, b_start,
                   i_options, ppsz_options, VLC_INPUT_OPTION_TRUSTED,
                   b_playlist );
 
diff --git a/src/os2/specific.c b/src/os2/specific.c
index 743c433d98..dabca56b53 100644
--- a/src/os2/specific.c
+++ b/src/os2/specific.c
@@ -98,8 +98,7 @@ static void IPCHelperThread( void *arg )
             if( p_playlist )
             {
                 playlist_AddExt( p_playlist, ppsz_argv[ i_opt ], NULL,
-                                 (( i_opt || ulCmd == IPC_CMD_ENQUEUE ) ?
-                                     0 : PLAYLIST_GO ),
+                                 ((i_opt == 0 && ulCmd != IPC_CMD_ENQUEUE ),
                                  i_options,
                                  ( char const ** )
                                      ( i_options ? &ppsz_argv[ i_opt + 1 ] :
diff --git a/src/playlist/item.c b/src/playlist/item.c
index f06e389d94..b193d45d98 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -433,8 +433,8 @@ void playlist_Clear( playlist_t * p_playlist, bool b_locked )
  */
 int playlist_Add( playlist_t *p_playlist, const char *psz_uri, bool play_now )
 {
-    return playlist_AddExt( p_playlist, psz_uri, NULL,
-                            play_now ? PLAYLIST_GO : 0, 0, NULL, 0, true );
+    return playlist_AddExt( p_playlist, psz_uri, NULL, play_now,
+                            0, NULL, 0, true );
 }
 
 /**
@@ -443,7 +443,7 @@ int playlist_Add( playlist_t *p_playlist, const char *psz_uri, bool play_now )
  * \param p_playlist the playlist to add into
  * \param psz_uri the mrl to add to the playlist
  * \param psz_name a text giving a name or description of this item
- * \param i_mode the mode used when adding
+ * \param play_now whether to start playing immediately or not
  * \param i_options the number of options
  * \param ppsz_options an array of options
  * \param i_option_flags options flags
@@ -451,7 +451,7 @@ int playlist_Add( playlist_t *p_playlist, const char *psz_uri, bool play_now )
  * \return VLC_SUCCESS or a VLC error code
 */
 int playlist_AddExt( playlist_t *p_playlist, const char * psz_uri,
-                     const char *psz_name, int i_mode,
+                     const char *psz_name, bool play_now,
                      int i_options, const char *const *ppsz_options,
                      unsigned i_option_flags,
                      bool b_playlist )
@@ -463,7 +463,8 @@ 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, i_mode, b_playlist );
+    i_ret = playlist_AddInput( p_playlist, p_input,
+                               play_now ? PLAYLIST_GO : 0, b_playlist );
     input_item_Release( p_input );
     return i_ret;
 }
-- 
2.11.0



More information about the vlc-devel mailing list