[vlc-commits] playlist: remove APPEND and INSERT flags
Rémi Denis-Courmont
git at videolan.org
Sat Nov 19 12:35:44 CET 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Nov 19 11:59:01 2016 +0200| [4a2f6a81943b877f0f2c10ce1861c6fbe020565c] | committer: Rémi Denis-Courmont
playlist: remove APPEND and INSERT flags
They are set but never used. In practice, the (following) position
parameter determines whether the item is inserted or appended. A
positive position means insertion; PLAYLIST_END means appendment.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4a2f6a81943b877f0f2c10ce1861c6fbe020565c
---
include/vlc_playlist.h | 2 --
modules/control/dbus/dbus_player.c | 3 +--
modules/control/dbus/dbus_tracklist.c | 9 ++++-----
modules/control/oldrc.c | 4 ++--
modules/control/win_msg.c | 2 +-
modules/gui/macosx/VLCPlaylist.m | 2 +-
modules/gui/ncurses.c | 5 ++---
modules/gui/qt/recents.cpp | 4 ++--
modules/gui/skins2/commands/cmd_add_item.cpp | 2 +-
modules/gui/skins2/vars/playtree.cpp | 2 +-
modules/lua/vlc.c | 5 ++---
src/interface/interface.c | 2 +-
src/os2/specific.c | 1 -
src/playlist/item.c | 6 ++----
src/playlist/loadsave.c | 3 +--
src/playlist/services_discovery.c | 3 +--
16 files changed, 22 insertions(+), 33 deletions(-)
diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h
index d6de572..65e9a71 100644
--- a/include/vlc_playlist.h
+++ b/include/vlc_playlist.h
@@ -207,8 +207,6 @@ enum
};
/* Used by playlist_Import */
-#define PLAYLIST_INSERT 0x0001
-#define PLAYLIST_APPEND 0x0002
#define PLAYLIST_GO 0x0004
#define PLAYLIST_NO_REBUILD 0x0020
diff --git a/modules/control/dbus/dbus_player.c b/modules/control/dbus/dbus_player.c
index e4f7ee1..dc7b37b 100644
--- a/modules/control/dbus/dbus_player.c
+++ b/modules/control/dbus/dbus_player.c
@@ -229,8 +229,7 @@ DBUS_METHOD( OpenUri )
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
- playlist_Add( PL, psz_mrl, NULL, PLAYLIST_APPEND | PLAYLIST_GO,
- PLAYLIST_END, true );
+ playlist_Add( PL, psz_mrl, NULL, PLAYLIST_GO, PLAYLIST_END, true );
REPLY_SEND;
}
diff --git a/modules/control/dbus/dbus_tracklist.c b/modules/control/dbus/dbus_tracklist.c
index 844043c..99a5556 100644
--- a/modules/control/dbus/dbus_tracklist.c
+++ b/modules/control/dbus/dbus_tracklist.c
@@ -72,7 +72,7 @@ DBUS_METHOD( AddTrack )
dbus_bool_t b_play;
int i_input_id = -1;
- int i_mode = PLAYLIST_APPEND;
+ int i_mode = 0;
int i_pos = PLAYLIST_END;
size_t i_append_len = sizeof( DBUS_MPRIS_APPEND );
@@ -95,12 +95,10 @@ DBUS_METHOD( AddTrack )
if( !strncmp( DBUS_MPRIS_APPEND, psz_aftertrack, i_append_len ) )
{
- i_mode = PLAYLIST_APPEND;
i_pos = PLAYLIST_END;
}
else if( !strncmp( DBUS_MPRIS_NOTRACK, psz_aftertrack, i_notrack_len ) )
{
- i_mode = PLAYLIST_INSERT;
i_pos = 0;
}
else if( 1 == sscanf( psz_aftertrack, MPRIS_TRACKID_FORMAT, &i_input_id ) )
@@ -112,7 +110,6 @@ DBUS_METHOD( AddTrack )
if( i_res < 0 )
goto invalidTrackID;
- i_mode = PLAYLIST_INSERT;
i_pos = i_res + 1;
}
else
@@ -123,7 +120,9 @@ invalidTrackID:
psz_aftertrack );
}
- i_mode |= ( TRUE == b_play ) ? PLAYLIST_GO : 0;
+ if( b_play == TRUE )
+ i_mode |= PLAYLIST_GO;
+
playlist_Add( PL, psz_mrl, NULL, i_mode, i_pos, true );
REPLY_SEND;
diff --git a/modules/control/oldrc.c b/modules/control/oldrc.c
index ea5748b..828444f 100644
--- a/modules/control/oldrc.c
+++ b/modules/control/oldrc.c
@@ -1297,7 +1297,7 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
{
msg_rc( "Trying to add %s to playlist.", newval.psz_string );
int i_ret = playlist_AddInput( p_playlist, p_item,
- PLAYLIST_GO|PLAYLIST_APPEND, PLAYLIST_END, true );
+ PLAYLIST_GO, PLAYLIST_END, true );
vlc_gc_decref( p_item );
if( i_ret != VLC_SUCCESS )
{
@@ -1314,7 +1314,7 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
{
msg_rc( "trying to enqueue %s to playlist", newval.psz_string );
if( playlist_AddInput( p_playlist, p_item,
- PLAYLIST_APPEND, PLAYLIST_END, true ) != VLC_SUCCESS )
+ 0, PLAYLIST_END, true ) != VLC_SUCCESS )
{
return VLC_EGENERIC;
}
diff --git a/modules/control/win_msg.c b/modules/control/win_msg.c
index b8bc2ce..e0b5c47 100644
--- a/modules/control/win_msg.c
+++ b/modules/control/win_msg.c
@@ -100,7 +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, PLAYLIST_APPEND |
+ NULL,
( ( i_opt || p_data->enqueue ) ? 0 : PLAYLIST_GO ),
PLAYLIST_END, -1,
i_options,
diff --git a/modules/gui/macosx/VLCPlaylist.m b/modules/gui/macosx/VLCPlaylist.m
index f9d264d..6adeb25 100644
--- a/modules/gui/macosx/VLCPlaylist.m
+++ b/modules/gui/macosx/VLCPlaylist.m
@@ -714,7 +714,7 @@
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,
- PLAYLIST_INSERT, i_pos);
+ 0, i_pos);
if (!p_item)
continue;
diff --git a/modules/gui/ncurses.c b/modules/gui/ncurses.c
index 7bfe242..8c239a4 100644
--- a/modules/gui/ncurses.c
+++ b/modules/gui/ncurses.c
@@ -1444,7 +1444,7 @@ static bool HandleBrowseKey(intf_thread_t *intf, int key)
p_parent = p_parent->p_parent;
input_item_t *p_input = p_playlist->p_playing->p_input;
- playlist_Add(p_playlist, uri, NULL, PLAYLIST_APPEND,
+ playlist_Add(p_playlist, uri, NULL, 0,
PLAYLIST_END, p_parent->p_input == p_input);
BoxSwitch(sys, BOX_PLAYLIST);
@@ -1480,8 +1480,7 @@ static void OpenSelection(intf_thread_t *intf)
p_parent = p_parent->p_parent;
PL_UNLOCK;
- playlist_Add(p_playlist, uri, NULL,
- PLAYLIST_APPEND|PLAYLIST_GO, PLAYLIST_END,
+ playlist_Add(p_playlist, uri, NULL, PLAYLIST_GO, PLAYLIST_END,
p_parent->p_input == p_playlist->p_playing->p_input);
sys->plidx_follow = true;
diff --git a/modules/gui/qt/recents.cpp b/modules/gui/qt/recents.cpp
index 9484b6d..75c6bff 100644
--- a/modules/gui/qt/recents.cpp
+++ b/modules/gui/qt/recents.cpp
@@ -170,7 +170,7 @@ playlist_item_t *RecentsMRL::toPlaylist(int length)
for (int i = 0; i < length; i++)
{
input_item_t *p_input = input_item_New(qtu(recents.at(i)), NULL);
- playlist_NodeAddInput(THEPL, p_input, p_node_recent, PLAYLIST_APPEND, PLAYLIST_END);
+ playlist_NodeAddInput(THEPL, p_input, p_node_recent, 0, PLAYLIST_END);
}
/* locker goes out of scope and node is invalidated here */
@@ -235,7 +235,7 @@ int Open::openMRLwithOptions( intf_thread_t* p_intf,
/* Add to playlist */
int i_ret = playlist_AddExt( THEPL,
qtu(mrl), title,
- PLAYLIST_APPEND | (b_start ? PLAYLIST_GO : 0),
+ (b_start ? PLAYLIST_GO : 0),
PLAYLIST_END,
-1,
i_options, ppsz_options, VLC_INPUT_OPTION_TRUSTED,
diff --git a/modules/gui/skins2/commands/cmd_add_item.cpp b/modules/gui/skins2/commands/cmd_add_item.cpp
index eeb01e7..24e89c1 100644
--- a/modules/gui/skins2/commands/cmd_add_item.cpp
+++ b/modules/gui/skins2/commands/cmd_add_item.cpp
@@ -44,6 +44,6 @@ void CmdAddItem::execute()
free( psz_uri );
}
playlist_Add( pPlaylist, m_name.c_str(), NULL,
- m_playNow ? PLAYLIST_APPEND | PLAYLIST_GO : PLAYLIST_APPEND,
+ m_playNow ? PLAYLIST_GO : 0,
PLAYLIST_END, true );
}
diff --git a/modules/gui/skins2/vars/playtree.cpp b/modules/gui/skins2/vars/playtree.cpp
index 7c47db2..5dc8c1a 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;
- int i_mode = PLAYLIST_APPEND;
+ int i_mode = 0;
if( first && start )
i_mode |= PLAYLIST_GO;
diff --git a/modules/lua/vlc.c b/modules/lua/vlc.c
index 265f1e5..5166941 100644
--- a/modules/lua/vlc.c
+++ b/modules/lua/vlc.c
@@ -578,9 +578,8 @@ int vlclua_playlist_add_internal( vlc_object_t *p_this, lua_State *L,
else /* Play or Enqueue (preparse) */
/* FIXME: playlist_AddInput() can fail */
playlist_AddInput( p_playlist, p_input,
- PLAYLIST_APPEND |
- ( b_play ? PLAYLIST_GO : 0 ),
- PLAYLIST_END, true );
+ ( b_play ? PLAYLIST_GO : 0 ),
+ PLAYLIST_END, true );
i_count ++; /* increment counter */
vlc_gc_decref( p_input );
while( i_options > 0 )
diff --git a/src/interface/interface.c b/src/interface/interface.c
index 8b7914d..09ad080 100644
--- a/src/interface/interface.c
+++ b/src/interface/interface.c
@@ -161,7 +161,7 @@ static playlist_t *intf_GetPlaylist(libvlc_int_t *libvlc)
void intf_InsertItem(libvlc_int_t *libvlc, const char *mrl, unsigned optc,
const char *const *optv, unsigned flags)
{
- playlist_AddExt(intf_GetPlaylist(libvlc), mrl, NULL, PLAYLIST_INSERT,
+ playlist_AddExt(intf_GetPlaylist(libvlc), mrl, NULL, 0,
0, -1, optc, optv, flags, true);
}
diff --git a/src/os2/specific.c b/src/os2/specific.c
index 989e62e..59df87a 100644
--- a/src/os2/specific.c
+++ b/src/os2/specific.c
@@ -98,7 +98,6 @@ static void IPCHelperThread( void *arg )
if( p_playlist )
{
playlist_AddExt( p_playlist, ppsz_argv[ i_opt ], NULL,
- PLAYLIST_APPEND |
(( i_opt || ulCmd == IPC_CMD_ENQUEUE ) ?
0 : PLAYLIST_GO ),
PLAYLIST_END, -1, i_options,
diff --git a/src/playlist/item.c b/src/playlist/item.c
index 5a77b41..e370e06 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -870,8 +870,7 @@ static int RecursiveAddIntoParent (
{
p_new_item = playlist_NodeAddInput( p_playlist,
p_child_node->p_item,
- p_parent,
- PLAYLIST_INSERT, i_pos );
+ p_parent, 0, i_pos );
if( !p_new_item ) return i_pos;
i_pos++;
@@ -920,8 +919,7 @@ static int RecursiveInsertCopy (
if( likely(p_new_input != NULL) )
{
p_new_item = playlist_NodeAddInput( p_playlist, p_new_input,
- p_parent, PLAYLIST_INSERT,
- i_pos );
+ p_parent, 0, i_pos );
vlc_gc_decref( p_new_input );
}
}
diff --git a/src/playlist/loadsave.c b/src/playlist/loadsave.c
index 67e4029..c9a5dbc 100644
--- a/src/playlist/loadsave.c
+++ b/src/playlist/loadsave.c
@@ -99,8 +99,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, PLAYLIST_APPEND, PLAYLIST_END,
- true );
+ playlist_AddInput( p_playlist, p_input, 0, PLAYLIST_END, true );
vlc_object_t *dummy = vlc_object_create( p_playlist, sizeof (*dummy) );
var_Create( dummy, "meta-file", VLC_VAR_VOID );
diff --git a/src/playlist/services_discovery.c b/src/playlist/services_discovery.c
index 5b96f31..f32ffe7 100644
--- a/src/playlist/services_discovery.c
+++ b/src/playlist/services_discovery.c
@@ -179,8 +179,7 @@ static void playlist_sd_item_added(services_discovery_t *sd,
PLAYLIST_RO_FLAG|PLAYLIST_SKIP_FLAG);
}
- playlist_NodeAddInput(playlist, p_input, parent,
- PLAYLIST_APPEND, PLAYLIST_END);
+ playlist_NodeAddInput(playlist, p_input, parent, 0, PLAYLIST_END);
playlist_Unlock(playlist);
}
More information about the vlc-commits
mailing list