xspf_c  1.2.0
xspf_c.h
Go to the documentation of this file.
00001 /*
00002  * xspf_c - Simple C interface for libxspf
00003  *
00004  * Copyright (C) 2007, Ed Schouten / Xiph.Org Foundation
00005  * Copyright (C) 2008, Sebastian Pipping / Xiph.Org Foundation
00006  * All rights reserved.
00007  *
00008  * Redistribution  and use in source and binary forms, with or without
00009  * modification,  are permitted provided that the following conditions
00010  * are met:
00011  *
00012  *     * Redistributions   of  source  code  must  retain  the   above
00013  *       copyright  notice, this list of conditions and the  following
00014  *       disclaimer.
00015  *
00016  *     * Redistributions  in  binary  form must  reproduce  the  above
00017  *       copyright  notice, this list of conditions and the  following
00018  *       disclaimer   in  the  documentation  and/or  other  materials
00019  *       provided with the distribution.
00020  *
00021  *     * Neither  the name of the Xiph.Org Foundation nor the names of
00022  *       its  contributors may be used to endorse or promote  products
00023  *       derived  from  this software without specific  prior  written
00024  *       permission.
00025  *
00026  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00027  * "AS  IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT  NOT
00028  * LIMITED  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND  FITNESS
00029  * FOR  A  PARTICULAR  PURPOSE ARE DISCLAIMED. IN NO EVENT  SHALL  THE
00030  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00031  * INCIDENTAL,    SPECIAL,   EXEMPLARY,   OR   CONSEQUENTIAL   DAMAGES
00032  * (INCLUDING,  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00033  * SERVICES;  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00034  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
00035  * STRICT  LIABILITY,  OR  TORT (INCLUDING  NEGLIGENCE  OR  OTHERWISE)
00036  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
00037  * OF THE POSSIBILITY OF SUCH DAMAGE.
00038  *
00039  * Ed Schouten <ed@fxq.nl>
00040  * Sebastian Pipping <sping@xiph.org>
00041  */
00047 #ifndef XSPF_C_H
00048 #define XSPF_C_H
00049 
00054 struct xspf_mvalue {
00058         char *value;
00062         struct xspf_mvalue *next;
00063 
00067         void *pdata;
00068 };
00069 
00073 struct xspf_track {
00077         char *creator;
00081         char *title;
00085         char *album;
00086 
00090         int duration;
00094         int tracknum;
00095 
00099         struct xspf_mvalue *locations;
00103         struct xspf_mvalue *identifiers;
00104 
00108         struct xspf_track *next;
00109 
00113         void *pdata;
00114 };
00115 
00119 struct xspf_list {
00123         char *license;
00127         char *location;
00131         char *identifier;
00132 
00136         struct xspf_track *tracks;
00137 
00141         void *pdata;
00142 };
00143 
00147 #define XSPF_LIST_FOREACH_TRACK(l,t) \
00148     for ((t) = (l)->tracks; (t) != NULL; (t) = (t)->next)
00149 
00152 #define XSPF_TRACK_FOREACH_LOCATION(t,l) \
00153     for ((l) = (t)->locations; (l) != NULL; (l) = (l)->next)
00154 
00157 #define XSPF_TRACK_FOREACH_IDENTIFIER(t,i) \
00158     for ((i) = (t)->identifiers; (i) != NULL; (i) = (i)->next)
00159 
00163 struct xspf_list *xspf_parse(char const *filename, char const *baseuri);
00168 struct xspf_list *xspf_parse_memory(char const *memory, int len_bytes, char const *baseuri);
00172 struct xspf_list *xspf_new(void);
00176 void xspf_free(struct xspf_list *list);
00181 void xspf_setvalue(char **str, char const *nstr);
00188 struct xspf_mvalue *xspf_new_mvalue_before(
00189     struct xspf_mvalue **mvalue);
00196 struct xspf_track *xspf_new_track_before(
00197     struct xspf_track **track);
00201 int xspf_write(struct xspf_list *list, char const *filename, char const *baseuri);
00202 
00203 #endif /* !XSPF_C_H */
 All Classes Files Functions Variables Defines