/*****************************************************************************
* podcast.c : podcast playlist imports
*****************************************************************************
- * Copyright (C) 2005-2009 the VideoLAN team
+ * Copyright (C) 2005-2009 VLC authors and VideoLAN
* $Id$
*
* Authors: Antoine Cellerier <dionoea -at- videolan -dot- org>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int Demux( demux_t *p_demux);
-static int Control( demux_t *p_demux, int i_query, va_list args );
static mtime_t strTimeToMTime( const char *psz );
/*****************************************************************************
return VLC_SUCCESS;
}
-/*****************************************************************************
- * Deactivate: frees unused data
- *****************************************************************************/
-void Close_podcast( vlc_object_t *p_this )
-{
- (void)p_this;
-}
-
/* "specs" : http://phobos.apple.com/static/iTunesRSS.html */
static int Demux( demux_t *p_demux )
{
b_image = true;
// Read the attributes
- const char *attr;
- while( (attr = xml_ReaderNextAttr( p_xml_reader )) )
+ const char *attr, *value;
+ while( (attr = xml_ReaderNextAttr( p_xml_reader, &value )) )
{
- char *psz_value = xml_ReaderValue( p_xml_reader );
- if( !psz_value )
- {
- free( psz_value );
- goto error;
- }
-
if( !strcmp( node, "enclosure" ) )
{
+ char **p = NULL;
if( !strcmp( attr, "url" ) )
- {
- free( psz_item_mrl );
- psz_item_mrl = psz_value;
- }
+ p = &psz_item_mrl;
else if( !strcmp( attr, "length" ) )
- {
- free( psz_item_size );
- psz_item_size = psz_value;
- }
+ p = &psz_item_size;
else if( !strcmp( attr, "type" ) )
+ p = &psz_item_type;
+ if( p != NULL )
{
- free( psz_item_type );
- psz_item_type = psz_value;
+ free( *p );
+ *p = strdup( value );
}
else
- {
- msg_Dbg( p_demux,"unhandled attribute %s in element %s",
+ msg_Dbg( p_demux,"unhandled attribute %s in <%s>",
attr, node );
- free( psz_value );
- }
}
else
- {
- msg_Dbg( p_demux,"unhandled attribute %s in element %s",
+ msg_Dbg( p_demux,"unhandled attribute %s in <%s>",
attr, node );
- free( psz_value );
- }
}
break;
}
goto error;
}
- p_input = input_item_New( p_demux, psz_item_mrl, psz_item_name );
+ p_input = input_item_New( psz_item_mrl, psz_item_name );
FREENULL( psz_item_mrl );
FREENULL( psz_item_name );
vlc_gc_decref( p_input );
b_item = false;
}
- else if( !strcmp( psz_elname, "image" ) )
+ else if( !strcmp( node, "image" ) )
{
b_image = false;
}
return -1;
}
-static int Control( demux_t *p_demux, int i_query, va_list args )
-{
- VLC_UNUSED(p_demux); VLC_UNUSED(i_query); VLC_UNUSED(args);
- return VLC_EGENERIC;
-}
-
static mtime_t strTimeToMTime( const char *psz )
{
int h, m, s;