Commit 496a5420 authored by Clément Stenac's avatar Clément Stenac

* Do not take and release the structure lock for each element of the list while

  releasing it. mutex locks /= 20 on a standard preparse run
* Only create absolutely necessary variables while preparsing
--> Preparse speed *= 4 (with item in disk cache of course)

* Do not rebuild playlist too much while adding a directory. Add a new flag
  to NodeCreate and Add to control this behaviour
parent dbcaeb30
......@@ -142,6 +142,7 @@ struct vlc_list_t
#define PLAYLIST_GO 0x0004
#define PLAYLIST_PREPARSE 0x0008
#define PLAYLIST_SPREPARSE 0x0010
#define PLAYLIST_NO_REBUILD 0x0020
#define PLAYLIST_END -666
......
......@@ -394,7 +394,7 @@ VLC_EXPORT(void, playlist_NodeDump, ( playlist_t *p_playlist, playlist_item_t *p
VLC_EXPORT( int, playlist_NodeChildrenCount, (playlist_t *,playlist_item_t* ) );
/* Node management */
VLC_EXPORT( playlist_item_t *, playlist_NodeCreate, ( playlist_t *, const char *, playlist_item_t * p_parent ) );
VLC_EXPORT( playlist_item_t *, playlist_NodeCreate, ( playlist_t *, const char *, playlist_item_t * p_parent, int i_flags ) );
VLC_EXPORT( int, playlist_NodeAppend, (playlist_t *,playlist_item_t*,playlist_item_t *) );
VLC_EXPORT( int, playlist_NodeInsert, (playlist_t *,playlist_item_t*,playlist_item_t *, int) );
VLC_EXPORT( int, playlist_NodeRemoveItem, (playlist_t *,playlist_item_t*,playlist_item_t *) );
......
......@@ -237,6 +237,8 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len)
var_SetInteger( p_playlist, "activity", i_activity -
DIRECTORY_ACTIVITY );
playlist_Signal( p_playlist );
if( psz_name ) free( psz_name );
vlc_object_release( p_playlist );
......@@ -433,8 +435,9 @@ static int ReadDir( playlist_t *p_playlist, const char *psz_name,
{
msg_Dbg(p_playlist, "creading subdirectory %s", psz_uri );
p_node = playlist_NodeCreate (p_playlist, entry,
p_parent_category);
p_node = playlist_NodeCreate( p_playlist, entry,
p_parent_category,
PLAYLIST_NO_REBUILD );
/* If we had the parent in category, the it is now node.
* Else, we still don't have */
......@@ -482,7 +485,8 @@ static int ReadDir( playlist_t *p_playlist, const char *psz_name,
input_ItemCopyOptions( p_current_input, p_input );
playlist_BothAddInput( p_playlist, p_input,
p_parent_category,
PLAYLIST_APPEND|PLAYLIST_PREPARSE,
PLAYLIST_APPEND|PLAYLIST_PREPARSE|
PLAYLIST_NO_REBUILD,
PLAYLIST_END, NULL, NULL );
}
}
......
......@@ -1343,10 +1343,10 @@ NSLog( @"expandable" );
_("Please enter a name for the new node."), &psz_name );
if( psz_name != NULL && psz_name != "" )
p_item = playlist_NodeCreate( p_playlist, psz_name,
p_playlist->p_local_category );
p_playlist->p_local_category, 0 );
else
p_item = playlist_NodeCreate( p_playlist, _("Empty Folder"),
p_playlist->p_local_category );
p_playlist->p_local_category, 0 );
if(! p_item )
msg_Warn( VLCIntf, "node creation failed" );
......
......@@ -1636,7 +1636,7 @@ void Playlist::OnPopupAddNode( wxCommandEvent& event )
p_item = playlist_ItemGetById( p_playlist, p_wxitem->i_id, VLC_TRUE );
playlist_NodeCreate( p_playlist, psz_name, p_item );
playlist_NodeCreate( p_playlist, psz_name, p_item, 0 );
UnlockPlaylist( p_intf->p_sys, p_playlist );
Rebuild( VLC_TRUE );
......
......@@ -307,9 +307,9 @@ static int Open( vlc_object_t *p_this )
}
p_sys->p_node_cat = playlist_NodeCreate( p_sys->p_playlist, _("Bonjour"),
p_sys->p_playlist->p_root_category );
p_sys->p_playlist->p_root_category, 0 );
p_sys->p_node_one = playlist_NodeCreate( p_sys->p_playlist, _("Bonjour"),
p_sys->p_playlist->p_root_onelevel );
p_sys->p_playlist->p_root_onelevel, 0 );
p_sys->p_node_one->p_input->i_id = p_sys->p_node_cat->p_input->i_id;
p_sys->p_node_one->i_flags |= PLAYLIST_RO_FLAG;
......
......@@ -149,9 +149,9 @@ static int Open( vlc_object_t *p_this )
}
p_sys->p_node_cat = playlist_NodeCreate( p_playlist, _("Podcast"),
p_playlist->p_root_category );
p_playlist->p_root_category, 0 );
p_sys->p_node_one = playlist_NodeCreate( p_playlist, _("Podcast"),
p_playlist->p_root_onelevel );
p_playlist->p_root_onelevel, 0 );
p_sys->p_node_one->p_input->i_id = p_sys->p_node_cat->p_input->i_id;
p_sys->p_node_one->i_flags |= PLAYLIST_RO_FLAG;
......
......@@ -802,7 +802,7 @@ sap_announce_t *CreateAnnounce( services_discovery_t *p_sd, uint16_t i_hash,
if( p_child == NULL )
{
p_child = playlist_NodeCreate( pl_Get( p_sd ), psz_value,
p_sys->p_node_cat );
p_sys->p_node_cat, 0 );
p_child->i_flags &= ~PLAYLIST_SKIP_FLAG;
}
}
......
......@@ -206,7 +206,7 @@ playlist_item_t *UPnPHandler::AddDevice( Device *dev )
*/
char *str = strdup( dev->getFriendlyName( ) );
p_item = playlist_NodeCreate( p_sys->p_playlist, str, p_sys->p_node_cat );
p_item = playlist_NodeCreate( p_sys->p_playlist, str, p_sys->p_node_cat,0 );
p_item->i_flags &= ~PLAYLIST_SKIP_FLAG;
msg_Dbg( p_sd, "device %s added", str );
free( str );
......@@ -247,7 +247,7 @@ void UPnPHandler::AddContent( playlist_item_t *p_parent, ContentNode *node )
char* p_name = strdup(title); /* See other comment on strdup */
playlist_item_t* p_node = playlist_NodeCreate( p_sys->p_playlist,
p_name, p_parent );
p_name, p_parent, 0 );
free(p_name);
unsigned nContentNodes = conNode->getNContentNodes();
......
......@@ -854,7 +854,7 @@ void MediaServer::_buildPlaylist( Container* parent )
playlist_item_t* parentNode = parent->getPlaylistNode();
char* title = strdup( container->getTitle() );
playlist_item_t* node = playlist_NodeCreate( p_playlist, title, parentNode );
playlist_item_t* node = playlist_NodeCreate( p_playlist, title, parentNode, 0 );
free( title );
container->setPlaylistNode( node );
......@@ -916,7 +916,7 @@ bool MediaServerList::addServer( MediaServer* s )
char* name = strdup( s->getFriendlyName() );
playlist_item_t* node = playlist_NodeCreate( pl_Get( _cookie->serviceDiscovery ),
name,
_cookie->serviceDiscovery->p_sys->p_node_cat );
_cookie->serviceDiscovery->p_sys->p_node_cat, 0 );
free( name );
s->setPlaylistNode( node );
......
......@@ -177,25 +177,33 @@ es_out_t *input_EsOutNew( input_thread_t *p_input )
var_Get( p_input, "sub-track", &val );
p_sys->i_sub_last = val.i_int;
var_Get( p_input, "audio-language", &val );
p_sys->ppsz_audio_language = LanguageSplit(val.psz_string);
if( p_sys->ppsz_audio_language )
if( !p_input->b_preparsing )
{
for( i = 0; p_sys->ppsz_audio_language[i]; i++ )
msg_Dbg( p_input, "selected audio language[%d] %s",
i, p_sys->ppsz_audio_language[i] );
}
if( val.psz_string ) free( val.psz_string );
var_Get( p_input, "audio-language", &val );
p_sys->ppsz_audio_language = LanguageSplit(val.psz_string);
if( p_sys->ppsz_audio_language )
{
for( i = 0; p_sys->ppsz_audio_language[i]; i++ )
msg_Dbg( p_input, "selected audio language[%d] %s",
i, p_sys->ppsz_audio_language[i] );
}
if( val.psz_string ) free( val.psz_string );
var_Get( p_input, "sub-language", &val );
p_sys->ppsz_sub_language = LanguageSplit(val.psz_string);
if( p_sys->ppsz_sub_language )
var_Get( p_input, "sub-language", &val );
p_sys->ppsz_sub_language = LanguageSplit(val.psz_string);
if( p_sys->ppsz_sub_language )
{
for( i = 0; p_sys->ppsz_sub_language[i]; i++ )
msg_Dbg( p_input, "selected subtitle language[%d] %s",
i, p_sys->ppsz_sub_language[i] );
}
if( val.psz_string ) free( val.psz_string );
}
else
{
for( i = 0; p_sys->ppsz_sub_language[i]; i++ )
msg_Dbg( p_input, "selected subtitle language[%d] %s",
i, p_sys->ppsz_sub_language[i] );
p_sys->ppsz_sub_language = NULL;
p_sys->ppsz_audio_language = NULL;
}
if( val.psz_string ) free( val.psz_string );
var_Get( p_input, "audio-track-id", &val );
p_sys->i_audio_id = val.i_int;
......
......@@ -197,7 +197,9 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
input_ConfigVarInit( p_input );
/* Create Objects variables for public Get and Set */
input_ControlVarInit( p_input );
if( !p_input->b_preparsing )
input_ControlVarInit( p_input );
p_input->p->input.i_cr_average = var_GetInteger( p_input, "cr-average" );
if( !p_input->b_preparsing )
......@@ -1147,7 +1149,8 @@ static void End( input_thread_t * p_input )
input_ChangeState( p_input, END_S );
/* Clean control variables */
input_ControlVarClean( p_input );
if( !p_input->b_preparsing )
input_ControlVarClean( p_input );
/* Clean up master */
InputSourceClean( p_input, &p_input->p->input );
......
......@@ -386,56 +386,68 @@ void input_ConfigVarInit ( input_thread_t *p_input )
vlc_value_t val;
/* Create Object Variables for private use only */
var_Create( p_input, "video", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_input, "audio", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_input, "spu", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_input, "audio-track", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Create( p_input, "sub-track", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Create( p_input, "audio-language", VLC_VAR_STRING|VLC_VAR_DOINHERIT );
var_Create( p_input, "sub-language", VLC_VAR_STRING|VLC_VAR_DOINHERIT );
var_Create( p_input, "audio-track-id", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Create( p_input, "sub-track-id", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Create( p_input, "sub-file", VLC_VAR_FILE | VLC_VAR_DOINHERIT );
var_Create( p_input, "sub-autodetect-file", VLC_VAR_BOOL |
VLC_VAR_DOINHERIT );
var_Create( p_input, "sub-autodetect-path", VLC_VAR_STRING |
VLC_VAR_DOINHERIT );
var_Create( p_input, "sub-autodetect-fuzzy", VLC_VAR_INTEGER |
VLC_VAR_DOINHERIT );
var_Create( p_input, "sout", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_input, "sout-all", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_input, "sout-audio", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_input, "sout-video", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_input, "sout-spu", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_input, "sout-keep", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_input, "input-repeat", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Create( p_input, "start-time", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Create( p_input, "stop-time", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Create( p_input, "minimize-threads", VLC_VAR_BOOL|VLC_VAR_DOINHERIT );
if( !p_input->b_preparsing )
{
var_Create( p_input, "video", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_input, "audio", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_input, "spu", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_input, "audio-track", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Create( p_input, "sub-track", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Create( p_input, "audio-language",
VLC_VAR_STRING|VLC_VAR_DOINHERIT );
var_Create( p_input, "sub-language",
VLC_VAR_STRING|VLC_VAR_DOINHERIT );
var_Create( p_input, "audio-track-id",
VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Create( p_input, "sub-track-id",
VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Create( p_input, "sub-file", VLC_VAR_FILE | VLC_VAR_DOINHERIT );
var_Create( p_input, "sub-autodetect-file", VLC_VAR_BOOL |
VLC_VAR_DOINHERIT );
var_Create( p_input, "sub-autodetect-path", VLC_VAR_STRING |
VLC_VAR_DOINHERIT );
var_Create( p_input, "sub-autodetect-fuzzy", VLC_VAR_INTEGER |
VLC_VAR_DOINHERIT );
var_Create( p_input, "sout", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_input, "sout-all", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_input, "sout-audio", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_input, "sout-video", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_input, "sout-spu", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_input, "sout-keep", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_input, "input-repeat",
VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Create( p_input, "start-time", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Create( p_input, "stop-time", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Create( p_input, "input-slave",
VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_input, "minimize-threads",
VLC_VAR_BOOL|VLC_VAR_DOINHERIT );
var_Create( p_input, "audio-desync",
VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_input, "cr-average",
VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_input, "clock-synchro",
VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
}
var_Create( p_input, "demuxed-id3", VLC_VAR_BOOL ); /* FIXME beurk */
val.b_bool = VLC_FALSE;
var_Change( p_input, "demuxed-id3", VLC_VAR_SETVALUE, &val, NULL );
var_Create( p_input, "audio-desync", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_input, "cr-average", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_input, "clock-synchro", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
var_Create( p_input, "seekable", VLC_VAR_BOOL );
val.b_bool = VLC_TRUE; /* Fixed later*/
var_Change( p_input, "seekable", VLC_VAR_SETVALUE, &val, NULL );
var_Create( p_input, "input-slave", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
/* */
var_Create( p_input, "access-filter", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_input, "access", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
......
......@@ -579,7 +579,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, char *ppsz_argv[] )
/* Initialise D-Bus interface, check for other instances */
DBusConnection *p_conn;
DBusError dbus_error;
int i_dbus_service;
dbus_threads_init_default();
dbus_error_init( &dbus_error );
......
......@@ -852,14 +852,12 @@ void vlc_list_release( vlc_list_t *p_list )
{
int i_index;
vlc_mutex_lock( &structure_lock );
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
vlc_mutex_lock( &structure_lock );
p_list->p_values[i_index].p_object->i_refcount--;
vlc_mutex_unlock( &structure_lock );
}
vlc_mutex_unlock( &structure_lock );
free( p_list->p_values );
free( p_list );
......
......@@ -94,17 +94,19 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
p_playlist->b_auto_preparse =
var_CreateGetBool( p_playlist, "auto-preparse") ;
p_playlist->p_root_category = playlist_NodeCreate( p_playlist, NULL, NULL);
p_playlist->p_root_onelevel = playlist_NodeCreate( p_playlist, NULL, NULL);
p_playlist->p_root_category = playlist_NodeCreate( p_playlist, NULL, NULL,
0 );
p_playlist->p_root_onelevel = playlist_NodeCreate( p_playlist, NULL, NULL,
0 );
if( !p_playlist->p_root_category || !p_playlist->p_root_onelevel )
return NULL;
/* Create playlist and media library */
p_playlist->p_local_category = playlist_NodeCreate( p_playlist,
_( "Playlist" ),p_playlist->p_root_category );
_( "Playlist" ),p_playlist->p_root_category, 0 );
p_playlist->p_local_onelevel = playlist_NodeCreate( p_playlist,
_( "Playlist" ), p_playlist->p_root_onelevel );
_( "Playlist" ), p_playlist->p_root_onelevel, 0 );
p_playlist->p_local_category->i_flags |= PLAYLIST_RO_FLAG;
p_playlist->p_local_onelevel->i_flags |= PLAYLIST_RO_FLAG;
......@@ -120,9 +122,9 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
if( config_GetInt( p_playlist, "media-library") )
{
p_playlist->p_ml_category = playlist_NodeCreate( p_playlist,
_( "Media Library" ), p_playlist->p_root_category );
_( "Media Library" ), p_playlist->p_root_category, 0 );
p_playlist->p_ml_onelevel = playlist_NodeCreate( p_playlist,
_( "Media Library" ), p_playlist->p_root_onelevel );
_( "Media Library" ), p_playlist->p_root_onelevel, 0 );
if(!p_playlist->p_ml_category || !p_playlist->p_ml_onelevel)
return NULL;
......
......@@ -26,13 +26,13 @@
#include <vlc_playlist.h>
#include "playlist_internal.h"
void AddItem( playlist_t *p_playlist, playlist_item_t *p_item,
playlist_item_t *p_node, int i_pos );
void GoAndPreparse( playlist_t *p_playlist, int i_mode,
playlist_item_t *, playlist_item_t * );
void ChangeToNode( playlist_t *p_playlist, playlist_item_t *p_item );
int DeleteInner( playlist_t * p_playlist, playlist_item_t *p_item,
vlc_bool_t b_stop );
static void AddItem( playlist_t *p_playlist, playlist_item_t *p_item,
playlist_item_t *p_node, int i_mode, int i_pos );
static void GoAndPreparse( playlist_t *p_playlist, int i_mode,
playlist_item_t *, playlist_item_t * );
static void ChangeToNode( playlist_t *p_playlist, playlist_item_t *p_item );
static int DeleteInner( playlist_t * p_playlist, playlist_item_t *p_item,
vlc_bool_t b_stop );
/*****************************************************************************
* Playlist item creation
......@@ -206,14 +206,14 @@ int playlist_AddInput( playlist_t* p_playlist, input_item_t *p_input,
if( p_item_one == NULL ) return VLC_EGENERIC;
AddItem( p_playlist, p_item_one,
b_playlist ? p_playlist->p_local_onelevel :
p_playlist->p_ml_onelevel , i_pos );
p_playlist->p_ml_onelevel , i_mode, i_pos );
/* Add to CATEGORY */
p_item_cat = playlist_ItemNewFromInput( p_playlist, p_input );
if( p_item_cat == NULL ) return VLC_EGENERIC;
AddItem( p_playlist, p_item_cat,
b_playlist ? p_playlist->p_local_category :
p_playlist->p_ml_category , i_pos );
p_playlist->p_ml_category , i_mode, i_pos );
GoAndPreparse( p_playlist, i_mode, p_item_cat, p_item_one );
......@@ -237,7 +237,7 @@ int playlist_BothAddInput( playlist_t *p_playlist,
/* Add to category */
p_item_cat = playlist_ItemNewFromInput( p_playlist, p_input );
if( p_item_cat == NULL ) return VLC_EGENERIC;
AddItem( p_playlist, p_item_cat, p_direct_parent, i_pos );
AddItem( p_playlist, p_item_cat, p_direct_parent, i_mode, i_pos );
/* Add to onelevel */
/** \todo make a faster case for ml import */
......@@ -255,7 +255,8 @@ int playlist_BothAddInput( playlist_t *p_playlist,
p_up->p_input->i_id )
{
AddItem( p_playlist, p_item_one,
p_playlist->p_root_onelevel->pp_children[i_top], i_pos );
p_playlist->p_root_onelevel->pp_children[i_top],
i_mode, i_pos );
break;
}
}
......@@ -282,7 +283,7 @@ playlist_item_t * playlist_NodeAddInput( playlist_t *p_playlist,
p_item = playlist_ItemNewFromInput( p_playlist, p_input );
if( p_item == NULL ) return NULL;
AddItem( p_playlist, p_item, p_parent, i_pos );
AddItem( p_playlist, p_item, p_parent, i_mode, i_pos );
vlc_mutex_unlock( &p_playlist->object_lock );
......@@ -475,7 +476,7 @@ int playlist_TreeMove( playlist_t * p_playlist, playlist_item_t *p_item,
/** Send a notification that an item has been added to a node */
void playlist_SendAddNotify( playlist_t *p_playlist, int i_item_id,
int i_node_id )
int i_node_id, vlc_bool_t b_signal )
{
vlc_value_t val;
playlist_add_t *p_add = (playlist_add_t *)malloc(sizeof( playlist_add_t));
......@@ -483,7 +484,8 @@ void playlist_SendAddNotify( playlist_t *p_playlist, int i_item_id,
p_add->i_node = i_node_id;
val.p_address = p_add;
p_playlist->b_reset_currently_playing = VLC_TRUE;
vlc_cond_signal( &p_playlist->object_wait );
if( b_signal )
vlc_cond_signal( &p_playlist->object_wait );
var_Set( p_playlist, "item-append", val );
free( p_add );
}
......@@ -509,8 +511,9 @@ int playlist_ItemSetName( playlist_item_t *p_item, const char *psz_name )
***************************************************************************/
/* Enqueue an item for preparsing, and play it, if needed */
void GoAndPreparse( playlist_t *p_playlist, int i_mode,
playlist_item_t *p_item_cat, playlist_item_t *p_item_one )
static void GoAndPreparse( playlist_t *p_playlist, int i_mode,
playlist_item_t *p_item_cat,
playlist_item_t *p_item_one )
{
if( (i_mode & PLAYLIST_GO ) )
{
......@@ -556,8 +559,8 @@ void GoAndPreparse( playlist_t *p_playlist, int i_mode,
}
/* Add the playlist item to the requested node and fire a notification */
void AddItem( playlist_t *p_playlist, playlist_item_t *p_item,
playlist_item_t *p_node, int i_pos )
static void AddItem( playlist_t *p_playlist, playlist_item_t *p_item,
playlist_item_t *p_node, int i_mode, int i_pos )
{
ARRAY_APPEND(p_playlist->items, p_item);
ARRAY_APPEND(p_playlist->all_items, p_item);
......@@ -569,11 +572,12 @@ void AddItem( playlist_t *p_playlist, playlist_item_t *p_item,
playlist_NodeInsert( p_playlist, p_item, p_node, i_pos );
if( !p_playlist->b_doing_ml )
playlist_SendAddNotify( p_playlist, p_item->i_id, p_node->i_id );
playlist_SendAddNotify( p_playlist, p_item->i_id, p_node->i_id,
!( i_mode & PLAYLIST_NO_REBUILD ) );
}
/* Actually convert an item to a node */
void ChangeToNode( playlist_t *p_playlist, playlist_item_t *p_item )
static void ChangeToNode( playlist_t *p_playlist, playlist_item_t *p_item )
{
int i;
if( p_item->i_children == -1 )
......@@ -586,8 +590,8 @@ void ChangeToNode( playlist_t *p_playlist, playlist_item_t *p_item )
}
/* Do the actual removal */
int DeleteInner( playlist_t * p_playlist, playlist_item_t *p_item,
vlc_bool_t b_stop )
static int DeleteInner( playlist_t * p_playlist, playlist_item_t *p_item,
vlc_bool_t b_stop )
{
int i;
int i_id = p_item->i_id;
......
......@@ -91,7 +91,8 @@ int playlist_MLDump( playlist_t *p_playlist );
* Item management
**********************************************************************/
void playlist_SendAddNotify( playlist_t *p_playlist, int i_item_id, int i_node_id );
void playlist_SendAddNotify( playlist_t *p_playlist, int i_item_id,
int i_node_id, vlc_bool_t b_signal );
/* Tree walking */
int playlist_GetAllEnabledChildren( playlist_t *p_playlist,
......
......@@ -46,10 +46,12 @@ playlist_item_t *GetPrevItem( playlist_t *p_playlist,
* \param p_playlist the playlist
* \paam psz_name the name of the node
* \param p_parent the parent node to attach to or NULL if no attach
* \param p_flags miscellaneous flags
* \return the new node
*/
playlist_item_t * playlist_NodeCreate( playlist_t *p_playlist, const char *psz_name,
playlist_item_t *p_parent )
playlist_item_t * playlist_NodeCreate( playlist_t *p_playlist,
const char *psz_name,
playlist_item_t *p_parent, int i_flags )
{
input_item_t *p_input;
playlist_item_t *p_item;
......@@ -68,7 +70,8 @@ playlist_item_t * playlist_NodeCreate( playlist_t *p_playlist, const char *psz_n
if( p_parent != NULL )
playlist_NodeAppend( p_playlist, p_item, p_parent );
playlist_SendAddNotify( p_playlist, p_item->i_id,
p_parent ? p_parent->i_id : -1 );
p_parent ? p_parent->i_id : -1,
!( i_flags & PLAYLIST_NO_REBUILD ));
return p_item;
}
......@@ -289,9 +292,9 @@ void playlist_NodesPairCreate( playlist_t *p_playlist, const char *psz_name,
vlc_bool_t b_for_sd )
{
*pp_node_cat = playlist_NodeCreate( p_playlist, psz_name,
p_playlist->p_root_category );
p_playlist->p_root_category, 0 );
*pp_node_one = playlist_NodeCreate( p_playlist, psz_name,
p_playlist->p_root_onelevel );
p_playlist->p_root_onelevel, 0 );
(*pp_node_one)->p_input->i_id = (*pp_node_cat)->p_input->i_id;
if( b_for_sd )
{
......
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