Commit 2531d514 authored by Jakob Leben's avatar Jakob Leben

various modules: adjust to new playlist design

parent 6b18cf4c
......@@ -480,6 +480,8 @@ static int GetTracks( access_t *p_access, input_item_t *p_current )
CDDA_DATA_SIZE * 1000000 / 44100 / 2 / 2;
input_item_SetDuration( p_current, i_duration );
input_item_node_t *p_root = input_item_node_Create( p_current );
/* Build title table */
for( int i = 0; i < i_titles; i++ )
{
......@@ -576,6 +578,7 @@ static int GetTracks( access_t *p_access, input_item_t *p_current )
input_item_SetTrackNum( p_input_item, psz_num );
input_item_AddSubItem( p_current, p_input_item );
input_item_node_AppendItem( p_root, p_input_item );
vlc_gc_decref( p_input_item );
free( psz_uri ); free( psz_opt ); free( psz_name );
free( psz_first ); free( psz_last );
......@@ -583,6 +586,9 @@ static int GetTracks( access_t *p_access, input_item_t *p_current )
#undef ON_EMPTY
#undef NONEMPTY
input_item_AddSubItemTree( p_root );
input_item_node_Delete( p_root );
/* */
for( int i = 0; i < i_cd_text; i++ )
{
......
......@@ -165,7 +165,10 @@ int MMSHOpen( access_t *p_access )
}
/** \bug we do not autodelete here */
p_new_loc = input_item_New( p_access, psz_location, psz_location );
input_item_AddSubItem( input_GetItem( p_input ), p_new_loc );
input_item_t *p_item = input_GetItem( p_input );
input_item_AddSubItem( p_item, p_new_loc );
input_item_AddSubItem2( p_item, p_new_loc );
vlc_gc_decref( p_new_loc );
vlc_object_release( p_input );
......
......@@ -370,6 +370,8 @@ static int Open( vlc_object_t * p_this )
input_thread_t *p_input = demux_GetParentInput( p_demux );
input_item_t *p_current = input_GetItem( p_input );
input_item_node_t *p_subitems = input_item_node_Create( p_current );
for( i = 0; i < i_count; i++ )
{
MP4_Box_t *p_rdrf = MP4_BoxGet( p_rmra, "rmda[%d]/rdrf", i );
......@@ -422,6 +424,7 @@ static int Open( vlc_object_t * p_this )
input_item_t *p_input = input_item_New( p_demux, psz_ref, NULL );
input_item_CopyOptions( p_current, p_input );
input_item_AddSubItem( p_current, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
}
else
......@@ -431,6 +434,8 @@ static int Open( vlc_object_t * p_this )
}
free( psz_ref );
}
input_item_AddSubItemTree( p_subitems );
input_item_node_Delete( p_subitems );
vlc_object_release( p_input );
}
......
......@@ -261,6 +261,8 @@ static int Demux( demux_t *p_demux )
if( p_sys->i_data_len <= 0 ) return -1;
}
input_item_node_t *p_subitems = input_item_node_Create( p_current_input );
psz_parse = p_sys->psz_data;
/* Find first element */
if( ( psz_parse = strcasestr( psz_parse, "<ASX" ) ) )
......@@ -472,6 +474,7 @@ static int Demux( demux_t *p_demux )
p_input = input_item_New( p_demux, psz_string, psz_title_asx );
input_item_CopyOptions( p_current_input, p_input );
input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
free( psz_string );
}
......@@ -570,6 +573,7 @@ static int Demux( demux_t *p_demux )
vlc_gc_decref( uniq_entry_ad_backup );
}
input_item_AddSubItem( p_current_input, p_entry );
input_item_node_AppendItem( p_subitems, p_entry );
vlc_gc_decref( p_entry );
}
}
......@@ -647,6 +651,7 @@ static int Demux( demux_t *p_demux )
if( psz_moreinfo_entry ) input_item_SetURL( p_entry, psz_moreinfo_entry );
if( psz_abstract_entry ) input_item_SetDescription( p_entry, psz_abstract_entry );
input_item_AddSubItem( p_current_input, p_entry );
input_item_node_AppendItem( p_subitems, p_entry );
vlc_gc_decref( p_entry );
}
......@@ -750,6 +755,7 @@ static int Demux( demux_t *p_demux )
msg_Dbg( p_demux, "added unique entry even if ad");
/* If ASX contains a unique entry, we add it, it is probably not an ad */
input_item_AddSubItem( p_current_input, uniq_entry_ad_backup );
input_item_node_AppendItem( p_subitems, uniq_entry_ad_backup );
vlc_gc_decref( uniq_entry_ad_backup);
}
#if 0
......@@ -761,6 +767,10 @@ static int Demux( demux_t *p_demux )
STARTMARK
#endif
}
input_item_AddSubItemTree( p_subitems );
input_item_node_Delete( p_subitems );
vlc_gc_decref(p_current_input);
return 0; /* Needed for correct operation of go back */
}
......
......@@ -80,6 +80,7 @@ static int Demux( demux_t *p_demux )
input_item_t *p_input;
char *psz_mrl = NULL, *psz_title = NULL, *psz_genre = NULL;
char *psz_now = NULL, *psz_listeners = NULL, *psz_bitrate = NULL;
input_item_node_t *p_subitems = NULL;
input_item_t *p_current_input = GetCurrentItem(p_demux);
......@@ -161,6 +162,8 @@ static int Demux( demux_t *p_demux )
free( psz_value );
}
p_subitems = input_item_node_Create( p_current_input );
while( (i_ret = xml_ReaderRead( p_xml_reader )) == 1 )
{
// Get the node type
......@@ -265,6 +268,7 @@ static int Demux( demux_t *p_demux )
msg_Err( p_demux, "Unsupported meta bitrate" );
input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
FREENULL( psz_title );
FREENULL( psz_mrl );
......@@ -290,6 +294,12 @@ static int Demux( demux_t *p_demux )
end:
free( psz_elname );
if( p_subitems )
{
input_item_AddSubItemTree( p_subitems );
input_item_node_Delete( p_subitems );
}
vlc_gc_decref( p_current_input );
if( p_xml_reader )
xml_ReaderDelete( p_xml, p_xml_reader );
......
......@@ -102,6 +102,8 @@ static int Demux( demux_t *p_demux )
input_item_t *p_input;
input_item_t *p_current_input = GetCurrentItem(p_demux);
input_item_node_t *p_subitems = input_item_node_Create( p_current_input );
while( (psz_line = stream_ReadLine( p_demux->s )) )
{
char **ppsz_options = NULL;
......@@ -121,6 +123,7 @@ static int Demux( demux_t *p_demux )
p_input = input_item_NewExt( p_demux, "dvb://", psz_name,
i_options, (const char**)ppsz_options, VLC_INPUT_OPTION_TRUSTED, -1 );
input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
while( i_options-- )
......@@ -130,6 +133,9 @@ static int Demux( demux_t *p_demux )
free( psz_line );
}
input_item_AddSubItemTree( p_subitems );
input_item_node_Delete( p_subitems );
vlc_gc_decref(p_current_input);
return 0; /* Needed for correct operation of go back */
}
......
......@@ -131,6 +131,8 @@ static int Demux( demux_t *p_demux )
input_item_t *p_current_input = GetCurrentItem(p_demux);
input_item_node_t *p_subitems = input_item_node_Create( p_current_input );
p_sys->p_current_input = p_current_input;
while( ( psz_line = stream_ReadLine( p_demux->s ) ) )
......@@ -209,9 +211,13 @@ static int Demux( demux_t *p_demux )
SADD_INFO( "docid", psz_docid );
SADD_INFO( "description", psz_description );
input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
}
input_item_AddSubItemTree( p_subitems );
input_item_node_Delete( p_subitems );
vlc_gc_decref(p_current_input);
free( psz_version );
......
......@@ -111,6 +111,7 @@ static int Demux( demux_t *p_demux )
input_item_t *p_current_input = GetCurrentItem(p_demux);
input_item_t *p_input = input_item_New( p_demux, psz_url, psz_url );
input_item_AddSubItem( p_current_input, p_input );
input_item_AddSubItem2( p_current_input, p_input );
vlc_gc_decref( p_input );
vlc_gc_decref(p_current_input);
......@@ -133,6 +134,8 @@ static int DemuxDVD_VR( demux_t *p_demux )
input_item_t *p_current_input = GetCurrentItem(p_demux);
input_item_t *p_input = input_item_New( p_demux, psz_url, psz_url );
input_item_AddSubItem( p_current_input, p_input );
input_item_AddSubItem2( p_current_input, p_input );
vlc_gc_decref( p_input );
vlc_gc_decref(p_current_input);
......
......@@ -145,6 +145,7 @@ static int Demux( demux_t *p_demux )
input_item_t *p_input;
input_item_t *p_current_input = GetCurrentItem(p_demux);
input_item_node_t *p_subitems = input_item_node_Create( p_current_input );
psz_line = stream_ReadLine( p_demux->s );
while( psz_line )
......@@ -227,6 +228,7 @@ static int Demux( demux_t *p_demux )
if( psz_name ) input_item_SetTitle( p_input, psz_name );
input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
}
......@@ -253,6 +255,8 @@ static int Demux( demux_t *p_demux )
b_cleanup = false;
}
}
input_item_AddSubItemTree( p_subitems );
input_item_node_Delete( p_subitems );
vlc_gc_decref(p_current_input);
var_Destroy( p_demux, "m3u-extvlcopt" );
return 0; /* Needed for correct operation of go back */
......
......@@ -93,6 +93,8 @@ static int Demux( demux_t *p_demux )
input_item_t *p_current_input = GetCurrentItem(p_demux);
input_item_node_t *p_subitems = input_item_node_Create( p_current_input );
while( ( psz_line = stream_ReadLine( p_demux->s ) ) )
{
if( !strncasecmp( psz_line, "[playlist]", sizeof("[playlist]")-1 ) ||
......@@ -162,6 +164,7 @@ static int Demux( demux_t *p_demux )
p_input = input_item_New( p_demux, psz_mrl, psz_name );
input_item_CopyOptions( p_current_input, p_input );
input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
}
else
......@@ -217,6 +220,7 @@ static int Demux( demux_t *p_demux )
p_input = input_item_New( p_demux, psz_mrl, psz_name );
input_item_CopyOptions( p_current_input, p_input );
input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
free( psz_mrl_orig );
psz_mrl = NULL;
......@@ -228,6 +232,9 @@ static int Demux( demux_t *p_demux )
free( psz_name );
psz_name = NULL;
input_item_AddSubItemTree( p_subitems );
input_item_node_Delete( p_subitems );
vlc_gc_decref(p_current_input);
return 0; /* Needed for correct operation of go back */
}
......
......@@ -90,6 +90,7 @@ static int Demux( demux_t *p_demux )
char *psz_art_url = NULL;
int i_type;
input_item_t *p_input;
input_item_node_t *p_subitems = NULL;
input_item_t *p_current_input = GetCurrentItem(p_demux);
......@@ -128,6 +129,8 @@ static int Demux( demux_t *p_demux )
}
FREENULL( psz_elname );
p_subitems = input_item_node_Create( p_current_input );
while( (i_ret = xml_ReaderRead( p_xml_reader )) == 1 )
{
// Get the node type
......@@ -329,6 +332,7 @@ static int Demux( demux_t *p_demux )
psz_item_size );
}
input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
FREENULL( psz_item_name );
FREENULL( psz_item_mrl );
......@@ -365,6 +369,8 @@ static int Demux( demux_t *p_demux )
xml_ReaderDelete( p_xml, p_xml_reader );
xml_Delete( p_xml );
input_item_AddSubItemTree( p_subitems );
input_item_node_Delete( p_subitems );
vlc_gc_decref(p_current_input);
return 0; /* Needed for correct operation of go back */
......@@ -387,6 +393,11 @@ error:
xml_ReaderDelete( p_xml, p_xml_reader );
if( p_xml )
xml_Delete( p_xml );
if( p_subitems )
{
input_item_AddSubItemTree( p_subitems );
input_item_node_Delete( p_subitems );
}
vlc_gc_decref(p_current_input);
return -1;
......
......@@ -304,19 +304,24 @@ static int Demux( demux_t *p_demux )
}
else
{
input_item_node_t *p_subitems = input_item_node_Create( p_current_input );
p_input = input_item_New( p_demux, psz_src, psz_moviename );
#define SADD_INFO( type, field ) if( field ) { input_item_AddInfo( \
p_input, "QuickTime Media Link", type, "%s", field ) ; }
SADD_INFO( "href", psz_href );
SADD_INFO( _("Mime"), psz_mimetype );
input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
if( psz_qtnext )
{
p_input = input_item_New( p_demux, psz_qtnext, NULL );
input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
}
input_item_AddSubItemTree( p_subitems );
input_item_node_Delete( p_subitems );
}
i_ret = 0; /* Needed for correct operation of go back */
......
......@@ -214,6 +214,8 @@ static int Demux( demux_t *p_demux )
input_item_t *p_current_input = GetCurrentItem(p_demux);
input_item_node_t *p_subitems = input_item_node_Create( p_current_input );
psz_line = stream_ReadLine( p_demux->s );
while( psz_line )
{
......@@ -326,6 +328,7 @@ static int Demux( demux_t *p_demux )
if( !EMPTY_STR( psz_comments ) ) input_item_SetDescription( p_input, psz_comments );
input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
free( psz_mrl );
}
......@@ -358,6 +361,8 @@ static int Demux( demux_t *p_demux )
b_cleanup = false;
}
}
input_item_AddSubItemTree( p_subitems );
input_item_node_Delete( p_subitems );
vlc_gc_decref(p_current_input);
var_Destroy( p_demux, "m3u-extvlcopt" );
return 0; /* Needed for correct operation of go back */
......
......@@ -403,6 +403,7 @@ static int Demux ( demux_t *p_demux )
input_item_AddOption( p_child, "rtsp-kasenna", VLC_INPUT_OPTION_TRUSTED );
input_item_AddSubItem( p_current_input, p_child );
input_item_AddSubItem2( p_current_input, p_child );
vlc_gc_decref( p_child );
vlc_gc_decref(p_current_input);
return 0; /* Needed for correct operation of go back */
......
......@@ -48,9 +48,9 @@ static int Demux( demux_t *p_demux);
static int Control( demux_t *p_demux, int i_query, va_list args );
static int DemuxGenre( demux_t *p_demux, xml_reader_t *p_xml_reader,
input_item_t *p_current_input );
input_item_node_t *p_input_node );
static int DemuxStation( demux_t *p_demux, xml_reader_t *p_xml_reader,
input_item_t *p_current_input, bool b_adult );
input_item_node_t *p_input_node, bool b_adult );
/*****************************************************************************
* Import_Shoutcast: main import function
......@@ -110,20 +110,24 @@ static int Demux( demux_t *p_demux )
goto error;
}
input_item_node_t *p_input_node = input_item_node_Create( p_current_input );
if( !strcmp( psz_eltname, "genrelist" ) )
{
/* we're reading a genre list */
if( DemuxGenre( p_demux, p_xml_reader, p_current_input ) )
if( DemuxGenre( p_demux, p_xml_reader, p_input_node ) )
goto error;
}
else
{
/* we're reading a station list */
if( DemuxStation( p_demux, p_xml_reader, p_current_input,
if( DemuxStation( p_demux, p_xml_reader, p_input_node,
var_CreateGetBool( p_demux, "shoutcast-show-adult" ) ) )
goto error;
}
input_item_AddSubItemTree( p_input_node );
i_ret = 0; /* Needed for correct operation of go back */
error:
......@@ -132,6 +136,7 @@ error:
if( p_xml )
xml_Delete( p_xml );
free( psz_eltname );
input_item_node_Delete( p_input_node );
vlc_gc_decref(p_current_input);
return i_ret;
}
......@@ -148,7 +153,7 @@ error:
* </genrelist>
**/
static int DemuxGenre( demux_t *p_demux, xml_reader_t *p_xml_reader,
input_item_t *p_current_input )
input_item_node_t *p_input_node )
{
char *psz_name = NULL; /* genre name */
int i_ret = -1;
......@@ -219,9 +224,10 @@ static int DemuxGenre( demux_t *p_demux, xml_reader_t *p_xml_reader,
{
input_item_t *p_input;
p_input = input_item_New( p_demux, psz_mrl, psz_name );
input_item_CopyOptions( p_current_input, p_input );
input_item_CopyOptions( p_input_node->p_item, p_input );
free( psz_mrl );
input_item_AddSubItem( p_current_input, p_input );
input_item_AddSubItem( p_input_node->p_item, p_input );
input_item_node_AppendItem( p_input_node, p_input );
vlc_gc_decref( p_input );
}
FREENULL( psz_name );
......@@ -264,7 +270,7 @@ error:
* </stationlist>
**/
static int DemuxStation( demux_t *p_demux, xml_reader_t *p_xml_reader,
input_item_t *p_current_input, bool b_adult )
input_item_node_t *p_input_node, bool b_adult )
{
char *psz_base = NULL; /* */
......@@ -395,7 +401,7 @@ static int DemuxStation( demux_t *p_demux, xml_reader_t *p_xml_reader,
/* Create the item */
input_item_t *p_input;
p_input = input_item_New( p_demux, psz_mrl, psz_name );
input_item_CopyOptions( p_current_input, p_input );
input_item_CopyOptions( p_input_node->p_item, p_input );
free( psz_mrl );
#define SADD_INFO( type, field ) \
......@@ -412,7 +418,8 @@ static int DemuxStation( demux_t *p_demux, xml_reader_t *p_xml_reader,
input_item_SetNowPlaying( p_input, psz_ct );
if( psz_rt )
input_item_SetRating( p_input, psz_rt );
input_item_AddSubItem( p_current_input, p_input );
input_item_AddSubItem( p_input_node->p_item, p_input );
input_item_node_AppendItem( p_input_node, p_input );
vlc_gc_decref( p_input );
FREENULL( psz_base );
FREENULL( psz_name );
......
......@@ -78,6 +78,8 @@ static int Demux( demux_t *p_demux )
char *psz_line;
input_item_t *p_current_input = GetCurrentItem(p_demux);
input_item_node_t *p_subitems = input_item_node_Create( p_current_input );
while( (psz_line = stream_ReadLine( p_demux->s )) )
{
char *psz_parse = psz_line;
......@@ -101,6 +103,8 @@ static int Demux( demux_t *p_demux )
p_input = input_item_NewExt( p_demux, psz_uri, psz_uri,
0, NULL, 0, -1 );
input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
}
}
......@@ -108,6 +112,10 @@ static int Demux( demux_t *p_demux )
free( psz_line );
}
input_item_AddSubItemTree( p_subitems );
input_item_node_Delete( p_subitems );
vlc_gc_decref(p_current_input);
var_Destroy( p_demux, "wpl-extvlcopt" );
return 0; /* Needed for correct operation of go back */
......
......@@ -103,6 +103,8 @@ static int Demux( demux_t *p_demux )
psz_line = stream_ReadLine( p_demux->s );
}
input_item_node_t *p_subitems = input_item_node_Create( p_current_input );
/* Loop on all lines */
while( psz_line )
{
......@@ -167,6 +169,7 @@ static int Demux( demux_t *p_demux )
input_item_t *p_input = input_item_NewExt( p_demux, psz_mrl,
psz_title, 0, NULL, 0, i_duration );
input_item_AddSubItem( p_current_input, p_input );
input_item_node_AppendItem( p_subitems, p_input );
FREENULL( psz_mrl );
FREENULL( psz_title );
i_duration = -1;
......@@ -189,6 +192,7 @@ static int Demux( demux_t *p_demux )
SET( psz_copyright, Copyright );
#undef SET
vlc_gc_decref( p_input );
}
else
msg_Warn( p_demux, "invalid line '%s'", psz_parse );
......@@ -198,6 +202,9 @@ static int Demux( demux_t *p_demux )
psz_line = stream_ReadLine( p_demux->s );
}
input_item_AddSubItemTree( p_subitems );
input_item_node_Delete( p_subitems );
vlc_gc_decref(p_current_input);
var_Destroy( p_demux, "zpl-extvlcopt" );
return 0; /* Needed for correct operation of go back */
......
......@@ -1279,13 +1279,12 @@
if( !p_input ) continue;
/* Add the item */
/* FIXME: playlist_BothAddInput() can fail */
PL_LOCK;
playlist_BothAddInput( p_playlist, p_input, p_node,
playlist_NodeAddInput( p_playlist, p_input, p_node,
PLAYLIST_INSERT,
i_position == -1 ?
PLAYLIST_END : i_position + i_item,
NULL, NULL, pl_Locked );
pl_Locked );
if( i_item == 0 && !b_enqueue )
......
......@@ -79,8 +79,8 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
/* Initialisation of the playlist */
playlist_t * p_playlist = THEPL;
PL_LOCK;
playlist_item_t *p_root =
playlist_GetPreferredNode( THEPL, THEPL->p_local_category );
playlist_item_t *p_root = THEPL->p_playing;
PL_UNLOCK;
rightPanel = new StandardPLPanel( this, p_intf, THEPL, p_root );
......
......@@ -230,9 +230,6 @@ void StandardPLPanel::setRoot( playlist_item_t *p_item )
QPL_LOCK;
assert( p_item );
playlist_item_t *p_pref_item = playlist_GetPreferredNode( THEPL, p_item );
if( p_pref_item ) p_item = p_pref_item;
/* needed for popupAdd() */
currentRootId = p_item->i_id;
......@@ -437,9 +434,16 @@ void StandardPLPanel::browseInto( input_item_t *p_input )
playlist_Lock( THEPL );
playlist_item_t *p_item = playlist_ItemGetByInput( THEPL, p_input );
assert( p_item != NULL );
if( !p_item )
{
playlist_Unlock( THEPL );
return;
}
QModelIndex index = model->index( p_item->i_id, 0 );
playlist_Unlock( THEPL );
if( currentView == iconView ) {
iconView->setRootIndex( index );
locationBar->setIndex( index );
......@@ -449,7 +453,7 @@ void StandardPLPanel::browseInto( input_item_t *p_input )
last_activated_id = -1;
playlist_Unlock( THEPL );
}
LocationBar::LocationBar( PLModel *m )
......
......@@ -473,7 +473,10 @@ int __vlclua_playlist_add_internal( vlc_object_t *p_this, lua_State *L,
/* Append item to playlist */
if( p_parent ) /* Add to node */
{
input_item_AddSubItem( p_parent, p_input );
input_item_AddSubItem2( p_parent, p_input );
}
else /* Play or Enqueue (preparse) */
/* FIXME: playlist_AddInput() can fail */
playlist_AddInput( p_playlist, p_input,
......
......@@ -204,8 +204,8 @@ void UPnPHandler::AddContent( playlist_item_t *p_parent, ContentNode *node )
ItemNode *iNode = (ItemNode *)node