Support files that are called .asx and .pls but really are just .m3u files

parent 158bb3ed
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* m3u.c: a meta demux to parse pls, m3u and asx playlists * m3u.c: a meta demux to parse pls, m3u and asx playlists
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: m3u.c,v 1.17 2003/03/30 11:43:38 gbazin Exp $ * $Id: m3u.c,v 1.18 2003/04/06 20:08:11 sigmunau Exp $
* *
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
* Gildas Bazin <gbazin@netcourrier.com> * Gildas Bazin <gbazin@netcourrier.com>
...@@ -79,7 +79,8 @@ static int Activate( vlc_object_t * p_this ) ...@@ -79,7 +79,8 @@ static int Activate( vlc_object_t * p_this )
input_thread_t *p_input = (input_thread_t *)p_this; input_thread_t *p_input = (input_thread_t *)p_this;
char *psz_ext; char *psz_ext;
demux_sys_t *p_m3u; demux_sys_t *p_m3u;
int i_type = 0; int i_type = 0;
int i_type2 = 0;
/* Initialize access plug-in structures. */ /* Initialize access plug-in structures. */
if( p_input->i_mtu == 0 ) if( p_input->i_mtu == 0 )
...@@ -119,7 +120,7 @@ static int Activate( vlc_object_t * p_this ) ...@@ -119,7 +120,7 @@ static int Activate( vlc_object_t * p_this )
* at the content. This is useful for .asp, .php and similar files * at the content. This is useful for .asp, .php and similar files
* that are actually html. Also useful for som asx files that have * that are actually html. Also useful for som asx files that have
* another extention */ * another extention */
if( !i_type ) if( i_type != TYPE_M3U )
{ {
byte_t *p_peek; byte_t *p_peek;
int i_size = input_Peek( p_input, &p_peek, MAX_LINE ); int i_size = input_Peek( p_input, &p_peek, MAX_LINE );
...@@ -135,22 +136,34 @@ static int Activate( vlc_object_t * p_this ) ...@@ -135,22 +136,34 @@ static int Activate( vlc_object_t * p_this )
} }
if ( !i_size ) if ( !i_size )
{ {
return -1; ;
} }
else if ( !strncasecmp( p_peek, "[playlist]", sizeof("[playlist]") -1 ) ) else if ( !strncasecmp( p_peek, "[playlist]", sizeof("[playlist]") -1 ) )
{ {
i_type = TYPE_PLS; i_type2 = TYPE_PLS;
} }
else if ( !strncasecmp( p_peek, "<html>", sizeof("<html>") -1 ) ) else if ( !strncasecmp( p_peek, "<html>", sizeof("<html>") -1 ) )
{ {
i_type = TYPE_HTML; i_type2 = TYPE_HTML;
} }
else if ( !strncasecmp( p_peek, "<asx", sizeof("<asx") -1 ) ) else if ( !strncasecmp( p_peek, "<asx", sizeof("<asx") -1 ) )
{ {
i_type = TYPE_ASX; i_type2 = TYPE_ASX;
} }
} }
} }
if ( !i_type && !i_type2 )
{
return -1;
}
if ( i_type && !i_type2 )
{
i_type = TYPE_M3U;
}
else
{
i_type = i_type2;
}
/* Allocate p_m3u */ /* Allocate p_m3u */
if( !( p_m3u = malloc( sizeof( demux_sys_t ) ) ) ) if( !( p_m3u = malloc( sizeof( demux_sys_t ) ) ) )
...@@ -236,6 +249,10 @@ static int ProcessLine ( input_thread_t *p_input , demux_sys_t *p_m3u ...@@ -236,6 +249,10 @@ static int ProcessLine ( input_thread_t *p_input , demux_sys_t *p_m3u
while( *psz_bol && while( *psz_bol &&
strncasecmp( psz_bol, "mms://", strncasecmp( psz_bol, "mms://",
sizeof("mms://") - 1 ) && sizeof("mms://") - 1 ) &&
strncasecmp( psz_bol, "mmsu://",
sizeof("mmsu://") - 1 ) &&
strncasecmp( psz_bol, "mmst://",
sizeof("mmst://") - 1 ) &&
strncasecmp( psz_bol, "http://", strncasecmp( psz_bol, "http://",
sizeof("http://") - 1 ) && sizeof("http://") - 1 ) &&
strncasecmp( psz_bol, "file://", strncasecmp( psz_bol, "file://",
......
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