a311fd89a8435176758c5f59a90ea718b9c813b3
[vlc.git] / modules / demux / playlist / xspf.h
1 /*****************************************************************************
2  * Copyright (C) 2006 Daniel Stränger <vlc at schmaller dot de>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
17  *******************************************************************************/
18 /**
19  * \file modules/demux/playlist/xspf.h
20  * \brief XSPF playlist import: prototypes, datatypes, defines
21  */
22
23 /* defines */
24 #define FREE_NAME()  if (psz_name) {free(psz_name);psz_name=NULL;}
25 #define FREE_VALUE() if (psz_value) {free(psz_value);psz_value=NULL;}
26 #define FREE_ATT()   FREE_NAME();FREE_VALUE()
27
28 #define UNKNOWN_CONTENT 0
29 #define SIMPLE_CONTENT 1
30 #define COMPLEX_CONTENT 2
31
32 #define SIMPLE_INTERFACE  (playlist_item_t *p_item,\
33                            input_item_t    *p_input,\
34                            const char      *psz_name,\
35                            char            *psz_value)
36 #define COMPLEX_INTERFACE (demux_t         *p_demux,\
37                            playlist_t      *p_playlist,\
38                            playlist_item_t *p_item,\
39                            input_item_t    *p_input, \
40                            xml_reader_t    *p_xml_reader,\
41                            const char      *psz_element)
42
43 /* prototypes */
44 int xspf_import_Demux( demux_t *);
45 int xspf_import_Control( demux_t *, int, va_list );
46
47 static vlc_bool_t parse_playlist_node COMPLEX_INTERFACE;
48 static vlc_bool_t parse_tracklist_node COMPLEX_INTERFACE;
49 static vlc_bool_t parse_track_node COMPLEX_INTERFACE;
50 static vlc_bool_t parse_extension_node COMPLEX_INTERFACE;
51 static vlc_bool_t parse_extitem_node COMPLEX_INTERFACE;
52 static vlc_bool_t set_item_info SIMPLE_INTERFACE;
53 static vlc_bool_t skip_element COMPLEX_INTERFACE;
54 static vlc_bool_t insert_new_item( playlist_t *, playlist_item_t *, playlist_item_t **, char *);
55
56 /* datatypes */
57 typedef struct
58 {
59     const char *name;
60     int type;
61     union
62     {
63         vlc_bool_t (*smpl) SIMPLE_INTERFACE;
64         vlc_bool_t (*cmplx) COMPLEX_INTERFACE;
65     } pf_handler;
66 } xml_elem_hnd_t;