]> git.sesse.net Git - vlc/blobdiff - modules/demux/playlist/zpl.c
Rewrites asx file support using vlc_xml API
[vlc] / modules / demux / playlist / zpl.c
index a12c405d9395143dac8b51d9d9f4024dbd1ad695..f909c4780fd0ee3f2ae387582e348044bee8cc36 100644 (file)
@@ -43,7 +43,6 @@ struct demux_sys_t
  * Local prototypes
  *****************************************************************************/
 static int Demux( demux_t *p_demux);
-static int Control( demux_t *p_demux, int i_query, va_list args );
 static char* ParseTabValue(char* psz_string);
 
 /*****************************************************************************
@@ -120,6 +119,7 @@ static int Demux( demux_t *p_demux )
             char *psz_tabvalue = ParseTabValue( psz_parse );
             if( !EMPTY_STR(psz_tabvalue) )
             {
+                free( psz_mrl );
                 psz_mrl = ProcessMRL( psz_tabvalue, p_demux->p_sys->psz_prefix );
             }
             free( psz_tabvalue );
@@ -140,7 +140,10 @@ static int Demux( demux_t *p_demux )
 
 #define PARSE(tag,variable)                                     \
     else if( !strncasecmp( psz_parse, tag, strlen( tag ) ) )    \
-        variable = ParseTabValue( psz_parse );
+    {                                                           \
+        free( variable );                                       \
+        variable = ParseTabValue( psz_parse );                  \
+    }
 
         PARSE( "TT", psz_title )
         PARSE( "TG", psz_genre )
@@ -176,8 +179,8 @@ static int Demux( demux_t *p_demux )
     if( !EMPTY_STR(variable) )                          \
     {                                                   \
         input_item_Set##type( p_input, variable );      \
-        FREENULL( variable );                           \
-    }
+    }                                                   \
+    FREENULL( variable );
             /* set the meta */
             SET( psz_genre, Genre );
             SET( psz_tracknum, TrackNum );
@@ -188,6 +191,8 @@ static int Demux( demux_t *p_demux )
             SET( psz_encodedby, EncodedBy );
             SET( psz_description, Description );
             SET( psz_copyright, Copyright );
+            SET( psz_url, URL );
+            SET( psz_publisher, Publisher );
 #undef SET
 
             vlc_gc_decref( p_input );
@@ -203,16 +208,26 @@ static int Demux( demux_t *p_demux )
     input_item_node_PostAndDelete( p_subitems );
 
     vlc_gc_decref(p_current_input);
+
+    // Free everything if the file is wrongly formated
+    free( psz_title );
+    free( psz_genre );
+    free( psz_tracknum );
+    free( psz_language );
+    free( psz_artist );
+    free( psz_album );
+    free( psz_date );
+    free( psz_publisher );
+    free( psz_encodedby );
+    free( psz_description );
+    free( psz_url );
+    free( psz_copyright );
+    free( psz_mrl );
+
     var_Destroy( p_demux, "zpl-extvlcopt" );
     return 0; /* Needed for correct operation of go back */
 }
 
-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 char* ParseTabValue(char* psz_string)
 {
     int i_len = strlen( psz_string );
@@ -226,5 +241,3 @@ static char* ParseTabValue(char* psz_string)
 
     return psz_value;
 }
-
-