Commit 4a2f6a81 authored by Rémi Denis-Courmont's avatar 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.
parent aa555f79
......@@ -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
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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,
......
......@@ -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;
......
......@@ -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;
......
......@@ -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,
......
......@@ -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 );
}
......@@ -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;
......
......@@ -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 )
......
......@@ -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);
}
......
......@@ -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,
......
......@@ -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 );
}
}
......
......@@ -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 );
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment