]> git.sesse.net Git - vlc/blobdiff - modules/demux/playlist/podcast.c
skins2: simplify equalizer initialization
[vlc] / modules / demux / playlist / podcast.c
index 405b51b25fc2373a23bcc6291de5baf8b6f449ec..022b87bff601f3495f195c744bedc04df4803d58 100644 (file)
@@ -1,24 +1,24 @@
 /*****************************************************************************
  * 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.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -38,7 +38,6 @@
  * 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 );
 
 /*****************************************************************************
@@ -58,14 +57,6 @@ int Import_podcast( vlc_object_t *p_this )
     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 )
 {
@@ -130,46 +121,30 @@ 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;
             }
@@ -259,7 +234,7 @@ static int Demux( demux_t *p_demux )
                         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 );
 
@@ -302,7 +277,7 @@ static int Demux( demux_t *p_demux )
                     vlc_gc_decref( p_input );
                     b_item = false;
                 }
-                else if( !strcmp( psz_elname, "image" ) )
+                else if( !strcmp( node, "image" ) )
                 {
                     b_image = false;
                 }
@@ -348,12 +323,6 @@ error:
     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;