itml.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002  * itml.c : iTunes Music Library import functions
00003  *******************************************************************************
00004  * Copyright (C) 2007 the VideoLAN team
00005  * $Id$
00006  *
00007  * Authors: Yoann Peronneau <yoann@videolan.org>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00022  *******************************************************************************/
00023 /**
00024  * \file modules/demux/playlist/itml.h
00025  * \brief iTunes Music Library import: prototypes, datatypes, defines
00026  */
00027 
00028 /* defines */
00029 #define FREE(v)        free(v);v=NULL;
00030 #define FREE_NAME()    free(psz_name);psz_name=NULL;
00031 #define FREE_VALUE()   free(psz_value);psz_value=NULL;
00032 #define FREE_KEY()     free(psz_key);psz_key=NULL;
00033 #define FREE_ATT()     FREE_NAME();FREE_VALUE()
00034 #define FREE_ATT_KEY() FREE_NAME();FREE_VALUE();FREE_KEY()
00035 
00036 #define UNKNOWN_CONTENT 0
00037 #define SIMPLE_CONTENT 1
00038 #define COMPLEX_CONTENT 2
00039 
00040 #define SIMPLE_INTERFACE  (track_elem_t    *p_track,\
00041                            const char      *psz_name,\
00042                            char            *psz_value)
00043 #define COMPLEX_INTERFACE (demux_t         *p_demux,\
00044                            input_item_t    *p_input_item,\
00045                            track_elem_t    *p_track,\
00046                            xml_reader_t    *p_xml_reader,\
00047                            const char      *psz_element,\
00048                            struct xml_elem_hnd  *p_handlers)
00049 
00050 /* datatypes */
00051 typedef struct
00052 {
00053     char *name, *artist, *album, *genre, *trackNum, *location;
00054     mtime_t duration;
00055 } track_elem_t;
00056 
00057 struct xml_elem_hnd
00058 {
00059     const char *name;
00060     int type;
00061     union
00062     {
00063         bool (*smpl) SIMPLE_INTERFACE;
00064         bool (*cmplx) COMPLEX_INTERFACE;
00065     } pf_handler;
00066 };
00067 typedef struct xml_elem_hnd xml_elem_hnd_t;
00068 
00069 /* prototypes */
00070 static bool parse_plist_node COMPLEX_INTERFACE;
00071 static bool skip_element COMPLEX_INTERFACE;
00072 static bool parse_dict COMPLEX_INTERFACE;
00073 static bool parse_plist_dict COMPLEX_INTERFACE;
00074 static bool parse_tracks_dict COMPLEX_INTERFACE;
00075 static bool parse_track_dict COMPLEX_INTERFACE;
00076 static bool save_data SIMPLE_INTERFACE;
00077 static bool add_meta( input_item_t*, track_elem_t* );
00078 static track_elem_t *new_track( void );
00079 static void free_track( track_elem_t* );
00080 

Generated on Wed Aug 13 08:02:37 2008 for VLC by  doxygen 1.5.1