]> git.sesse.net Git - vlc/commitdiff
* Allow the asx module to peek instead on relying on file extension
authorDerk-Jan Hartman <hartman@videolan.org>
Sat, 29 Jul 2006 22:58:49 +0000 (22:58 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Sat, 29 Jul 2006 22:58:49 +0000 (22:58 +0000)
* 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

modules/demux/playlist/asx.c
modules/demux/playlist/m3u.c
modules/demux/playlist/pls.c

index 4e73551efb2120938b68cd5b23aca6c1c5f9890b..f8a6a50b26c42a5cc2fec37c417206e9ef5ee425 100644 (file)
@@ -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 )
 {
     demux_t *p_demux = (demux_t *)p_this;
-
-    char    *psz_ext;
-
-    psz_ext = strrchr ( p_demux->psz_path, '.' );
-
-    if( ( psz_ext && !strcasecmp( psz_ext, ".asx") ) ||
-        ( psz_ext && !strcasecmp( psz_ext, ".wax") ) ||
-        ( psz_ext && !strcasecmp( psz_ext, ".wvx") ) ||
+    uint8_t *p_peek;
+    CHECK_PEEK( p_peek, 10 );
+    
+    if( POKE( p_peek, "<asx", 4 ) || isExtension( p_demux, ".asx" ) ||
+        isExtension( p_demux, ".wax" ) || isExtension( p_demux, ".wvx" ) ||
         isDemux( p_demux, "asx-open" ) )
     {
         ;
     }
     else
-    {
         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_data = NULL;
     p_demux->p_sys->i_data_len = -1;
index 237eb8a2febd1f645aa50e1913bd7c64f6b2906b..de036a74202af916e4122a55cc7bda5881f075f1 100644 (file)
@@ -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 )
 {
     demux_t *p_demux = (demux_t *)p_this;
-
     uint8_t *p_peek;
-    char    *psz_ext;
-
-    if( stream_Peek( p_demux->s , &p_peek, 7 ) < 7 )
-    {
-        return VLC_EGENERIC;
-    }
-    psz_ext = strrchr ( p_demux->psz_path, '.' );
-
-    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" ) )
+    CHECK_PEEK( p_peek, 8 );
+    
+    if( POKE( p_peek, "#EXTM3U", 7 ) || POKE( p_peek, "RTSPtext", 8 ) ||
+        isExtension( p_demux, ".m3u" ) || isExtension( p_demux, ".vlc" ) ||
+        /* A .ram file can contain a single rtsp link */
+        isExtension( p_demux, ".ram" ) || isExtension( p_demux, ".rm" ) ||
+        isDemux( p_demux,  "m3u" ) )
     {
         ;
     }
     else
-    {
         return VLC_EGENERIC;
-    }
+    
     STANDARD_DEMUX_INIT_MSG( "found valid M3U playlist" );
     p_demux->p_sys->psz_prefix = E_(FindPrefix)( p_demux );
 
@@ -156,6 +143,10 @@ static int Demux( demux_t *p_demux )
                                  psz_option );
             }
         }
+        else if( !strncasecmp( psz_parse, "RTSPtext", sizeof("RTSPtext") -1 ) )
+        {
+            ;/* special case to handle QuickTime RTSPtext redirect files */
+        }
         else if( *psz_parse )
         {
             char *psz_mrl;
index 799e824356226b243a5865a2be0d9b9c7cc05a1b..708bc06ae85b6b8c6ab0e80a9ec3ab0d75acc93b 100644 (file)
@@ -49,9 +49,9 @@ int E_(Import_PLS)( vlc_object_t *p_this )
 {
     demux_t *p_demux = (demux_t *)p_this;
     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" ) )
     {
         ;
@@ -85,7 +85,6 @@ static int Demux( demux_t *p_demux )
     char          *psz_mrl = NULL;
     char          *psz_key;
     char          *psz_value;
-    int            i_position;
     int            i_item = -1;
     int            i_new_item = 0;
     int            i_key_length;
@@ -94,7 +93,8 @@ static int Demux( demux_t *p_demux )
 
     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 );
             continue;
@@ -120,15 +120,19 @@ static int Demux( demux_t *p_demux )
         }
         /* find the number part of of file1, title1 or length1 etc */
         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 );
-            if( i_new_item == 0 && i_key_length >= 6 ) /* title1 type case */
+            i_new_item = atoi( psz_key + 3 );
+            if( i_new_item == 0 && i_key_length >= 5 ) /* file1 type case */
             {
-                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 + 4 );
+                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 )
             i_item = i_new_item;
             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 );
         }