Changeset 1a3692efa09bf95a908d853af13c7d227618f67f

Show
Ignore:
Timestamp:
10/02/06 22:35:25 (2 years ago)
Author:
Rafaël Carré <funman@videolan.org>
git-committer:
Rafaël Carré <funman@videolan.org> 1159821325 +0000
git-parent:

[0ddce802500f45a3f4126f6448ec6e5921a4abe1]

git-author:
Rafaël Carré <funman@videolan.org> 1159821325 +0000
Message:

Track, Artist, Album MusicBrainz? IDs reading with libid3tag

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/meta_engine/id3tag.c

    rbe82b7a r1a3692e  
    7171    if( !p_demux->p_private ) p_demux->p_private = (void *)vlc_meta_New(); 
    7272 
     73    vlc_meta_t *p_meta = (vlc_meta_t *)(p_demux->p_private); 
    7374#define ID_IS( a ) (!strcmp(  p_frame->id, a )) 
    7475#define DESCR_IS( a) strstr( (char*)p_frame->description, a ) 
    7576 
     77    while ( ( p_frame = id3_tag_findframe( p_id3_tag, "UFID", i ) ) ) 
     78    { 
     79        char *psz_owner = id3_field_getlatin1( &p_frame->fields[0] ); 
     80 
     81        if( !strncmp( psz_owner, "http://musicbrainz.org", 22 ) ) 
     82        { 
     83            id3_byte_t const * p_ufid; 
     84            id3_length_t i_ufidlen; 
     85 
     86            p_ufid = id3_field_getbinarydata( &p_frame->fields[1], &i_ufidlen ); 
     87            char *psz_ufid = strndup( p_ufid, i_ufidlen ); 
     88 
     89            vlc_meta_SetTrackID( p_meta, psz_ufid ); 
     90            free( psz_ufid ); 
     91        } 
     92        i++; 
     93    } 
     94 
     95    i = 0; 
     96 
     97    while( ( p_frame = id3_tag_findframe( p_id3_tag, "TXXX", i ) ) ) 
     98    { 
     99        char *psz_desc = id3_ucs4_latin1duplicate( 
     100                id3_field_getstring( &p_frame->fields[1] ) ); 
     101 
     102        if ( ! strncmp( psz_desc, "MusicBrainz Artist Id", 21 ) ) 
     103        { 
     104            char *psz_artistid = id3_ucs4_latin1duplicate( 
     105                    id3_field_getstring( &p_frame->fields[2] ) ); 
     106            vlc_meta_SetArtistID( p_meta, psz_artistid ); 
     107            free( psz_artistid ); 
     108        } 
     109 
     110        if ( ! strncmp( psz_desc, "MusicBrainz Album Id", 20 ) ) 
     111        { 
     112            char *psz_albumid = id3_ucs4_latin1duplicate( 
     113                    id3_field_getstring( &p_frame->fields[2] ) ); 
     114            vlc_meta_SetAlbumID( p_meta, psz_albumid ); 
     115            free( psz_albumid ); 
     116        } 
     117 
     118        free( psz_desc ); 
     119        i++; 
     120    } 
     121     
     122    i = 0; 
     123 
    76124    while( ( p_frame = id3_tag_findframe( p_id3_tag , "T", i ) ) ) 
    77125    { 
     
    80128        while( i_strings > 0 ) 
    81129        { 
    82             vlc_meta_t *p_meta = (vlc_meta_t *)(p_demux->p_private); 
    83  
    84130            char *psz_temp = id3_ucs4_utf8duplicate( 
    85131                id3_field_getstrings( &p_frame->fields[1], --i_strings ) );