]> git.sesse.net Git - vlc/blobdiff - modules/demux/playlist/playlist.h
Untested workarround for buggy asx files with an end of line char at the end of the...
[vlc] / modules / demux / playlist / playlist.h
index a8939e4f23cd50105adf44d1f49dbfe73fd1740e..0e71ab2b799cc4c53facfce2a7135b246e813c1b 100644 (file)
@@ -21,6 +21,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#include <vlc_playlist.h>
 char *E_(ProcessMRL)( char *, char * );
 char *E_(FindPrefix)( demux_t * );
 
@@ -48,7 +49,8 @@ void E_(Close_DVB) ( vlc_object_t * );
 int E_(Import_podcast) ( vlc_object_t * );
 void E_(Close_podcast) ( vlc_object_t * );
 
-int E_(xspf_import_Activate) ( vlc_object_t * );
+int E_(Import_xspf) ( vlc_object_t * );
+void E_(Close_xspf) ( vlc_object_t * );
 
 int E_(Import_Shoutcast) ( vlc_object_t * );
 void E_(Close_Shoutcast) ( vlc_object_t * );
@@ -65,38 +67,30 @@ void E_(Close_QTL) ( vlc_object_t * );
 int E_(Import_GVP) ( vlc_object_t * );
 void E_(Close_GVP) ( vlc_object_t * );
 
+int E_(Import_IFO) ( vlc_object_t * );
+void E_(Close_IFO) ( vlc_object_t * );
+
+int E_(Import_VideoPortal) ( vlc_object_t * );
+void E_(Close_VideoPortal) ( vlc_object_t * );
+
 #define INIT_PLAYLIST_STUFF \
-    int i_parent_id; \
-    vlc_bool_t b_play; \
-    playlist_item_t *p_current, *p_item_in_category = NULL; \
-    input_item_t *p_input; \
-    playlist_t *p_playlist = (playlist_t *) vlc_object_find( p_demux, \
-                                        VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); \
-    if( !p_playlist ) \
-    { \
-        msg_Err( p_demux, "can't find playlist" ); \
-        return VLC_EGENERIC; \
-    } \
-    i_parent_id = var_CreateGetInteger( p_demux, "parent-item" ); \
-    if( i_parent_id > 0 ) \
-    { \
-        b_play = VLC_FALSE;     \
-        p_current = playlist_ItemGetById( p_playlist, i_parent_id );    \
-    } \
-    else \
-    { \
-        b_play = E_(FindItem)( p_demux, p_playlist, &p_current ); \
-        p_item_in_category = playlist_ItemToNode( p_playlist, p_current ); \
-        p_current->p_input->i_type = ITEM_TYPE_PLAYLIST;        \
-    }
+    playlist_t *p_playlist = pl_Yield( p_demux ); \
+    vlc_bool_t b_play = var_CreateGetBool( p_demux, "playlist-autostart" ); \
+    input_thread_t *p_input_thread = (input_thread_t *)vlc_object_find( p_demux, VLC_OBJECT_INPUT, FIND_PARENT ); \
+    input_item_t *p_current_input = input_GetItem( p_input_thread ); \
+    playlist_item_t *p_current = \
+                 playlist_ItemGetByInput( p_playlist, p_current_input, VLC_FALSE ); \
+    playlist_item_t *p_item_in_category = \
+                            playlist_ItemToNode( p_playlist, p_current, \
+                                                 VLC_TRUE ); \
+    b_play = b_play && p_current == p_playlist->status.p_item; \
+    if( p_item_in_category ) \
+        p_item_in_category->p_input->i_type = ITEM_TYPE_PLAYLIST;
 
 #define HANDLE_PLAY_AND_RELEASE \
     /* Go back and play the playlist */ \
-    if( b_play && p_playlist->status.p_item && \
-                  p_playlist->status.p_item->i_children > 0 ) \
-    { \
-        playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,  \
-                          p_playlist->status.p_item, NULL ); \
-    } \
+    if( b_play && p_item_in_category ) \
+        playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, VLC_TRUE, p_item_in_category, NULL ); \
+    vlc_object_release( p_input_thread ); \
     vlc_object_release( p_playlist );