| 111 | | if( TagLib::MPEG::File *p_mpeg = |
|---|
| 112 | | dynamic_cast<TagLib::MPEG::File *>(f.file() ) ) |
|---|
| 113 | | { |
|---|
| 114 | | if( p_mpeg->ID3v2Tag() ) |
|---|
| 115 | | { |
|---|
| 116 | | TagLib::ID3v2::Tag *tag = p_mpeg->ID3v2Tag(); |
|---|
| 117 | | TagLib::ID3v2::FrameList list = tag->frameListMap()["UFID"]; |
|---|
| 118 | | TagLib::ID3v2::UniqueFileIdentifierFrame* p_ufid; |
|---|
| 119 | | for( TagLib::ID3v2::FrameList::Iterator iter = list.begin(); |
|---|
| 120 | | iter != list.end(); iter++ ) |
|---|
| | 112 | if( TagLib::MPEG::File *p_mpeg = |
|---|
| | 113 | dynamic_cast<TagLib::MPEG::File *>(f.file() ) ) |
|---|
| 126 | | /* ID3v2 UFID contains up to 64 bytes binary data |
|---|
| 127 | | * but in our case it will be a '\0' terminated string */ |
|---|
| 128 | | char *psz_ufid = (char*) malloc( 64 ); |
|---|
| 129 | | int j = 0; |
|---|
| 130 | | while( ( j < 63 ) && ( j < p_ufid->identifier().size() ) ) |
|---|
| 131 | | psz_ufid[j] = p_ufid->identifier()[j++]; |
|---|
| 132 | | psz_ufid[j] = '\0'; |
|---|
| 133 | | vlc_meta_SetTrackID( p_meta, psz_ufid ); |
|---|
| 134 | | free( psz_ufid ); |
|---|
| | 117 | TagLib::ID3v2::Tag *tag = p_mpeg->ID3v2Tag(); |
|---|
| | 118 | TagLib::ID3v2::FrameList list = tag->frameListMap()["UFID"]; |
|---|
| | 119 | TagLib::ID3v2::UniqueFileIdentifierFrame* p_ufid; |
|---|
| | 120 | for( TagLib::ID3v2::FrameList::Iterator iter = list.begin(); |
|---|
| | 121 | iter != list.end(); iter++ ) |
|---|
| | 122 | { |
|---|
| | 123 | p_ufid = dynamic_cast<TagLib::ID3v2::UniqueFileIdentifierFrame*>(*iter); |
|---|
| | 124 | const char *owner = p_ufid->owner().toCString(); |
|---|
| | 125 | if (!strcmp( owner, "http://musicbrainz.org" )) |
|---|
| | 126 | { |
|---|
| | 127 | /* ID3v2 UFID contains up to 64 bytes binary data |
|---|
| | 128 | * but in our case it will be a '\0' |
|---|
| | 129 | * terminated string */ |
|---|
| | 130 | char *psz_ufid = (char*) malloc( 64 ); |
|---|
| | 131 | int j = 0; |
|---|
| | 132 | while( ( j < 63 ) && |
|---|
| | 133 | ( j < p_ufid->identifier().size() ) ) |
|---|
| | 134 | psz_ufid[j] = p_ufid->identifier()[j++]; |
|---|
| | 135 | psz_ufid[j] = '\0'; |
|---|
| | 136 | vlc_meta_SetTrackID( p_meta, psz_ufid ); |
|---|
| | 137 | free( psz_ufid ); |
|---|
| | 138 | } |
|---|
| | 139 | } |
|---|
| | 140 | /* musicbrainz artist and album id: not useful yet */ |
|---|
| | 141 | #if 0 |
|---|
| | 142 | list = tag->frameListMap()["TXXX"]; |
|---|
| | 143 | TagLib::ID3v2::UserTextIdentificationFrame* p_txxx; |
|---|
| | 144 | for( TagLib::ID3v2::FrameList::Iterator iter = list.begin(); |
|---|
| | 145 | iter != list.end(); iter++ ) |
|---|
| | 146 | { |
|---|
| | 147 | p_txxx = dynamic_cast<TagLib::ID3v2::UserTextIdentificationFrame*>(*iter); |
|---|
| | 148 | const char *psz_desc= p_txxx->description().toCString(); |
|---|
| | 149 | if( !strncmp( psz_desc, "MusicBrainz Artist Id", 21 ) ) |
|---|
| | 150 | vlc_meta_SetArtistID( p_meta, |
|---|
| | 151 | p_txxx->fieldList().toString().toCString()); |
|---|
| | 152 | if( !strncmp( psz_desc, "MusicBrainz Album Id", 20 ) ) |
|---|
| | 153 | vlc_meta_SetAlbumID( p_meta, |
|---|
| | 154 | p_txxx->fieldList().toString().toCString()); |
|---|
| | 155 | } |
|---|
| | 156 | #endif |
|---|
| 137 | | /* musicbrainz artist and album id: not useful yet */ |
|---|
| 138 | | #if 0 |
|---|
| 139 | | list = tag->frameListMap()["TXXX"]; |
|---|
| 140 | | TagLib::ID3v2::UserTextIdentificationFrame* p_txxx; |
|---|
| 141 | | for( TagLib::ID3v2::FrameList::Iterator iter = list.begin(); |
|---|
| 142 | | iter != list.end(); iter++ ) |
|---|
| 143 | | { |
|---|
| 144 | | p_txxx = dynamic_cast<TagLib::ID3v2::UserTextIdentificationFrame*>(*iter); |
|---|
| 145 | | const char *psz_desc = p_txxx->description().toCString(); |
|---|
| 146 | | if( !strncmp( psz_desc, "MusicBrainz Artist Id", 21 ) ) |
|---|
| 147 | | vlc_meta_SetArtistID( p_meta, |
|---|
| 148 | | p_txxx->fieldList().toString().toCString() ); |
|---|
| 149 | | if( !strncmp( psz_desc, "MusicBrainz Album Id", 20 ) ) |
|---|
| 150 | | vlc_meta_SetAlbumID( p_meta, |
|---|
| 151 | | p_txxx->fieldList().toString().toCString() ); |
|---|
| 152 | | } |
|---|
| 153 | | #endif |
|---|
| 154 | | } |
|---|
| 155 | | } |
|---|
| | 159 | |
|---|