#define TYPE_HTML 3
#define TYPE_PLS 4
#define TYPE_B4S 5
+#define TYPE_WMP 6
+#define TYPE_RTSP 7
struct demux_sys_t
{
static int Activate ( vlc_object_t * );
static void Deactivate( vlc_object_t * );
static int Demux ( demux_t * );
-static int Control ( demux_t *, int, va_list );
+static int Control ( demux_t *, int, va_list );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_description( _("Playlist metademux") );
- set_capability( "demux2", 180 );
+ set_capability( "demux2", 10 );
set_callbacks( Activate, Deactivate );
add_shortcut( "m3u" );
add_shortcut( "asx" );
{
uint8_t *p_peek;
int i_size = stream_Peek( p_demux->s, &p_peek, MAX_LINE );
- i_size -= sizeof("[playlist]") - 1;
+ i_size -= sizeof("[Reference]") - 1;
if( i_size > 0 )
{
while( i_size &&
strncasecmp(p_peek, "[playlist]", sizeof("[playlist]") - 1)
+ && strncasecmp( p_peek, "[Reference]", sizeof("[Reference]") - 1 )
&& strncasecmp( p_peek, "<html>", sizeof("<html>") - 1 )
&& strncasecmp( p_peek, "<asx", sizeof("<asx") - 1 )
+ && strncasecmp( p_peek, "rtsptext", sizeof("rtsptext") - 1 )
&& strncasecmp( p_peek, "<?xml", sizeof("<?xml") -1 ) )
{
p_peek++;
{
i_type2 = TYPE_PLS;
}
+ else if( !strncasecmp( p_peek, "[Reference]", sizeof("[Reference]") -1 ) )
+ {
+ i_type2 = TYPE_WMP;
+ }
else if( !strncasecmp( p_peek, "<html>", sizeof("<html>") -1 ) )
{
i_type2 = TYPE_HTML;
{
i_type2 = TYPE_ASX;
}
+ else if( !strncasecmp( p_peek, "rtsptext", sizeof("rtsptext") -1 ) )
+ {
+ i_type2 = TYPE_RTSP;
+ }
#if 0
else if( !strncasecmp( p_peek, "<?xml", sizeof("<?xml") -1 ) )
{
/* Allocate p_m3u */
p_demux->p_sys = malloc( sizeof( demux_sys_t ) );
p_demux->p_sys->i_type = i_type;
+ msg_Dbg( p_this, "Playlist type: %d - %d", i_type, i_type2 );
return VLC_SUCCESS;
}
}
/* If we don't have a comment, the line is directly the URI */
}
- else if ( p_m3u->i_type == TYPE_PLS )
+ else if( p_m3u->i_type == TYPE_PLS )
{
/* We are dealing with .pls files from shoutcast
* We are looking for lines like "File1=http://..." */
return 0;
}
}
- else if ( p_m3u->i_type == TYPE_ASX )
+ else if( p_m3u->i_type == TYPE_WMP )
+ {
+ /* We are dealing with some weird WMP stream playlist format
+ * Hurray for idiotic M$. Lines look like: "Ref1=http://..." */
+ if( !strncasecmp( psz_bol, "Ref", sizeof("Ref") - 1 ) )
+ {
+ psz_bol += sizeof("Ref") - 1;
+ psz_bol = strchr( psz_bol, '=' );
+ if ( !psz_bol ) return 0;
+ psz_bol++;
+ if( !strncasecmp( psz_bol, "http://", sizeof("http://") -1 ) )
+ {
+ psz_bol[0] = 'm'; psz_bol[1] = 'm'; psz_bol[2] = 's'; psz_bol[3] = 'h';
+ }
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ else if( p_m3u->i_type == TYPE_ASX )
{
/* We are dealing with ASX files.
* We are looking for "<ref href=" xml markups that
*psz_eol = '\0';
}
- else if ( p_m3u->i_type == TYPE_HTML )
+ else if( p_m3u->i_type == TYPE_HTML )
{
/* We are dealing with a html file with embedded
* video. We are looking for "<param name="filename"
*psz_eol = '\0';
}
- else if ( p_m3u->i_type == TYPE_B4S )
+ else if( p_m3u->i_type == TYPE_B4S )
{
char *psz_eol;
/* Handle the XML special characters */
XMLSpecialChars( psz_bol );
}
+ else if( p_m3u->i_type == TYPE_RTSP )
+ {
+ /* We are dealing with rtsptext reference files
+ * Ignore anthying that doesn't start with rtsp://..." */
+ if( strncasecmp( psz_bol, "rtsp://", sizeof("rtsp://") - 1 ) )
+ /* ignore */ return 0;
+ }
else
{
msg_Warn( p_demux, "unknown file type" );