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: 59e8aa38c2c1cbfee71e35cfbd847cd7e029cf79 $
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_NAME()     FREENULL( psz_name )
00030 #define FREE_VALUE()    FREENULL( psz_value )
00031 #define FREE_KEY()      FREENULL( psz_key )
00032 #define FREE_ATT()      do{ FREE_NAME();FREE_VALUE(); }while(0)
00033 #define FREE_ATT_KEY()  do{ FREE_NAME();FREE_VALUE();FREE_KEY();} while(0)
00034 
00035 #define UNKNOWN_CONTENT 0
00036 #define SIMPLE_CONTENT 1
00037 #define COMPLEX_CONTENT 2
00038 
00039 #define SIMPLE_INTERFACE  (track_elem_t    *p_track,\
00040                            const char      *psz_name,\
00041                            char            *psz_value)
00042 #define COMPLEX_INTERFACE (demux_t         *p_demux,\
00043                            input_item_node_t    *p_input_node,\
00044                            track_elem_t    *p_track,\
00045                            xml_reader_t    *p_xml_reader,\
00046                            const char      *psz_element,\
00047                            struct xml_elem_hnd  *p_handlers)
00048 
00049 /* datatypes */
00050 typedef struct
00051 {
00052     char *name, *artist, *album, *genre, *trackNum, *location;
00053     mtime_t duration;
00054 } track_elem_t;
00055 
00056 struct xml_elem_hnd
00057 {
00058     const char *name;
00059     int type;
00060     union
00061     {
00062         bool (*smpl) SIMPLE_INTERFACE;
00063         bool (*cmplx) COMPLEX_INTERFACE;
00064     } pf_handler;
00065 };
00066 typedef struct xml_elem_hnd xml_elem_hnd_t;
00067 
00068 /* prototypes */
00069 static bool parse_plist_node COMPLEX_INTERFACE;
00070 static bool skip_element COMPLEX_INTERFACE;
00071 static bool parse_dict COMPLEX_INTERFACE;
00072 static bool parse_plist_dict COMPLEX_INTERFACE;
00073 static bool parse_tracks_dict COMPLEX_INTERFACE;
00074 static bool parse_track_dict COMPLEX_INTERFACE;
00075 static bool save_data SIMPLE_INTERFACE;
00076 static bool add_meta( input_item_t*, track_elem_t* );
00077 static track_elem_t *new_track( void );
00078 static void free_track( track_elem_t* );
00079 

Generated on Tue May 25 08:04:56 2010 for VLC by  doxygen 1.5.6