]> git.sesse.net Git - vlc/blobdiff - modules/demux/playlist/playlist.c
Used VLC_TS_0 in rawvid demuxer.
[vlc] / modules / demux / playlist / playlist.c
index dd747415a59a3d05bd2ec03c997fadce3b497af6..c02c186b3377b989109a6ba5cb8ca10134b54622 100644 (file)
@@ -54,13 +54,13 @@ vlc_module_begin ()
     set_category( CAT_INPUT )
     set_subcategory( SUBCAT_INPUT_DEMUX )
 
-    add_bool( "playlist-autostart", 1, NULL,
+    add_bool( "playlist-autostart", true, NULL,
               AUTOSTART_TEXT, AUTOSTART_LONGTEXT, false )
 
     add_integer( "parent-item", 0, NULL, NULL, NULL, true )
         change_internal ()
 
-    add_bool( "playlist-skip-ads", 1, NULL,
+    add_bool( "playlist-skip-ads", true, NULL,
               SKIP_ADS_TEXT, SKIP_ADS_LONGTEXT, false )
 
     set_shortname( N_("Playlist") )
@@ -68,6 +68,8 @@ vlc_module_begin ()
     add_submodule ()
         set_description( N_("M3U playlist import") )
         add_shortcut( "playlist" )
+        add_shortcut( "m3u" )
+        add_shortcut( "m3u8" )
         add_shortcut( "m3u-open" )
         set_capability( "demux", 10 )
         set_callbacks( Import_M3U, Close_M3U )
@@ -152,19 +154,27 @@ vlc_module_begin ()
         set_capability( "demux", 10 )
         set_callbacks( Import_iTML, Close_iTML )
     add_submodule ()
-        set_description( N_("WPL playlist") )
+        set_description( N_("WPL playlist import") )
         add_shortcut( "playlist" )
         add_shortcut( "wpl" )
         set_capability( "demux", 10 )
         set_callbacks( Import_WPL, Close_WPL )
     add_submodule ()
-        set_description( N_("ZPL playlist") )
+        set_description( N_("ZPL playlist import") )
         add_shortcut( "playlist" )
         add_shortcut( "zpl" )
         set_capability( "demux", 10 )
         set_callbacks( Import_ZPL, Close_ZPL )
 vlc_module_end ()
 
+input_item_t * GetCurrentItem(demux_t *p_demux)
+{
+    input_thread_t *p_input_thread = demux_GetParentInput( p_demux );
+    input_item_t *p_current_input = input_GetItem( p_input_thread );
+    vlc_gc_incref(p_current_input);
+    vlc_object_release(p_input_thread);
+    return p_current_input;
+}
 
 /**
  * Find directory part of the path to the playlist file, in case of
@@ -172,26 +182,40 @@ vlc_module_end ()
  */
 char *FindPrefix( demux_t *p_demux )
 {
-    char *psz_name;
-    char *psz_path = strdup( p_demux->psz_path );
-
-#ifndef WIN32
-    psz_name = strrchr( psz_path, '/' );
-#else
-    psz_name = strrchr( psz_path, '\\' );
-    if( !psz_name ) psz_name = strrchr( psz_path, '/' );
+    char *psz_file;
+    char *psz_prefix;
+    char *psz_path;
+    if( p_demux->psz_access )
+    {
+        if( asprintf( &psz_path,"%s://%s", p_demux->psz_access, p_demux->psz_path ) == -1 )
+            return NULL;
+    }
+    else
+    {
+        if( asprintf( &psz_path,"%s", p_demux->psz_path ) == -1 )
+            return NULL;
+    }
+
+#ifdef WIN32
+    psz_file = strrchr( psz_path, '\\' );
+    if( !psz_file )
 #endif
-    if( psz_name ) psz_name[1] = '\0';
-    else *psz_path = '\0';
+    psz_file = strrchr( psz_path, '/' );
 
-    return psz_path;
+    if( psz_file )
+        psz_prefix = strndup( psz_path, psz_file - psz_path + 1 );
+    else
+        psz_prefix = strdup( "" );
+    free( psz_path );
+
+    return psz_prefix;
 }
 
 /**
  * Add the directory part of the playlist file to the start of the
  * mrl, if the mrl is a relative file path
  */
-char *ProcessMRL( char *psz_mrl, char *psz_prefix )
+char *ProcessMRL( const char *psz_mrl, const char *psz_prefix )
 {
     /* Check for a protocol name.
      * for URL, we should look for "://"
@@ -211,8 +235,8 @@ char *ProcessMRL( char *psz_mrl, char *psz_prefix )
     if( strchr( psz_mrl, ':' ) ) return strdup( psz_mrl );
 
     /* This a relative path, prepend the prefix */
-    if( asprintf( &psz_mrl, "%s%s", psz_prefix, psz_mrl ) != -1 )
-        return psz_mrl;
-    else
-        return NULL;
+    char *ret;
+    if( asprintf( &ret, "%s%s", psz_prefix, psz_mrl ) == -1 )
+        ret = NULL;
+    return ret;
 }