]> git.sesse.net Git - vlc/blobdiff - modules/demux/playlist/playlist.c
Stop playback if --no-playlist-autostart (Closes:#718)
[vlc] / modules / demux / playlist / playlist.c
index 86438cfed0750e9fafab2c9dbba08167bb5add65..f2acf2ddc418930f1d743046aca41ddce0558ac5 100644 (file)
@@ -1,10 +1,10 @@
 /*****************************************************************************
  * playlist.c :  Playlist import module
  *****************************************************************************
- * Copyright (C) 2004 VideoLAN
+ * Copyright (C) 2004 the VideoLAN team
  * $Id$
  *
- * Authors: Clément Stenac <zorglub@videolan.org>
+ * Authors: Clément Stenac <zorglub@videolan.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
 #define AUTOSTART_TEXT N_( "Auto start" )
-#define AUTOSTART_LONGTEXT N_( "Automatically start the playlist when " \
-    "it's loaded.\n" )
+/// \bug [String] Why \n ?
+#define AUTOSTART_LONGTEXT N_( "Automatically start playing the playlist " \
+                "content once it's loaded.\n" )
+
+#define SHOW_ADULT_TEXT N_( "Show shoutcast adult content" )
+#define SHOW_ADULT_LONGTEXT N_( "Show NC17 rated video streams when " \
+                "using shoutcast video playlists." )
 
 vlc_module_begin();
     add_shortcut( "playlist" );
     set_category( CAT_INPUT );
     set_subcategory( SUBCAT_INPUT_DEMUX );
 
-    add_bool( "playlist-autostart", 1, NULL, AUTOSTART_TEXT, AUTOSTART_LONGTEXT,
-              VLC_FALSE );
+    add_bool( "playlist-autostart", 1, NULL,
+              AUTOSTART_TEXT, AUTOSTART_LONGTEXT, VLC_FALSE );
 
-    set_description( _("Old playlist open") );
-    add_shortcut( "old-open" );
-    set_capability( "demux2", 10 );
-    set_callbacks( E_(Import_Old), NULL );
-#if 0
-    add_submodule();
-        set_description( _("Native playlist import") );
-        add_shortcut( "playlist" );
-        add_shortcut( "native-open" );
-        set_capability( "demux2", 10 );
-        set_callbacks( E_(Import_Native), E_(Close_Native) );
-#endif
+    add_integer( "parent-item", 0, NULL, NULL, NULL, VLC_TRUE );
+        change_internal();
+
+    set_shortname( _("Playlist") );
+    set_description( _("Playlist") );
     add_submodule();
         set_description( _("M3U playlist import") );
         add_shortcut( "m3u-open" );
@@ -73,6 +71,48 @@ vlc_module_begin();
         add_shortcut( "shout-b4s" );
         set_capability( "demux2", 10 );
         set_callbacks( E_(Import_B4S), E_(Close_B4S) );
+    add_submodule();
+        set_description( _("DVB playlist import") );
+        add_shortcut( "dvb-open" );
+        set_capability( "demux2", 10 );
+        set_callbacks( E_(Import_DVB), E_(Close_DVB) );
+    add_submodule();
+        set_description( _("Podcast parser") );
+        add_shortcut( "podcast" );
+        set_capability( "demux2", 10 );
+        set_callbacks( E_(Import_podcast), E_(Close_podcast) );
+    add_submodule();
+        set_description( _("XSPF playlist import") );
+        add_shortcut( "xspf-open" );
+        set_capability( "demux2", 10 );
+        set_callbacks( E_(xspf_import_Activate), NULL );
+    add_submodule();
+        set_description( _("New winamp 5.2 shoutcast import") );
+        add_shortcut( "shout-winamp" );
+        set_capability( "demux2", 10 );
+        set_callbacks( E_(Import_Shoutcast), E_(Close_Shoutcast) );
+        add_bool( "shoutcast-show-adult", VLC_FALSE, NULL,
+                   SHOW_ADULT_TEXT, SHOW_ADULT_LONGTEXT, VLC_FALSE );
+    add_submodule();
+        set_description( _("ASX playlist import") );
+        add_shortcut( "asx-open" );
+        set_capability( "demux2", 10 );
+        set_callbacks( E_(Import_ASX), E_(Close_ASX) );
+    add_submodule();
+        set_description( _("Kasenna MediaBase parser") );
+        add_shortcut( "sgimb" );
+        set_capability( "demux2", 10 );
+        set_callbacks( E_(Import_SGIMB), E_(Close_SGIMB) );
+    add_submodule();
+        set_description( _("QuickTime Media Link importer") );
+        add_shortcut( "qtl" );
+        set_capability( "demux2", 10 );
+        set_callbacks( E_(Import_QTL), E_(Close_QTL) );
+    add_submodule();
+        set_description( _("Google Video Playlist importer") );
+        add_shortcut( "gvp" );
+        set_capability( "demux2", 10 );
+        set_callbacks( E_(Import_GVP), E_(Close_GVP) );
 vlc_module_end();
 
 
@@ -125,13 +165,37 @@ char *E_(ProcessMRL)( char *psz_mrl, char *psz_prefix )
     return psz_mrl;
 }
 
+void E_(AddToPlaylist)( demux_t *p_demux, playlist_t *p_playlist,
+                        input_item_t *p_input,
+                        playlist_item_t *p_item, int i_parent_id )
+{
+    // Only add to parent if specific parent requested or not current
+    // playlist item
+   if( i_parent_id > 0 || ! (
+         p_playlist->status.p_item &&
+         p_playlist->status.p_item->p_input ==
+              ((input_thread_t *)p_demux->p_parent)->input.p_item ) )
+   {
+       playlist_NodeAddInput( p_playlist, p_input, p_item,
+                              PLAYLIST_APPEND, PLAYLIST_END );
+   }
+   // Else, add to both
+   else
+   {
+       playlist_BothAddInput( p_playlist, p_input, p_item,
+                              PLAYLIST_APPEND, PLAYLIST_END );
+   }
+   input_ItemCopyOptions( p_item->p_input, p_input );
+}
+
+
 vlc_bool_t E_(FindItem)( demux_t *p_demux, playlist_t *p_playlist,
                      playlist_item_t **pp_item )
 {
      vlc_bool_t b_play = var_CreateGetBool( p_demux, "playlist-autostart" );
 
      if( b_play && p_playlist->status.p_item &&
-             &p_playlist->status.p_item->input ==
+             p_playlist->status.p_item->p_input ==
                 ((input_thread_t *)p_demux->p_parent)->input.p_item )
      {
          msg_Dbg( p_playlist, "starting playlist playback" );
@@ -148,6 +212,7 @@ vlc_bool_t E_(FindItem)( demux_t *p_demux, playlist_t *p_playlist,
              msg_Dbg( p_playlist, "unable to find item in playlist");
          }
          msg_Dbg( p_playlist, "not starting playlist playback");
+         p_playlist->status.i_status = PLAYLIST_STOPPED;
          b_play = VLC_FALSE;
      }
      return b_play;