Commit 84218f98 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

modules/demux/playlist/*.c: Use the new playlist independant way to announce sub items.

parent 609a1146
......@@ -460,12 +460,8 @@ static int Demux( demux_t *p_demux )
memcpy( psz_string, psz_backup, i_strlen );
psz_string[i_strlen] = '\0';
p_input = input_ItemNew( p_playlist, psz_string, psz_title_asx );
input_ItemCopyOptions( p_current->p_input, p_input );
playlist_BothAddInput( p_playlist, p_input,
p_item_in_category,
PLAYLIST_APPEND|PLAYLIST_SPREPARSE,
PLAYLIST_END, NULL, NULL,
VLC_FALSE);
input_ItemCopyOptions( p_current_input, p_input );
input_ItemAddSubItem( p_current_input, p_input );
free( psz_string );
}
else continue;
......@@ -501,7 +497,7 @@ static int Demux( demux_t *p_demux )
if( p_sys->b_skip_ads && b_skip_entry )
{
msg_Dbg( p_demux, "skipped entry %d %s (%s)",
i_entry_count, ( psz_title_entry ? psz_title_entry : p_current->p_input->psz_name ), psz_href );
i_entry_count, ( psz_title_entry ? psz_title_entry : p_current_input->psz_name ), psz_href );
}
else
{
......@@ -518,11 +514,11 @@ static int Demux( demux_t *p_demux )
}
/* create the new entry */
asprintf( &psz_name, "%d %s", i_entry_count, ( psz_title_entry ? psz_title_entry : p_current->p_input->psz_name ) );
asprintf( &psz_name, "%d %s", i_entry_count, ( psz_title_entry ? psz_title_entry : p_current_input->psz_name ) );
p_entry = input_ItemNewExt( p_playlist, psz_href, psz_name, i_options, (const char * const *)ppsz_options, -1 );
FREENULL( psz_name );
input_ItemCopyOptions( p_current->p_input, p_entry );
input_ItemCopyOptions( p_current_input, p_entry );
while( i_options )
{
psz_name = ppsz_options[--i_options];
......@@ -534,11 +530,7 @@ static int Demux( demux_t *p_demux )
if( psz_copyright_entry ) input_item_SetCopyright( p_entry, psz_copyright_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 );
playlist_BothAddInput( p_playlist, p_entry,
p_item_in_category,
PLAYLIST_APPEND | PLAYLIST_SPREPARSE
, PLAYLIST_END, NULL, NULL,
VLC_FALSE );
input_ItemAddSubItem( p_current_input, p_entry );
}
/* cleanup entry */
......@@ -675,13 +667,13 @@ static int Demux( demux_t *p_demux )
}
else if( !strncasecmp( psz_parse, "</ASX", 5 ) )
{
vlc_mutex_lock( &p_current->p_input->lock );
if( psz_title_asx ) input_item_SetTitle( p_current->p_input, psz_title_asx );
if( psz_artist_asx ) input_item_SetArtist( p_current->p_input, psz_artist_asx );
if( psz_copyright_asx ) input_item_SetCopyright( p_current->p_input, psz_copyright_asx );
if( psz_moreinfo_asx ) input_item_SetURL( p_current->p_input, psz_moreinfo_asx );
if( psz_abstract_asx ) input_item_SetDescription( p_current->p_input, psz_abstract_asx );
vlc_mutex_unlock( &p_current->p_input->lock );
vlc_mutex_lock( &p_current_input->lock );
if( psz_title_asx ) input_item_SetTitle( p_current_input, psz_title_asx );
if( psz_artist_asx ) input_item_SetArtist( p_current_input, psz_artist_asx );
if( psz_copyright_asx ) input_item_SetCopyright( p_current_input, psz_copyright_asx );
if( psz_moreinfo_asx ) input_item_SetURL( p_current_input, psz_moreinfo_asx );
if( psz_abstract_asx ) input_item_SetDescription( p_current_input, psz_abstract_asx );
vlc_mutex_unlock( &p_current_input->lock );
FREENULL( psz_base_asx );
FREENULL( psz_title_asx );
FREENULL( psz_artist_asx );
......
......@@ -155,7 +155,7 @@ static int Demux( demux_t *p_demux )
}
else if( !strcmp( psz_name, "label" ) )
{
playlist_ItemSetName( p_current, psz_value );
input_ItemSetName( p_current_input, psz_value );
}
else
{
......@@ -266,10 +266,7 @@ static int Demux( demux_t *p_demux )
if( psz_bitrate )
msg_Err( p_playlist, "Unsupported meta bitrate" );
playlist_BothAddInput( p_playlist, p_input,
p_item_in_category,
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END, NULL, NULL, VLC_FALSE );
input_ItemAddSubItem( p_current_input, p_input );
FREENULL( psz_name );
FREENULL( psz_mrl );
FREENULL( psz_genre );
......
......@@ -118,9 +118,7 @@ static int Demux( demux_t *p_demux )
EnsureUTF8( ppsz_options[i] );
input_ItemAddOption( p_input, ppsz_options[i] );
}
playlist_BothAddInput( p_playlist, p_input, p_item_in_category,
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END, NULL, NULL, VLC_FALSE );
input_ItemAddSubItem( p_current_input, p_input );
while( i_options-- ) free( ppsz_options[i_options] );
if( ppsz_options ) free( ppsz_options );
......
......@@ -59,8 +59,7 @@ description:The now infamous Apple Macintosh commercial aired during the 1984 Su
struct demux_sys_t
{
playlist_t *p_playlist;
playlist_item_t *p_current;
playlist_item_t *p_item_in_category;
input_item_t *p_current_input;
};
/*****************************************************************************
......@@ -132,8 +131,7 @@ static int Demux( demux_t *p_demux )
INIT_PLAYLIST_STUFF;
p_sys->p_playlist = p_playlist;
p_sys->p_current = p_current;
p_sys->p_item_in_category = p_item_in_category;
p_sys->p_current_input = p_current_input;
while( ( psz_line = stream_ReadLine( p_demux->s ) ) )
{
......@@ -212,10 +210,7 @@ static int Demux( demux_t *p_demux )
SADD_INFO( "gvp_version", psz_version );
SADD_INFO( "docid", psz_docid );
SADD_INFO( "description", psz_description );
playlist_BothAddInput( p_sys->p_playlist, p_input,
p_sys->p_item_in_category,
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END, NULL, NULL, VLC_FALSE );
input_ItemAddSubItem( p_current_input, p_input );
}
HANDLE_PLAY_AND_RELEASE;
......
......@@ -94,10 +94,7 @@ static int Demux( demux_t *p_demux )
snprintf( psz_url, len+1, "dvd://%s", p_demux->psz_path );
p_input = input_ItemNewExt( p_playlist, psz_url, psz_url, 0, NULL, -1 );
playlist_BothAddInput( p_playlist, p_input,
p_item_in_category,
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END, NULL, NULL, VLC_FALSE );
input_ItemAddSubItem( p_current_input, p_input );
HANDLE_PLAY_AND_RELEASE;
......
......@@ -295,7 +295,7 @@ int E_(Import_LuaPlaylist)( vlc_object_t *p_this )
# if defined(__APPLE__) || defined(SYS_BEOS) || defined(WIN32)
{
const char *psz_vlcpath = config_GetDataDir();
const char *psz_vlcpath = NULL;//config_GetDataDir();
if( asprintf( &ppsz_dir_list[1], "%s" DIR_SEP "luaplaylist", psz_vlcpath ) < 0 )
return VLC_ENOMEM;
if( asprintf( &ppsz_dir_list[2], "%s" DIR_SEP "share" DIR_SEP "luaplaylist", psz_vlcpath ) < 0 )
......@@ -643,11 +643,7 @@ static int Demux( demux_t *p_demux )
p_input );
/* Append item to playlist */
playlist_BothAddInput(
p_playlist, p_input,
p_item_in_category,
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END, NULL, NULL, VLC_FALSE );
input_ItemAddSubItem( p_current_input, p_input );
while( i_options > 0 )
free( ppsz_options[--i_options] );
......
......@@ -185,9 +185,7 @@ static int Demux( demux_t *p_demux )
if ( psz_artist && *psz_artist )
input_ItemAddInfo( p_input, _(VLC_META_INFO_CAT),
_(VLC_META_ARTIST), "%s", psz_artist );
playlist_BothAddInput( p_playlist, p_input, p_item_in_category,
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END, NULL, NULL, VLC_FALSE );
input_ItemAddSubItem( p_current_input, p_input );
free( psz_mrl );
}
......
......@@ -75,22 +75,10 @@ void E_(Close_VideoPortal) ( vlc_object_t * );
#define INIT_PLAYLIST_STUFF \
playlist_t *p_playlist = pl_Yield( p_demux ); \
vlc_bool_t b_play = var_CreateGetBool( p_demux, "playlist-autostart" ); \
input_thread_t *p_input_thread = (input_thread_t *)vlc_object_find( p_demux, VLC_OBJECT_INPUT, FIND_PARENT ); \
input_item_t *p_current_input = input_GetItem( p_input_thread ); \
playlist_item_t *p_current = \
playlist_ItemGetByInput( p_playlist, p_current_input, VLC_FALSE ); \
playlist_item_t *p_item_in_category = \
playlist_ItemToNode( p_playlist, p_current, \
VLC_TRUE ); \
b_play = b_play && p_current == p_playlist->status.p_item; \
if( p_item_in_category ) \
p_item_in_category->p_input->i_type = ITEM_TYPE_PLAYLIST;
input_item_t *p_current_input = input_GetItem( p_input_thread );
#define HANDLE_PLAY_AND_RELEASE \
/* Go back and play the playlist */ \
if( b_play && p_item_in_category ) \
playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, VLC_TRUE, p_item_in_category, NULL ); \
vlc_object_release( p_input_thread ); \
vlc_object_release( p_playlist );
......@@ -160,10 +160,8 @@ static int Demux( demux_t *p_demux )
{
p_input = input_ItemNewExt( p_playlist, psz_mrl, psz_name,
0, NULL, -1 );
input_ItemCopyOptions( p_current->p_input, p_input );
playlist_BothAddInput( p_playlist, p_input, p_item_in_category,
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END, NULL, NULL, VLC_FALSE );
input_ItemCopyOptions( p_current_input, p_input );
input_ItemAddSubItem( p_current_input, p_input );
}
else
{
......@@ -221,10 +219,8 @@ static int Demux( demux_t *p_demux )
if( psz_mrl )
{
p_input = input_ItemNewExt( p_playlist, psz_mrl, psz_name,0, NULL, -1 );
input_ItemCopyOptions( p_current->p_input, p_input );
playlist_BothAddInput( p_playlist, p_input, p_item_in_category,
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END, NULL, NULL, VLC_FALSE );
input_ItemCopyOptions( p_current_input, p_input );
input_ItemAddSubItem( p_current_input, p_input );
free( psz_mrl_orig );
psz_mrl = NULL;
}
......
......@@ -229,12 +229,12 @@ static int Demux( demux_t *p_demux )
else if( b_item == VLC_FALSE && b_image == VLC_FALSE
&& !strcmp( psz_elname, "title" ) )
{
playlist_ItemSetName( p_current, psz_text );
input_ItemSetName( p_current_input, psz_text );
}
#define ADD_GINFO( info, name ) \
else if( !b_item && !b_image && !strcmp( psz_elname, name ) ) \
{ \
input_ItemAddInfo( p_current->p_input, _("Podcast Info"), \
input_ItemAddInfo( p_current_input, _("Podcast Info"), \
_( info ), "%s", psz_text ); \
}
ADD_GINFO( "Podcast Link", "link" )
......@@ -247,7 +247,7 @@ static int Demux( demux_t *p_demux )
&& ( !strcmp( psz_elname, "itunes:summary" )
||!strcmp( psz_elname, "description" ) ) )
{ /* <description> isn't standard iTunes podcast stuff */
input_ItemAddInfo( p_current->p_input,
input_ItemAddInfo( p_current_input,
_( "Podcast Info" ), _( "Podcast Summary" ),
"%s", psz_text );
}
......@@ -290,10 +290,7 @@ static int Demux( demux_t *p_demux )
"%s bytes",
psz_item_size );
}
playlist_BothAddInput( p_playlist, p_input,
p_item_in_category,
PLAYLIST_APPEND | PLAYLIST_SPREPARSE
, PLAYLIST_END, NULL, NULL, VLC_FALSE );
input_ItemAddSubItem( p_current_input, p_input );
FREENULL( psz_item_name );
FREENULL( psz_item_mrl );
FREENULL( psz_item_size );
......
......@@ -58,8 +58,7 @@ volume - 0 (mute) - 100 (max)
struct demux_sys_t
{
playlist_t *p_playlist;
playlist_item_t *p_current;
playlist_item_t *p_item_in_category;
input_item_t *p_current_input;
xml_t *p_xml;
xml_reader_t *p_xml_reader;
......@@ -138,8 +137,7 @@ static int Demux( demux_t *p_demux )
INIT_PLAYLIST_STUFF;
p_sys->p_playlist = p_playlist;
p_sys->p_current = p_current;
p_sys->p_item_in_category = p_item_in_category;
p_sys->p_current_input = p_current_input;
p_xml = p_sys->p_xml = xml_Create( p_demux );
if( !p_xml ) return -1;
......@@ -359,18 +357,12 @@ static int Demux( demux_t *p_demux )
p_input, "QuickTime Media Link", _(type), "%s", field ) ; }
SADD_INFO( "href", psz_href );
SADD_INFO( "mime type", psz_mimetype );
playlist_BothAddInput( p_sys->p_playlist, p_input,
p_sys->p_item_in_category,
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END, NULL, NULL, VLC_FALSE );
input_ItemAddSubItem( p_current_input, p_input );
if( psz_qtnext )
{
p_input = input_ItemNewExt( p_sys->p_playlist,
psz_qtnext, NULL, 0, NULL, -1 );
playlist_BothAddInput( p_sys->p_playlist, p_input,
p_sys->p_item_in_category,
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END, NULL, NULL, VLC_FALSE );
input_ItemAddSubItem( p_current_input, p_input );
}
}
......
......@@ -382,7 +382,7 @@ static int Demux ( demux_t *p_demux )
return VLC_EGENERIC;
}
input_ItemCopyOptions( p_current->p_input, p_child );
input_ItemCopyOptions( p_current_input, p_child );
if( p_sys->i_packet_size && p_sys->psz_mcast_ip )
{
char *psz_option;
......@@ -406,9 +406,7 @@ static int Demux ( demux_t *p_demux )
free( psz_option );
}
playlist_BothAddInput( p_playlist, p_child, p_item_in_category,
PLAYLIST_APPEND | PLAYLIST_SPREPARSE, PLAYLIST_END,
NULL, NULL, VLC_FALSE );
input_ItemAddSubItem( p_current_input, p_child );
HANDLE_PLAY_AND_RELEASE
return -1; /* Needed for correct operation of go back */
}
......
......@@ -37,8 +37,7 @@
struct demux_sys_t
{
playlist_t *p_playlist;
playlist_item_t *p_current;
playlist_item_t *p_item_in_category;
input_item_t *p_current_input;
xml_t *p_xml;
xml_reader_t *p_xml_reader;
......@@ -108,8 +107,7 @@ static int Demux( demux_t *p_demux )
char *psz_eltname = NULL;
INIT_PLAYLIST_STUFF;
p_sys->p_playlist = p_playlist;
p_sys->p_current = p_current;
p_sys->p_item_in_category = p_item_in_category;
p_sys->p_current_input = p_current_input;
p_xml = p_sys->p_xml = xml_Create( p_demux );
if( !p_xml ) return -1;
......@@ -236,13 +234,10 @@ static int DemuxGenre( demux_t *p_demux )
psz_name );
p_input = input_ItemNewExt( p_sys->p_playlist, psz_mrl,
psz_name, 0, NULL, -1 );
input_ItemCopyOptions( p_sys->p_current->p_input,
input_ItemCopyOptions( p_sys->p_current_input,
p_input );
free( psz_mrl );
playlist_BothAddInput( p_sys->p_playlist, p_input,
p_sys->p_item_in_category,
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END, NULL, NULL, VLC_FALSE );
input_ItemAddSubItem( p_sys->p_current_input, p_input );
FREENULL( psz_name );
}
FREENULL( psz_eltname );
......@@ -414,7 +409,7 @@ static int DemuxStation( demux_t *p_demux )
psz_name , 0, NULL, -1 );
free( psz_mrl );
input_ItemCopyOptions( p_sys->p_current->p_input,
input_ItemCopyOptions( p_sys->p_current_input,
p_input );
#define SADD_INFO( type, field ) if( field ) { input_ItemAddInfo( \
......@@ -429,11 +424,7 @@ static int DemuxStation( demux_t *p_demux )
input_item_SetNowPlaying( p_input, psz_ct );
if( psz_rt )
input_item_SetRating( p_input, psz_rt );
playlist_BothAddInput( p_sys->p_playlist, p_input,
p_sys->p_item_in_category,
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END, NULL, NULL, VLC_FALSE );
input_ItemAddSubItem( p_sys->p_current_input, p_input );
FREENULL( psz_name );
FREENULL( psz_mt )
......
......@@ -75,7 +75,6 @@ int Demux( demux_t *p_demux )
xml_reader_t *p_xml_reader = NULL;
char *psz_name = NULL;
INIT_PLAYLIST_STUFF;
p_demux->p_sys->p_item_in_category = p_item_in_category;
p_demux->p_sys->pp_tracklist = NULL;
p_demux->p_sys->i_tracklist_entries = 0;
p_demux->p_sys->i_identifier = 0;
......@@ -117,7 +116,7 @@ int Demux( demux_t *p_demux )
FREE_NAME();
}
i_ret = parse_playlist_node( p_demux, p_playlist, p_current, NULL,
i_ret = parse_playlist_node( p_demux, p_playlist, p_current_input,
p_xml_reader, "playlist" );
HANDLE_PLAY_AND_RELEASE;
if( p_xml_reader )
......@@ -137,8 +136,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
* \brief parse the root node of a XSPF playlist
* \param p_demux demuxer instance
* \param p_playlist playlist instance
* \param p_item current playlist item
* \param p_input current input item
* \param p_input_item current input item
* \param p_xml_reader xml reader instance
* \param psz_element name of element to parse
*/
......@@ -236,7 +234,7 @@ static vlc_bool_t parse_playlist_node COMPLEX_INTERFACE
{
if( p_handler->pf_handler.cmplx( p_demux,
p_playlist,
p_item,NULL,
p_input_item,
p_xml_reader,
p_handler->name ) )
{
......@@ -290,7 +288,7 @@ static vlc_bool_t parse_playlist_node COMPLEX_INTERFACE
if( p_handler->pf_handler.smpl )
{
p_handler->pf_handler.smpl( p_item, NULL, p_handler->name,
p_handler->pf_handler.smpl( p_input_item, p_handler->name,
psz_value );
}
FREE_ATT();
......@@ -340,7 +338,7 @@ static vlc_bool_t parse_tracklist_node COMPLEX_INTERFACE
FREE_NAME();
/* parse the track data in a separate function */
if( parse_track_node( p_demux, p_playlist, p_item, NULL,
if( parse_track_node( p_demux, p_playlist, p_input_item,
p_xml_reader,"track" ) == VLC_TRUE )
i_ntracks++;
}
......@@ -439,7 +437,7 @@ static vlc_bool_t parse_track_node COMPLEX_INTERFACE
}
if( p_handler->pf_handler.cmplx( p_demux,
p_playlist,
NULL, p_new_input,
p_new_input,
p_xml_reader,
p_handler->name ) )
{
......@@ -479,10 +477,7 @@ static vlc_bool_t parse_track_node COMPLEX_INTERFACE
if( !strcmp( psz_name, psz_element ) )
{
FREE_ATT();
playlist_BothAddInput( p_playlist, p_new_input,
p_demux->p_sys->p_item_in_category,
PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
PLAYLIST_END, NULL, NULL, VLC_FALSE );
input_ItemAddSubItem( p_input_item, p_new_input );
if( p_demux->p_sys->i_identifier <
p_demux->p_sys->i_tracklist_entries )
{
......@@ -549,7 +544,7 @@ static vlc_bool_t parse_track_node COMPLEX_INTERFACE
p_new_input = input_ItemNewExt( p_playlist, psz_uri,
NULL, 0, NULL, -1 );
free( psz_uri );
input_ItemCopyOptions( p_item->p_input, p_new_input );
input_ItemCopyOptions( p_input_item, p_new_input );
psz_uri = NULL;
FREE_ATT();
p_handler = NULL;
......@@ -576,7 +571,7 @@ static vlc_bool_t parse_track_node COMPLEX_INTERFACE
}
if( p_handler->pf_handler.smpl )
{
p_handler->pf_handler.smpl( NULL, p_new_input,
p_handler->pf_handler.smpl( p_new_input,
p_handler->name,
psz_value );
FREE_ATT();
......@@ -724,7 +719,7 @@ static vlc_bool_t parse_extension_node COMPLEX_INTERFACE
{
if( p_handler->pf_handler.cmplx( p_demux,
p_playlist,
p_item, NULL,
p_input_item,
p_xml_reader,
p_handler->name ) )
{
......@@ -778,7 +773,7 @@ static vlc_bool_t parse_extension_node COMPLEX_INTERFACE
if( p_handler->pf_handler.smpl )
{
p_handler->pf_handler.smpl( p_item, NULL, p_handler->name,
p_handler->pf_handler.smpl( p_input_item, p_handler->name,
psz_value );
}
FREE_ATT();
......
......@@ -29,14 +29,12 @@
#define SIMPLE_CONTENT 1
#define COMPLEX_CONTENT 2
#define SIMPLE_INTERFACE (playlist_item_t *p_item,\
input_item_t *p_input,\
#define SIMPLE_INTERFACE (input_item_t *p_input,\
const char *psz_name,\
char *psz_value)
#define COMPLEX_INTERFACE (demux_t *p_demux,\
playlist_t *p_playlist,\
playlist_item_t *p_item,\
input_item_t *p_input, \
input_item_t *p_input_item,\
xml_reader_t *p_xml_reader,\
const char *psz_element)
......
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