Commit 4a253e8c authored by Clément Stenac's avatar Clément Stenac

Use new API for M3U demuxer

parent 6992f554
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* $Id$ * $Id$
* *
* Authors: Clment Stenac <zorglub@videolan.org> * Authors: Clment Stenac <zorglub@videolan.org>
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> * Sigmund Augdal <sigmunau@idi.ntnu.no>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -106,12 +106,13 @@ static int Demux( demux_t *p_demux ) ...@@ -106,12 +106,13 @@ static int Demux( demux_t *p_demux )
{ {
playlist_t *p_playlist; playlist_t *p_playlist;
char *psz_line; char *psz_line;
int i_position;
char *psz_name = NULL; char *psz_name = NULL;
mtime_t i_duration = -1; mtime_t i_duration = -1;
char **ppsz_options = NULL; char **ppsz_options = NULL;
int i_options = 0; int i_options = 0, i;
playlist_item_t *p_item;
vlc_bool_t b_cleanup = VLC_FALSE; vlc_bool_t b_cleanup = VLC_FALSE;
...@@ -123,10 +124,8 @@ static int Demux( demux_t *p_demux ) ...@@ -123,10 +124,8 @@ static int Demux( demux_t *p_demux )
return -1; return -1;
} }
vlc_mutex_lock( &p_playlist->object_lock ); playlist_ItemToNode( p_playlist, p_playlist->status.p_item );
p_playlist->pp_items[p_playlist->i_index]->b_autodeletion = VLC_TRUE; p_playlist->status.p_item->input.i_type = ITEM_TYPE_PLAYLIST;
i_position = p_playlist->i_index + 1;
vlc_mutex_unlock( &p_playlist->object_lock );
psz_line = stream_ReadLine( p_demux->s ); psz_line = stream_ReadLine( p_demux->s );
while( psz_line ) while( psz_line )
...@@ -142,7 +141,7 @@ static int Demux( demux_t *p_demux ) ...@@ -142,7 +141,7 @@ static int Demux( demux_t *p_demux )
/* Parse extra info */ /* Parse extra info */
/* Skip leading tabs and spaces */ /* Skip leading tabs and spaces */
while( *psz_parse == ' ' || *psz_parse == '\t' || while( *psz_parse == ' ' || *psz_parse == '\t' ||
*psz_parse == '\n' || *psz_parse == '\r' || *psz_parse == '\n' || *psz_parse == '\r' ||
*psz_parse == '#' ) psz_parse++; *psz_parse == '#' ) psz_parse++;
...@@ -189,11 +188,26 @@ static int Demux( demux_t *p_demux ) ...@@ -189,11 +188,26 @@ static int Demux( demux_t *p_demux )
b_cleanup = VLC_TRUE; b_cleanup = VLC_TRUE;
if( !psz_mrl ) goto error; if( !psz_mrl ) goto error;
playlist_AddExt( p_playlist, psz_mrl, psz_name, p_item = playlist_ItemNew( p_playlist, psz_mrl, psz_name );
PLAYLIST_INSERT, i_position, i_duration, for( i = 0; i< i_options; i++ )
(const char **)ppsz_options, i_options ); {
playlist_ItemAddOption( p_item, ppsz_options[i] );
}
p_item->input.i_duration = i_duration;
playlist_NodeAddItem( p_playlist, p_item,
p_playlist->status.p_item->pp_parents[0]->i_view,
p_playlist->status.p_item, PLAYLIST_APPEND,
PLAYLIST_END );
i_position++; /* We need to declare the parents of the node as the
* * same of the parent's ones */
for( i= 1 ; i< p_playlist->status.p_item->i_parents; i ++ )
{
playlist_ItemAddParent( p_item,
p_playlist->status.p_item->pp_parents[i]->i_view,
p_playlist->status.p_item );
}
free( psz_mrl ); free( psz_mrl );
} }
...@@ -218,6 +232,10 @@ static int Demux( demux_t *p_demux ) ...@@ -218,6 +232,10 @@ static int Demux( demux_t *p_demux )
} }
} }
/* Go back and play the playlist */
playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, p_playlist->status.i_view,
p_playlist->status.p_item, NULL );
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
...@@ -188,7 +188,7 @@ static int Demux( demux_t *p_demux ) ...@@ -188,7 +188,7 @@ static int Demux( demux_t *p_demux )
PLAYLIST_INSERT, i_position ); PLAYLIST_INSERT, i_position );
if( i_duration != -1 ) if( i_duration != -1 )
{ {
playlist_SetDuration( p_playlist, i_position, i_duration ); //playlist_SetDuration( p_playlist, i_position, i_duration );
} }
i_position++; i_position++;
free( psz_mrl ); free( psz_mrl );
...@@ -236,7 +236,7 @@ static int Demux( demux_t *p_demux ) ...@@ -236,7 +236,7 @@ static int Demux( demux_t *p_demux )
PLAYLIST_INSERT, i_position ); PLAYLIST_INSERT, i_position );
if( i_duration != -1 ) if( i_duration != -1 )
{ {
playlist_SetDuration( p_playlist, i_position, i_duration ); //playlist_SetDuration( p_playlist, i_position, i_duration );
} }
i_position++; i_position++;
free( psz_mrl ); free( psz_mrl );
......
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