1 /******************************************************************************* 2 * itml.h : iTunes Music Library import functions 3 ******************************************************************************* 4 * Copyright (C) 2007 VLC authors and VideoLAN 5 * $Id: e09c8e42888f58fab7a59e6a2c8763dd4f5ef362 $ 6 * 7 * Authors: Yoann Peronneau <yoann@videolan.org> 8 * 9 * This program is free software; you can redistribute it and/or modify it 10 * under the terms of the GNU Lesser General Public License as published by 11 * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. 18 * 19 * You should have received a copy of the GNU Lesser General Public License 20 * along with this program; if not, write to the Free Software Foundation, 21 * 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 UNKNOWN_CONTENT 0 30 #define SIMPLE_CONTENT 1 31 #define COMPLEX_CONTENT 2 32 33 #define SIMPLE_INTERFACE (track_elem_t *p_track,\ 34 const char *psz_name,\ 35 char *psz_value,\ 36 void *opaque) 37 #define COMPLEX_INTERFACE (stream_t *p_demux,\ 38 input_item_node_t *p_input_node,\ 39 track_elem_t *p_track,\ 40 xml_reader_t *p_xml_reader,\ 41 const char *psz_element,\ 42 struct xml_elem_hnd *p_handlers) 43 44 /* datatypes */ 45 typedef struct 46 { 47 char *name, *artist, *album, *genre, *trackNum, *location; 48 mtime_t duration; 49 } track_elem_t; 50 51 struct xml_elem_hnd 52 { 53 const char *name; 54 int type; 55 union 56 { 57 bool (*smpl) SIMPLE_INTERFACE; 58 bool (*cmplx) COMPLEX_INTERFACE; 59 } pf_handler; 60 }; 61 typedef struct xml_elem_hnd xml_elem_hnd_t; 62 63 /* prototypes */ 64 static bool parse_plist_node COMPLEX_INTERFACE; 65 static bool skip_element COMPLEX_INTERFACE; 66 static bool parse_dict COMPLEX_INTERFACE; 67 static bool parse_plist_dict COMPLEX_INTERFACE; 68 static bool parse_tracks_dict COMPLEX_INTERFACE; 69 static bool parse_track_dict COMPLEX_INTERFACE; 70 static bool save_data SIMPLE_INTERFACE; 71 static bool add_meta( input_item_t*, track_elem_t* ); 72 static track_elem_t *new_track( void ); 73 static void free_track( track_elem_t* ); 74 75