Commit 56c76843 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* Allow the asx module to peek instead on relying on file extension

* Added the QuickTime RTSPtext redirect system. uses m3u, even though they are not related.
* Added the WM Server [Reference] redirects to the pls playlist demux. it's also INI based.

This fixes #690
parent 9c964adb
...@@ -86,23 +86,19 @@ static int StoreString( demux_t *p_demux, char **ppsz_string, char *psz_source_s ...@@ -86,23 +86,19 @@ static int StoreString( demux_t *p_demux, char **ppsz_string, char *psz_source_s
int E_(Import_ASX)( vlc_object_t *p_this ) int E_(Import_ASX)( vlc_object_t *p_this )
{ {
demux_t *p_demux = (demux_t *)p_this; demux_t *p_demux = (demux_t *)p_this;
uint8_t *p_peek;
char *psz_ext; CHECK_PEEK( p_peek, 10 );
psz_ext = strrchr ( p_demux->psz_path, '.' ); if( POKE( p_peek, "<asx", 4 ) || isExtension( p_demux, ".asx" ) ||
isExtension( p_demux, ".wax" ) || isExtension( p_demux, ".wvx" ) ||
if( ( psz_ext && !strcasecmp( psz_ext, ".asx") ) ||
( psz_ext && !strcasecmp( psz_ext, ".wax") ) ||
( psz_ext && !strcasecmp( psz_ext, ".wvx") ) ||
isDemux( p_demux, "asx-open" ) ) isDemux( p_demux, "asx-open" ) )
{ {
; ;
} }
else else
{
return VLC_EGENERIC; return VLC_EGENERIC;
}
STANDARD_DEMUX_INIT_MSG( "using ASX playlist reader" ); STANDARD_DEMUX_INIT_MSG( "found valid ASX playlist" );
p_demux->p_sys->psz_prefix = E_(FindPrefix)( p_demux ); p_demux->p_sys->psz_prefix = E_(FindPrefix)( p_demux );
p_demux->p_sys->psz_data = NULL; p_demux->p_sys->psz_data = NULL;
p_demux->p_sys->i_data_len = -1; p_demux->p_sys->i_data_len = -1;
......
...@@ -53,33 +53,20 @@ static void parseEXTINF( char *psz_string, char **ppsz_artist, char **ppsz_name, ...@@ -53,33 +53,20 @@ static void parseEXTINF( char *psz_string, char **ppsz_artist, char **ppsz_name,
int E_(Import_M3U)( vlc_object_t *p_this ) int E_(Import_M3U)( vlc_object_t *p_this )
{ {
demux_t *p_demux = (demux_t *)p_this; demux_t *p_demux = (demux_t *)p_this;
uint8_t *p_peek; uint8_t *p_peek;
char *psz_ext; CHECK_PEEK( p_peek, 8 );
if( stream_Peek( p_demux->s , &p_peek, 7 ) < 7 ) if( POKE( p_peek, "#EXTM3U", 7 ) || POKE( p_peek, "RTSPtext", 8 ) ||
{ isExtension( p_demux, ".m3u" ) || isExtension( p_demux, ".vlc" ) ||
return VLC_EGENERIC; /* A .ram file can contain a single rtsp link */
} isExtension( p_demux, ".ram" ) || isExtension( p_demux, ".rm" ) ||
psz_ext = strrchr ( p_demux->psz_path, '.' ); isDemux( p_demux, "m3u" ) )
if( !strncmp( (char *)p_peek, "#EXTM3U", 7 ) )
{
;
}
else if( ( psz_ext && !strcasecmp( psz_ext, ".m3u") ) ||
( psz_ext && !strcasecmp( psz_ext, ".ram") ) ||
( psz_ext && !strcasecmp( psz_ext, ".rm") ) ||
( psz_ext && !strcasecmp( psz_ext, ".vlc") ) ||
/* A .ram file can contain a single rtsp link */
isDemux( p_demux, "m3u" ) )
{ {
; ;
} }
else else
{
return VLC_EGENERIC; return VLC_EGENERIC;
}
STANDARD_DEMUX_INIT_MSG( "found valid M3U playlist" ); STANDARD_DEMUX_INIT_MSG( "found valid M3U playlist" );
p_demux->p_sys->psz_prefix = E_(FindPrefix)( p_demux ); p_demux->p_sys->psz_prefix = E_(FindPrefix)( p_demux );
...@@ -156,6 +143,10 @@ static int Demux( demux_t *p_demux ) ...@@ -156,6 +143,10 @@ static int Demux( demux_t *p_demux )
psz_option ); psz_option );
} }
} }
else if( !strncasecmp( psz_parse, "RTSPtext", sizeof("RTSPtext") -1 ) )
{
;/* special case to handle QuickTime RTSPtext redirect files */
}
else if( *psz_parse ) else if( *psz_parse )
{ {
char *psz_mrl; char *psz_mrl;
......
...@@ -49,9 +49,9 @@ int E_(Import_PLS)( vlc_object_t *p_this ) ...@@ -49,9 +49,9 @@ int E_(Import_PLS)( vlc_object_t *p_this )
{ {
demux_t *p_demux = (demux_t *)p_this; demux_t *p_demux = (demux_t *)p_this;
uint8_t *p_peek; uint8_t *p_peek;
CHECK_PEEK( p_peek, 7 ); CHECK_PEEK( p_peek, 10 );
if( POKE( p_peek, "[playlist]", 10 ) || if( POKE( p_peek, "[playlist]", 10 ) || POKE( p_peek, "[Reference]", 10 ) ||
isExtension( p_demux, ".pls" ) || isDemux( p_demux, "pls" ) ) isExtension( p_demux, ".pls" ) || isDemux( p_demux, "pls" ) )
{ {
; ;
...@@ -85,7 +85,6 @@ static int Demux( demux_t *p_demux ) ...@@ -85,7 +85,6 @@ static int Demux( demux_t *p_demux )
char *psz_mrl = NULL; char *psz_mrl = NULL;
char *psz_key; char *psz_key;
char *psz_value; char *psz_value;
int i_position;
int i_item = -1; int i_item = -1;
int i_new_item = 0; int i_new_item = 0;
int i_key_length; int i_key_length;
...@@ -94,7 +93,8 @@ static int Demux( demux_t *p_demux ) ...@@ -94,7 +93,8 @@ static int Demux( demux_t *p_demux )
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 ) ||
!strncasecmp( psz_line, "[Reference]", sizeof("[Reference]")-1 ) )
{ {
free( psz_line ); free( psz_line );
continue; continue;
...@@ -120,15 +120,19 @@ static int Demux( demux_t *p_demux ) ...@@ -120,15 +120,19 @@ static int Demux( demux_t *p_demux )
} }
/* find the number part of of file1, title1 or length1 etc */ /* find the number part of of file1, title1 or length1 etc */
i_key_length = strlen( psz_key ); i_key_length = strlen( psz_key );
if( i_key_length >= 5 ) /* file1 type case */ if( i_key_length >= 4 ) /* Ref1 type case */
{ {
i_new_item = atoi( psz_key + 4 ); i_new_item = atoi( psz_key + 3 );
if( i_new_item == 0 && i_key_length >= 6 ) /* title1 type case */ if( i_new_item == 0 && i_key_length >= 5 ) /* file1 type case */
{ {
i_new_item = atoi( psz_key + 5 ); i_new_item = atoi( psz_key + 4 );
if( i_new_item == 0 && i_key_length >= 7 ) /* length1 type case */ if( i_new_item == 0 && i_key_length >= 6 ) /* title1 type case */
{ {
i_new_item = atoi( psz_key + 6 ); i_new_item = atoi( psz_key + 5 );
if( i_new_item == 0 && i_key_length >= 7 ) /* length1 type case */
{
i_new_item = atoi( psz_key + 6 );
}
} }
} }
} }
...@@ -167,7 +171,8 @@ static int Demux( demux_t *p_demux ) ...@@ -167,7 +171,8 @@ static int Demux( demux_t *p_demux )
i_item = i_new_item; i_item = i_new_item;
i_new_item = 0; i_new_item = 0;
} }
if( !strncasecmp( psz_key, "file", sizeof("file") -1 ) ) if( !strncasecmp( psz_key, "file", sizeof("file") -1 ) ||
!strncasecmp( psz_key, "Ref", sizeof("Ref") -1 ) )
{ {
psz_mrl = E_(ProcessMRL)( psz_value, p_demux->p_sys->psz_prefix ); psz_mrl = E_(ProcessMRL)( psz_value, p_demux->p_sys->psz_prefix );
} }
......
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