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