1 /*******************************************************************************
2 * itml.c : iTunes Music Library import functions
3 *******************************************************************************
4 * Copyright (C) 2007 the VideoLAN team
7 * Authors: Yoann Peronneau <yoann@videolan.org>
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.
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.
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 *******************************************************************************/
24 * \file modules/demux/playlist/itml.h
25 * \brief iTunes Music Library import: prototypes, datatypes, defines
29 #define FREE(v) if (v) {free(v);v=NULL;}
30 #define FREE_NAME() if (psz_name) {free(psz_name);psz_name=NULL;}
31 #define FREE_VALUE() if (psz_value) {free(psz_value);psz_value=NULL;}
32 #define FREE_KEY() if (psz_key) {free(psz_key);psz_key=NULL;}
33 #define FREE_ATT() FREE_NAME();FREE_VALUE()
34 #define FREE_ATT_KEY() FREE_NAME();FREE_VALUE();FREE_KEY()
36 #define UNKNOWN_CONTENT 0
37 #define SIMPLE_CONTENT 1
38 #define COMPLEX_CONTENT 2
40 #define SIMPLE_INTERFACE (track_elem_t *p_track,\
41 const char *psz_name,\
43 #define COMPLEX_INTERFACE (demux_t *p_demux,\
44 playlist_t *p_playlist,\
45 input_item_t *p_input_item,\
46 track_elem_t *p_track,\
47 xml_reader_t *p_xml_reader,\
48 const char *psz_element,\
49 struct xml_elem_hnd *p_handlers)
54 char *name, *artist, *album, *genre, *trackNum, *location;
64 vlc_bool_t (*smpl) SIMPLE_INTERFACE;
65 vlc_bool_t (*cmplx) COMPLEX_INTERFACE;
68 typedef struct xml_elem_hnd xml_elem_hnd_t;
71 static vlc_bool_t parse_plist_node COMPLEX_INTERFACE;
72 static vlc_bool_t skip_element COMPLEX_INTERFACE;
73 static vlc_bool_t parse_dict COMPLEX_INTERFACE;
74 static vlc_bool_t parse_plist_dict COMPLEX_INTERFACE;
75 static vlc_bool_t parse_tracks_dict COMPLEX_INTERFACE;
76 static vlc_bool_t parse_track_dict COMPLEX_INTERFACE;
77 static vlc_bool_t save_data SIMPLE_INTERFACE;
78 static vlc_bool_t add_meta( input_item_t*, track_elem_t* );
79 static track_elem_t *new_track( void );
80 static void free_track( track_elem_t* );