]> git.sesse.net Git - vlc/blob - modules/demux/playlist/itml.h
Use var_Inherit* instead of var_CreateGet*.
[vlc] / modules / demux / playlist / itml.h
1 /*******************************************************************************
2  * itml.c : iTunes Music Library import functions
3  *******************************************************************************
4  * Copyright (C) 2007 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Yoann Peronneau <yoann@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  * \file modules/demux/playlist/itml.h
25  * \brief iTunes Music Library import: prototypes, datatypes, defines
26  */
27
28 /* defines */
29 #define FREE_NAME()     FREENULL( psz_name )
30 #define FREE_VALUE()    FREENULL( psz_value )
31 #define FREE_KEY()      FREENULL( psz_key )
32 #define FREE_ATT()      do{ FREE_NAME();FREE_VALUE(); }while(0)
33 #define FREE_ATT_KEY()  do{ FREE_NAME();FREE_VALUE();FREE_KEY();} while(0)
34
35 #define UNKNOWN_CONTENT 0
36 #define SIMPLE_CONTENT 1
37 #define COMPLEX_CONTENT 2
38
39 #define SIMPLE_INTERFACE  (track_elem_t    *p_track,\
40                            const char      *psz_name,\
41                            char            *psz_value)
42 #define COMPLEX_INTERFACE (demux_t         *p_demux,\
43                            input_item_node_t    *p_input_node,\
44                            track_elem_t    *p_track,\
45                            xml_reader_t    *p_xml_reader,\
46                            const char      *psz_element,\
47                            struct xml_elem_hnd  *p_handlers)
48
49 /* datatypes */
50 typedef struct
51 {
52     char *name, *artist, *album, *genre, *trackNum, *location;
53     mtime_t duration;
54 } track_elem_t;
55
56 struct xml_elem_hnd
57 {
58     const char *name;
59     int type;
60     union
61     {
62         bool (*smpl) SIMPLE_INTERFACE;
63         bool (*cmplx) COMPLEX_INTERFACE;
64     } pf_handler;
65 };
66 typedef struct xml_elem_hnd xml_elem_hnd_t;
67
68 /* prototypes */
69 static bool parse_plist_node COMPLEX_INTERFACE;
70 static bool skip_element COMPLEX_INTERFACE;
71 static bool parse_dict COMPLEX_INTERFACE;
72 static bool parse_plist_dict COMPLEX_INTERFACE;
73 static bool parse_tracks_dict COMPLEX_INTERFACE;
74 static bool parse_track_dict COMPLEX_INTERFACE;
75 static bool save_data SIMPLE_INTERFACE;
76 static bool add_meta( input_item_t*, track_elem_t* );
77 static track_elem_t *new_track( void );
78 static void free_track( track_elem_t* );
79