Ignore empty vorbis comments (closes #704)
authorRafaël Carré <funman@videolan.org>
Mon, 20 Nov 2006 04:49:59 +0000 (04:49 +0000)
committerRafaël Carré <funman@videolan.org>
Mon, 20 Nov 2006 04:49:59 +0000 (04:49 +0000)
Comment unusued artist & album musicbrainz ids

include/vlc_meta.h
modules/codec/vorbis.c
modules/meta_engine/id3tag.c

index ed5c861..35ee574 100644 (file)
@@ -72,8 +72,10 @@ struct vlc_meta_t
     char *psz_encodedby;
     char *psz_arturl;
     char *psz_trackid;
+#if 0 //not used
     char *psz_artistid;
     char *psz_albumid;
+#endif
 
     int i_status;
 #if 0
@@ -104,8 +106,10 @@ struct vlc_meta_t
 #define vlc_meta_SetEncodedBy( meta, b ) vlc_meta_Set( meta, encodedby, b );
 #define vlc_meta_SetArtURL( meta, b ) vlc_meta_Set( meta, arturl, b );
 #define vlc_meta_SetTrackID( meta, b ) vlc_meta_Set( meta, trackid, b );
+#if 0 //not used
 #define vlc_meta_SetArtistID( meta, b ) vlc_meta_Set( meta, artistid, b );
 #define vlc_meta_SetAlbumID( meta, b ) vlc_meta_Set( meta, albumid, b );
+#endif
 
 
 static inline vlc_meta_t *vlc_meta_New( void )
@@ -129,8 +133,10 @@ static inline vlc_meta_t *vlc_meta_New( void )
     m->psz_encodedby = NULL;
     m->psz_arturl = NULL;
     m->psz_trackid = NULL;
+#if 0 //not used
     m->psz_artistid = NULL;
     m->psz_albumid = NULL;
+#endif
     m->i_status = 0;
     return m;
 }
@@ -153,8 +159,10 @@ static inline void vlc_meta_Delete( vlc_meta_t *m )
     free( m->psz_publisher );
     free( m->psz_encodedby );
     free( m->psz_trackid );
+#if 0 //not used
     free( m->psz_artistid );
     free( m->psz_albumid );
+#endif
     free( m->psz_arturl );
 
     free( m );
@@ -184,8 +192,10 @@ static inline void vlc_meta_Merge( vlc_meta_t *dst, vlc_meta_t *src )
     COPY_FIELD( publisher );
     COPY_FIELD( encodedby );
     COPY_FIELD( trackid );
+#if 0 //not used
     COPY_FIELD( artistid );
     COPY_FIELD( albumid );
+#endif
     COPY_FIELD( arturl );
 }
     /** \todo Track meta */
index bd20d89..561e350 100644 (file)
@@ -626,38 +626,59 @@ static void ParseVorbisComments( decoder_t *p_dec )
                            psz_name, psz_value );
             if( !strcasecmp( psz_name, "artist" ) )
             {
-                vlc_meta_SetArtist( p_input->input.p_item->p_meta,
-                                    psz_value );
-                input_ItemAddInfo( p_input->input.p_item,
-                                        _(VLC_META_INFO_CAT), _(VLC_META_ARTIST),
+                if( psz_value && ( *psz_value != '\0' ) )
+                {
+                    vlc_meta_SetArtist( p_input->input.p_item->p_meta,
+                                        psz_value );
+                    input_ItemAddInfo( p_input->input.p_item,
+                                        _(VLC_META_INFO_CAT),
+                                        _(VLC_META_ARTIST),
                                         "%s", psz_value );
+                }
             }
             else if( !strcasecmp( psz_name, "title" ) )
             {
-                vlc_meta_SetTitle( p_input->input.p_item->p_meta,
+                if( psz_value && ( *psz_value != '\0' ) )
+                {
+                    vlc_meta_SetTitle( p_input->input.p_item->p_meta,
                                     psz_value );
-                p_input->input.p_item->psz_name = strdup( psz_value );
+                    p_input->input.p_item->psz_name = strdup( psz_value );
+                }
             }
             else if( !strcasecmp( psz_name, "album" ) )
             {
-                vlc_meta_SetAlbum( p_input->input.p_item->p_meta,
+                if( psz_value && ( *psz_value != '\0' ) )
+                {
+                    vlc_meta_SetAlbum( p_input->input.p_item->p_meta,
                                     psz_value );
+                }
             }
             else if( !strcasecmp( psz_name, "musicbrainz_trackid" ) )
             {
-                vlc_meta_SetTrackID( p_input->input.p_item->p_meta,
+                if( psz_value && ( *psz_value != '\0' ) )
+                {
+                    vlc_meta_SetTrackID( p_input->input.p_item->p_meta,
                                     psz_value );
+                }
             }
+#if 0 //not used
             else if( !strcasecmp( psz_name, "musicbrainz_artistid" ) )
             {
-                vlc_meta_SetArtistID( p_input->input.p_item->p_meta,
+                if( psz_value && ( *psz_value != '\0' ) )
+                {
+                    vlc_meta_SetArtistID( p_input->input.p_item->p_meta,
                                     psz_value );
+                }
             }
             else if( !strcasecmp( psz_name, "musicbrainz_albumid" ) )
             {
-                vlc_meta_SetAlbumID( p_input->input.p_item->p_meta,
+                if( psz_value && ( *psz_value != '\0' ) )
+                {
+                    vlc_meta_SetAlbumID( p_input->input.p_item->p_meta,
                                     psz_value );
+                }
             }
+#endif
         }
         /* FIXME */
         var_SetInteger( p_input, "item-change", p_input->input.p_item->i_id );
index 308a2f9..d002d26 100644 (file)
@@ -91,7 +91,7 @@ static void ParseID3Tag( demux_t *p_demux, uint8_t *p_data, int i_size )
         }
         i++;
     }
-
+#if 0 //not used
     i = 0;
 
     while( ( p_frame = id3_tag_findframe( p_id3_tag, "TXXX", i ) ) )
@@ -118,7 +118,7 @@ static void ParseID3Tag( demux_t *p_demux, uint8_t *p_data, int i_size )
         free( psz_desc );
         i++;
     }
-    
+#endif
     i = 0;
 
     while( ( p_frame = id3_tag_findframe( p_id3_tag , "T", i ) ) )