]> git.sesse.net Git - vlc/blobdiff - modules/demux/playlist/pls.c
A bit of headers cleanup
[vlc] / modules / demux / playlist / pls.c
index 708bc06ae85b6b8c6ab0e80a9ec3ab0d75acc93b..bf1b2a4ba0b16e6876b0b1b6dcb76ed2b896b983 100644 (file)
@@ -26,8 +26,7 @@
  * Preamble
  *****************************************************************************/
 #include <vlc/vlc.h>
-#include <vlc/input.h>
-#include <vlc/intf.h>
+#include <vlc_demux.h>
 
 #include "playlist.h"
 
@@ -83,17 +82,19 @@ static int Demux( demux_t *p_demux )
     char          *psz_name = NULL;
     char          *psz_line;
     char          *psz_mrl = NULL;
+    char          *psz_mrl_orig = NULL;
     char          *psz_key;
     char          *psz_value;
     int            i_item = -1;
     int            i_new_item = 0;
     int            i_key_length;
+    input_item_t *p_input;
 
     INIT_PLAYLIST_STUFF;
 
     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 );
@@ -153,10 +154,10 @@ static int Demux( demux_t *p_demux )
             {
                 p_input = input_ItemNewExt( p_playlist, psz_mrl, psz_name,
                                             0, NULL, -1 );
-                vlc_input_item_CopyOptions( p_current->p_input, p_input );
-                playlist_AddWhereverNeeded( p_playlist, p_input, p_current,
-                                p_item_in_category, (i_parent_id > 0 ) ?
-                                VLC_TRUE: VLC_FALSE, PLAYLIST_APPEND );
+                input_ItemCopyOptions( p_current->p_input, p_input );
+                playlist_BothAddInput( p_playlist, p_input, p_item_in_category,
+                                       PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
+                                       PLAYLIST_END, NULL, NULL );
             }
             else
             {
@@ -174,7 +175,19 @@ static int Demux( demux_t *p_demux )
         if( !strncasecmp( psz_key, "file", sizeof("file") -1 ) ||
             !strncasecmp( psz_key, "Ref", sizeof("Ref") -1 ) )
         {
+            psz_mrl_orig =
             psz_mrl = E_(ProcessMRL)( psz_value, p_demux->p_sys->psz_prefix );
+
+            if( !strncasecmp( psz_key, "Ref", sizeof("Ref") -1 ) )
+            {
+                if( !strncasecmp( psz_mrl, "http://", sizeof("http://") -1 ) )
+                {
+                    psz_mrl++;
+                    psz_mrl[0] = 'm';
+                    psz_mrl[1] = 'm';
+                    psz_mrl[2] = 's';
+                }
+            }
         }
         else if( !strncasecmp( psz_key, "title", sizeof("title") -1 ) )
         {
@@ -198,11 +211,11 @@ static int Demux( demux_t *p_demux )
     if( psz_mrl )
     {
         p_input = input_ItemNewExt( p_playlist, psz_mrl, psz_name,0, NULL, -1 );
-        vlc_input_item_CopyOptions( p_current->p_input, p_input );
-        playlist_AddWhereverNeeded( p_playlist, p_input, p_current,
-                                p_item_in_category, (i_parent_id > 0 ) ?
-                                VLC_TRUE: VLC_FALSE, PLAYLIST_APPEND );
-        free( psz_mrl );
+        input_ItemCopyOptions( p_current->p_input, p_input );
+        playlist_BothAddInput( p_playlist, p_input, p_item_in_category,
+                               PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
+                               PLAYLIST_END, NULL, NULL );
+        free( psz_mrl_orig );
         psz_mrl = NULL;
     }
     else
@@ -216,7 +229,7 @@ static int Demux( demux_t *p_demux )
     }
 
     HANDLE_PLAY_AND_RELEASE;
-    return VLC_SUCCESS;
+    return -1; /* Needed for correct operation of go back */
 }
 
 static int Control( demux_t *p_demux, int i_query, va_list args )