]> git.sesse.net Git - vlc/blob - modules/demux/playlist/playlist.h
Fix playlist crasher and simplify a few things
[vlc] / modules / demux / playlist / playlist.h
1 /*****************************************************************************
2  * playlist.h:  Playlist import module common functions
3  *****************************************************************************
4  * Copyright (C) 2004 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Sigmund Augdal Helberg <dnumgis@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 char *E_(ProcessMRL)( char *, char * );
25 char *E_(FindPrefix)( demux_t * );
26
27 vlc_bool_t E_(FindItem)( demux_t *, playlist_t *, playlist_item_t **);
28
29 void E_(AddToPlaylist)( demux_t *, playlist_t*,input_item_t*,playlist_item_t*,int );
30
31 int E_(Import_Old) ( vlc_object_t * );
32
33 int E_(Import_Native) ( vlc_object_t * );
34 void E_(Close_Native) ( vlc_object_t * );
35
36 int E_(Import_M3U) ( vlc_object_t * );
37 void E_(Close_M3U) ( vlc_object_t * );
38
39 int E_(Import_PLS) ( vlc_object_t * );
40 void E_(Close_PLS) ( vlc_object_t * );
41
42 int E_(Import_B4S) ( vlc_object_t * );
43 void E_(Close_B4S) ( vlc_object_t * );
44
45 int E_(Import_DVB) ( vlc_object_t * );
46 void E_(Close_DVB) ( vlc_object_t * );
47
48 int E_(Import_podcast) ( vlc_object_t * );
49 void E_(Close_podcast) ( vlc_object_t * );
50
51 int E_(xspf_import_Activate) ( vlc_object_t * );
52
53 int E_(Import_Shoutcast) ( vlc_object_t * );
54 void E_(Close_Shoutcast) ( vlc_object_t * );
55
56 #define INIT_PLAYLIST_STUFF \
57     int i_parent_id; \
58     vlc_bool_t b_play; \
59     playlist_item_t *p_current, *p_item_in_category = NULL; \
60     input_item_t *p_input; \
61     playlist_t *p_playlist = (playlist_t *) vlc_object_find( p_demux, \
62                                         VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); \
63     if( !p_playlist ) \
64     { \
65         msg_Err( p_demux, "can't find playlist" ); \
66         return VLC_EGENERIC; \
67     } \
68     i_parent_id = var_CreateGetInteger( p_demux, "parent-item" ); \
69     if( i_parent_id > 0 ) \
70     { \
71         b_play = VLC_FALSE;     \
72         p_current = playlist_ItemGetById( p_playlist, i_parent_id );    \
73     } \
74     else \
75     { \
76         b_play = E_(FindItem)( p_demux, p_playlist, &p_current ); \
77         p_item_in_category = playlist_ItemToNode( p_playlist, p_current ); \
78         p_current->p_input->i_type = ITEM_TYPE_PLAYLIST;        \
79     }
80
81 #define HANDLE_PLAY_AND_RELEASE \
82     /* Go back and play the playlist */ \
83     if( b_play && p_playlist->status.p_item && \
84                   p_playlist->status.p_item->i_children > 0 ) \
85     { \
86         playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,  \
87                           p_playlist->status.p_item, NULL ); \
88     } \
89     vlc_object_release( p_playlist );
90