X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fmeta_engine%2Ftaglib.cpp;h=0ce4c164257b685ac460f7187a4b44d9981eafc1;hb=3ed66bc1fbfe281732af65457d64a23847b04cc6;hp=91323d2db240a9dd44754726fabd9971e0e18cb5;hpb=77e3f0df4630447ffb9f9b0cb6d0ca821e499f0e;p=vlc diff --git a/modules/meta_engine/taglib.cpp b/modules/meta_engine/taglib.cpp index 91323d2db2..0ce4c16425 100644 --- a/modules/meta_engine/taglib.cpp +++ b/modules/meta_engine/taglib.cpp @@ -1,7 +1,7 @@ /***************************************************************************** * taglib.cpp: Taglib tag parser/writer ***************************************************************************** - * Copyright (C) 2003-2009 the VideoLAN team + * Copyright (C) 2003-2011 the VideoLAN team * $Id$ * * Authors: Clément Stenac @@ -29,14 +29,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include /* demux_meta_t */ +#include /* vlc_b64_decode_binary */ +#include /* for attachment_new */ #ifdef WIN32 +# include # include #else # include @@ -44,26 +42,43 @@ // Taglib headers +#include +#define VERSION_INT(a, b, c) ((a)<<16 | (b)<<8 | (c)) +#define TAGLIB_VERSION VERSION_INT(TAGLIB_MAJOR_VERSION, \ + TAGLIB_MINOR_VERSION, \ + TAGLIB_PATCH_VERSION) + #include #include #include -#include -#include -#include +#if TAGLIB_VERSION >= VERSION_INT(1,7,0) +# define TAGLIB_HAVE_APEFILE_H +# include +# ifdef TAGLIB_WITH_ASF // ASF pictures comes with v1.7.0 +# define TAGLIB_HAVE_ASFPICTURE_H +# include +# endif +#endif +#include #include #include #include #include #include +#include "../demux/vorbis.h" -#ifdef TAGLIB_WITH_ASF +#if TAGLIB_VERSION >= VERSION_INT(1,6,0) +# define TAGLIB_HAVE_AIFF_WAV_H # include # include +#else +# include #endif -#ifdef TAGLIB_WITH_MP4 +#if TAGLIB_VERSION >= VERSION_INT(1,6,1) && defined(TAGLIB_WITH_MP4) +# define TAGLIB_HAVE_MP4COVERTART_H # include #endif @@ -76,6 +91,8 @@ #include #include +// taglib is not thread safe +static vlc_mutex_t taglib_lock = VLC_STATIC_MUTEX; // Local functions static int ReadMeta ( vlc_object_t * ); @@ -91,38 +108,106 @@ vlc_module_end () using namespace TagLib; +static void ExtractTrackNumberValues( vlc_meta_t* p_meta, const char *psz_value ) +{ + unsigned int i_trknum, i_trktot; + if( sscanf( psz_value, "%u/%u", &i_trknum, &i_trktot ) == 2 ) + { + char psz_trck[11]; + snprintf( psz_trck, sizeof( psz_trck ), "%u", i_trknum ); + vlc_meta_SetTrackNum( p_meta, psz_trck ); + snprintf( psz_trck, sizeof( psz_trck ), "%u", i_trktot ); + vlc_meta_Set( p_meta, vlc_meta_TrackTotal, psz_trck ); + } +} /** - * Read meta informations from APE tags + * Read meta information from APE tags * @param tag: the APE tag - * @param p_demux; the demux object * @param p_demux_meta: the demuxer meta * @param p_meta: the meta */ -static void ReadMetaFromAPE( APE::Tag* tag, demux_t* p_demux, demux_meta_t* p_demux_meta, vlc_meta_t* p_meta ) +static void ReadMetaFromAPE( APE::Tag* tag, demux_meta_t*, vlc_meta_t* p_meta ) { APE::Item item; #define SET( keyName, metaName ) \ item = tag->itemListMap()[keyName]; \ - vlc_meta_Set##metaName( p_meta, item.toString().toCString( true ) );\ + if( !item.isEmpty() ) vlc_meta_Set##metaName( p_meta, item.toString().toCString( true ) ); \ SET( "COPYRIGHT", Copyright ); SET( "LANGUAGE", Language ); SET( "PUBLISHER", Publisher ); #undef SET + + /* */ + item = tag->itemListMap()["TRACK"]; + if( !item.isEmpty() ) + { + ExtractTrackNumberValues( p_meta, item.toString().toCString( true ) ); + } } +#ifdef TAGLIB_HAVE_ASFPICTURE_H +/** + * Read meta information from APE tags + * @param tag: the APE tag + * @param p_demux_meta: the demuxer meta + * @param p_meta: the meta + */ +static void ReadMetaFromASF( ASF::Tag* tag, demux_meta_t* p_demux_meta, vlc_meta_t* p_meta ) +{ + // List the pictures + ASF::AttributeList list = tag->attributeListMap()["WM/Picture"]; + ASF::AttributeList::Iterator iter; + for( iter = list.begin(); iter != list.end(); iter++ ) + { + const ASF::Picture asfPicture = (*iter).toPicture(); + const ByteVector picture = asfPicture.picture(); + const char *psz_mime = asfPicture.mimeType().toCString(); + const char *p_data = picture.data(); + const unsigned i_data = picture.size(); + char *psz_name; + input_attachment_t *p_attachment; + + if( asfPicture.description().size() > 0 ) + psz_name = strdup( asfPicture.description().toCString( true ) ); + else + { + if( asprintf( &psz_name, "%i", asfPicture.type() ) == -1 ) + continue; + } + + msg_Dbg( p_demux_meta, "Found embedded art: %s (%s) is %u bytes", + psz_name, psz_mime, i_data ); + + p_attachment = vlc_input_attachment_New( psz_name, psz_mime, + psz_name, p_data, i_data ); + if( p_attachment ) + TAB_APPEND_CAST( (input_attachment_t**), + p_demux_meta->i_attachments, p_demux_meta->attachments, + p_attachment ); + free( psz_name ); + + char *psz_url; + if( asprintf( &psz_url, "attachment://%s", + p_attachment->psz_name ) == -1 ) + continue; + vlc_meta_SetArtURL( p_meta, psz_url ); + free( psz_url ); + } +} +#endif + /** * Read meta information from id3v2 tags * @param tag: the id3v2 tag - * @param p_demux; the demux object * @param p_demux_meta: the demuxer meta * @param p_meta: the meta */ -static void ReadMetaFromId3v2( ID3v2::Tag* tag, demux_t* p_demux, demux_meta_t* p_demux_meta, vlc_meta_t* p_meta ) +static void ReadMetaFromId3v2( ID3v2::Tag* tag, demux_meta_t* p_demux_meta, vlc_meta_t* p_meta ) { // Get the unique file identifier ID3v2::FrameList list = tag->frameListMap()["UFID"]; @@ -131,6 +216,8 @@ static void ReadMetaFromId3v2( ID3v2::Tag* tag, demux_t* p_demux, demux_meta_t* { ID3v2::UniqueFileIdentifierFrame* p_ufid = dynamic_cast(*iter); + if( !p_ufid ) + continue; const char *owner = p_ufid->owner().toCString(); if (!strcmp( owner, "http://musicbrainz.org" )) { @@ -151,11 +238,18 @@ static void ReadMetaFromId3v2( ID3v2::Tag* tag, demux_t* p_demux, demux_meta_t* { ID3v2::UserTextIdentificationFrame* p_txxx = dynamic_cast(*iter); + if( !p_txxx ) + continue; + if( !strcmp( p_txxx->description().toCString( true ), "TRACKTOTAL" ) ) + { + vlc_meta_Set( p_meta, vlc_meta_TrackTotal, p_txxx->fieldList().back().toCString( true ) ); + continue; + } vlc_meta_AddExtra( p_meta, p_txxx->description().toCString( true ), - p_txxx->fieldList().toString().toCString( true ) ); + p_txxx->fieldList().back().toCString( true ) ); } - // Get some more informations + // Get some more information #define SET( tagName, metaName ) \ list = tag->frameListMap()[tagName]; \ if( !list.isEmpty() ) \ @@ -169,6 +263,13 @@ static void ReadMetaFromId3v2( ID3v2::Tag* tag, demux_t* p_demux, demux_meta_t* #undef SET + /* */ + list = tag->frameListMap()["TRCK"]; + if( !list.isEmpty() ) + { + ExtractTrackNumberValues( p_meta, (*list.begin())->toString().toCString( true ) ); + } + /* Preferred type of image * The 21 types are defined in id3v2 standard: * http://www.id3.org/id3v2.4.0-frames */ @@ -195,6 +296,7 @@ static void ReadMetaFromId3v2( ID3v2::Tag* tag, demux_t* p_demux, demux_meta_t* 3, /* Logo of the band or performer. */ 2 /* Logo of the publisher (record company). */ }; + #define PI_COVER_SCORE_SIZE (sizeof (pi_cover_score) / sizeof (pi_cover_score[0])) int i_score = -1; // Try now to get embedded art @@ -207,6 +309,8 @@ static void ReadMetaFromId3v2( ID3v2::Tag* tag, demux_t* p_demux, demux_meta_t* { ID3v2::AttachedPictureFrame* p_apic = dynamic_cast(*iter); + if( !p_apic ) + continue; input_attachment_t *p_attachment; const char *psz_mime; @@ -254,9 +358,13 @@ static void ReadMetaFromId3v2( ID3v2::Tag* tag, demux_t* p_demux, demux_meta_t* p_attachment ); free( psz_description ); - if( pi_cover_score[p_apic->type()] > i_score ) + unsigned i_pic_type = p_apic->type(); + if( i_pic_type >= PI_COVER_SCORE_SIZE ) + i_pic_type = 0; // Defaults to "Other" + + if( pi_cover_score[i_pic_type] > i_score ) { - i_score = pi_cover_score[p_apic->type()]; + i_score = pi_cover_score[i_pic_type]; char *psz_url; if( asprintf( &psz_url, "attachment://%s", p_attachment->psz_name ) == -1 ) @@ -268,18 +376,17 @@ static void ReadMetaFromId3v2( ID3v2::Tag* tag, demux_t* p_demux, demux_meta_t* } - /** - * Read the meta informations from XiphComments + * Read the meta information from XiphComments * @param tag: the Xiph Comment - * @param p_demux; the demux object * @param p_demux_meta: the demuxer meta * @param p_meta: the meta */ -static void ReadMetaFromXiph( Ogg::XiphComment* tag, demux_t* p_demux, demux_meta_t* p_demux_meta, vlc_meta_t* p_meta ) +static void ReadMetaFromXiph( Ogg::XiphComment* tag, demux_meta_t* p_demux_meta, vlc_meta_t* p_meta ) { + StringList list; #define SET( keyName, metaName ) \ - StringList list = tag->fieldListMap()[keyName]; \ + list = tag->fieldListMap()[keyName]; \ if( !list.isEmpty() ) \ vlc_meta_Set##metaName( p_meta, (*list.begin()).toCString( true ) ); @@ -290,39 +397,62 @@ static void ReadMetaFromXiph( Ogg::XiphComment* tag, demux_t* p_demux, demux_met StringList mime_list = tag->fieldListMap()[ "COVERARTMIME" ]; StringList art_list = tag->fieldListMap()[ "COVERART" ]; - // We get only the first covert art - if( mime_list.size() > 1 || art_list.size() > 1 ) - msg_Warn( p_demux_meta, "Found %i embedded arts, so using only the first one", - art_list.size() ); - else if( mime_list.size() == 0 || art_list.size() == 0 ) - return; - input_attachment_t *p_attachment; - const char* psz_name = "cover"; - const char* psz_mime = mime_list[0].toCString(true); - const char* psz_description = "cover"; + if( mime_list.size() != 0 && art_list.size() != 0 ) + { + // We get only the first covert art + if( mime_list.size() > 1 || art_list.size() > 1 ) + msg_Warn( p_demux_meta, "Found %i embedded arts, so using only the first one", + art_list.size() ); - uint8_t *p_data; - int i_data = vlc_b64_decode_binary( &p_data, art_list[0].toCString(true) ); + const char* psz_name = "cover"; + const char* psz_mime = mime_list[0].toCString(true); + const char* psz_description = "cover"; - msg_Dbg( p_demux_meta, "Found embedded art: %s (%s) is %i bytes", - psz_name, psz_mime, i_data ); + uint8_t *p_data; + int i_data = vlc_b64_decode_binary( &p_data, art_list[0].toCString(true) ); - TAB_INIT( p_demux_meta->i_attachments, p_demux_meta->attachments ); - p_attachment = vlc_input_attachment_New( psz_name, psz_mime, - psz_description, p_data, i_data ); - free( p_data ); + msg_Dbg( p_demux_meta, "Found embedded art: %s (%s) is %i bytes", + psz_name, psz_mime, i_data ); + p_attachment = vlc_input_attachment_New( psz_name, psz_mime, + psz_description, p_data, i_data ); + free( p_data ); + } + else + { + art_list = tag->fieldListMap()[ "METADATA_BLOCK_PICTURE" ]; + if( art_list.size() == 0 ) + return; + + uint8_t *p_data; + int type; + int i_data = vlc_b64_decode_binary( &p_data, art_list[0].toCString(true) ); + p_attachment = ParseFlacPicture( p_data, i_data, 0, &type ); + } + + TAB_INIT( p_demux_meta->i_attachments, p_demux_meta->attachments ); TAB_APPEND_CAST( (input_attachment_t**), p_demux_meta->i_attachments, p_demux_meta->attachments, p_attachment ); - vlc_meta_SetArtURL( p_meta, "attachment://cover" ); + char *psz_url; + if( asprintf( &psz_url, "attachment://%s", p_attachment->psz_name ) != -1 ) { + vlc_meta_SetArtURL( p_meta, psz_url ); + free( psz_url ); + } } -#ifdef TAGLIB_WITH_MP4 -static void ReadMetaFromMP4( MP4::Tag* tag, demux_t *p_demux, demux_meta_t *p_demux_meta, vlc_meta_t* p_meta ) + +#ifdef TAGLIB_HAVE_MP4COVERTART_H +/** + * Read the meta information from mp4 specific tags + * @param tag: the mp4 tag + * @param p_demux_meta: the demuxer meta + * @param p_meta: the meta + */ +static void ReadMetaFromMP4( MP4::Tag* tag, demux_meta_t *p_demux_meta, vlc_meta_t* p_meta ) { if( tag->itemListMap().contains("covr") ) { @@ -344,6 +474,7 @@ static void ReadMetaFromMP4( MP4::Tag* tag, demux_t *p_demux, demux_meta_t *p_de } #endif + /** * Get the tags from the file using TagLib * @param p_this: the demux object @@ -351,31 +482,31 @@ static void ReadMetaFromMP4( MP4::Tag* tag, demux_t *p_demux, demux_meta_t *p_de */ static int ReadMeta( vlc_object_t* p_this) { + vlc_mutex_locker locker (&taglib_lock); demux_meta_t* p_demux_meta = (demux_meta_t *)p_this; demux_t* p_demux = p_demux_meta->p_demux; vlc_meta_t* p_meta; FileRef f; - char *psz_path = decode_URI_duplicate( p_demux->psz_path ); p_demux_meta->p_meta = NULL; - if( !psz_path ) - return VLC_ENOMEM; - if( strncmp( p_demux->psz_access, "file", strlen("file") ) ) + if( strcmp( p_demux->psz_access, "file" ) ) return VLC_EGENERIC; + char *psz_path = strdup( p_demux->psz_file ); + if( !psz_path ) + return VLC_ENOMEM; #if defined(WIN32) || defined (UNDER_CE) - wchar_t wpath[MAX_PATH + 1]; - if( !MultiByteToWideChar( CP_UTF8, 0, psz_path, -1, wpath, MAX_PATH) ) + wchar_t *wpath = ToWide( psz_path ); + if( wpath == NULL ) + { + free( psz_path ); return VLC_EGENERIC; - wpath[MAX_PATH] = L'\0'; + } f = FileRef( wpath ); + free( wpath ); #else - const char* local_name = ToLocale( psz_path ); - if( !local_name ) - return VLC_EGENERIC; - f = FileRef( local_name ); - LocaleFree( local_name ); + f = FileRef( psz_path ); #endif free( psz_path ); @@ -416,68 +547,83 @@ static int ReadMeta( vlc_object_t* p_this) // Try now to read special tags +#ifdef TAGLIB_HAVE_APEFILE_H + if( APE::File* ape = dynamic_cast(f.file()) ) + { + if( ape->APETag() ) + ReadMetaFromAPE( ape->APETag(), p_demux_meta, p_meta ); + } + else +#endif +#ifdef TAGLIB_HAVE_ASFPICTURE_H + if( ASF::File* asf = dynamic_cast(f.file()) ) + { + if( asf->tag() ) + ReadMetaFromASF( asf->tag(), p_demux_meta, p_meta ); + } + else +#endif if( FLAC::File* flac = dynamic_cast(f.file()) ) { if( flac->ID3v2Tag() ) - ReadMetaFromId3v2( flac->ID3v2Tag(), p_demux, p_demux_meta, p_meta ); + ReadMetaFromId3v2( flac->ID3v2Tag(), p_demux_meta, p_meta ); else if( flac->xiphComment() ) - ReadMetaFromXiph( flac->xiphComment(), p_demux, p_demux_meta, p_meta ); + ReadMetaFromXiph( flac->xiphComment(), p_demux_meta, p_meta ); } -#ifdef TAGLIB_WITH_MP4 +#ifdef TAGLIB_HAVE_MP4COVERTART_H else if( MP4::File *mp4 = dynamic_cast(f.file()) ) { if( mp4->tag() ) - ReadMetaFromMP4( mp4->tag(), p_demux, p_demux_meta, p_meta ); + ReadMetaFromMP4( mp4->tag(), p_demux_meta, p_meta ); } #endif else if( MPC::File* mpc = dynamic_cast(f.file()) ) { if( mpc->APETag() ) - ReadMetaFromAPE( mpc->APETag(), p_demux, p_demux_meta, p_meta ); + ReadMetaFromAPE( mpc->APETag(), p_demux_meta, p_meta ); } else if( MPEG::File* mpeg = dynamic_cast(f.file()) ) { if( mpeg->ID3v2Tag() ) - ReadMetaFromId3v2( mpeg->ID3v2Tag(), p_demux, p_demux_meta, p_meta ); + ReadMetaFromId3v2( mpeg->ID3v2Tag(), p_demux_meta, p_meta ); else if( mpeg->APETag() ) - ReadMetaFromAPE( mpeg->APETag(), p_demux, p_demux_meta, p_meta ); + ReadMetaFromAPE( mpeg->APETag(), p_demux_meta, p_meta ); } - else if( Ogg::File* ogg = dynamic_cast(f.file()) ) + else if( dynamic_cast(f.file()) ) { if( Ogg::FLAC::File* ogg_flac = dynamic_cast(f.file())) - ReadMetaFromXiph( ogg_flac->tag(), p_demux, p_demux_meta, p_meta ); + ReadMetaFromXiph( ogg_flac->tag(), p_demux_meta, p_meta ); else if( Ogg::Speex::File* ogg_speex = dynamic_cast(f.file()) ) - ReadMetaFromXiph( ogg_speex->tag(), p_demux, p_demux_meta, p_meta ); + ReadMetaFromXiph( ogg_speex->tag(), p_demux_meta, p_meta ); else if( Ogg::Vorbis::File* ogg_vorbis = dynamic_cast(f.file()) ) - ReadMetaFromXiph( ogg_vorbis->tag(), p_demux, p_demux_meta, p_meta ); + ReadMetaFromXiph( ogg_vorbis->tag(), p_demux_meta, p_meta ); } -#ifdef TAGLIB_WITH_ASF - else if( RIFF::File* riff = dynamic_cast(f.file()) ) +#ifdef TAGLIB_HAVE_AIFF_WAV_H + else if( dynamic_cast(f.file()) ) { if( RIFF::AIFF::File* riff_aiff = dynamic_cast(f.file()) ) - ReadMetaFromId3v2( riff_aiff->tag(), p_demux, p_demux_meta, p_meta ); + ReadMetaFromId3v2( riff_aiff->tag(), p_demux_meta, p_meta ); else if( RIFF::WAV::File* riff_wav = dynamic_cast(f.file()) ) - ReadMetaFromId3v2( riff_wav->tag(), p_demux, p_demux_meta, p_meta ); + ReadMetaFromId3v2( riff_wav->tag(), p_demux_meta, p_meta ); } #endif else if( TrueAudio::File* trueaudio = dynamic_cast(f.file()) ) { if( trueaudio->ID3v2Tag() ) - ReadMetaFromId3v2( trueaudio->ID3v2Tag(), p_demux, p_demux_meta, p_meta ); + ReadMetaFromId3v2( trueaudio->ID3v2Tag(), p_demux_meta, p_meta ); } else if( WavPack::File* wavpack = dynamic_cast(f.file()) ) { if( wavpack->APETag() ) - ReadMetaFromAPE( wavpack->APETag(), p_demux, p_demux_meta, p_meta ); + ReadMetaFromAPE( wavpack->APETag(), p_demux_meta, p_meta ); } return VLC_SUCCESS; } - /** - * Write meta informations to APE tags + * Write meta information to APE tags * @param tag: the APE tag * @param p_item: the input item */ @@ -502,7 +648,6 @@ static void WriteMetaToAPE( APE::Tag* tag, input_item_t* p_item ) } - /** * Write meta information to id3v2 tags * @param tag: the id3v2 tag @@ -533,9 +678,8 @@ static void WriteMetaToId3v2( ID3v2::Tag* tag, input_item_t* p_item ) } - /** - * Write the meta informations to XiphComments + * Write the meta information to XiphComments * @param tag: the Xiph Comment * @param p_input: the input item */ @@ -558,7 +702,6 @@ static void WriteMetaToXiph( Ogg::XiphComment* tag, input_item_t* p_item ) } - /** * Set the tags to the file using TagLib * @param p_this: the demux object @@ -567,6 +710,7 @@ static void WriteMetaToXiph( Ogg::XiphComment* tag, input_item_t* p_item ) static int WriteMeta( vlc_object_t *p_this ) { + vlc_mutex_locker locker (&taglib_lock); meta_export_t *p_export = (meta_export_t *)p_this; input_item_t *p_item = p_export->p_item; FileRef f; @@ -578,17 +722,13 @@ static int WriteMeta( vlc_object_t *p_this ) } #if defined(WIN32) || defined (UNDER_CE) - wchar_t wpath[MAX_PATH + 1]; - if( !MultiByteToWideChar( CP_UTF8, 0, p_export->psz_file, -1, wpath, MAX_PATH) ) + wchar_t *wpath = ToWide( p_export->psz_file ); + if( wpath == NULL ) return VLC_EGENERIC; - wpath[MAX_PATH] = L'\0'; f = FileRef( wpath ); + free( wpath ); #else - const char* local_name = ToLocale( p_export->psz_file ); - if( !local_name ) - return VLC_EGENERIC; - f = FileRef( local_name ); - LocaleFree( local_name ); + f = FileRef( p_export->psz_file ); #endif if( f.isNull() || !f.tag() || f.file()->readOnly() ) @@ -624,15 +764,23 @@ static int WriteMeta( vlc_object_t *p_this ) #undef SET psz_meta = input_item_GetDate( p_item ); - if( psz_meta ) p_tag->setYear( atoi( psz_meta ) ); + if( !EMPTY_STR(psz_meta) ) p_tag->setYear( atoi( psz_meta ) ); free( psz_meta ); psz_meta = input_item_GetTrackNum( p_item ); - if( psz_meta ) p_tag->setTrack( atoi( psz_meta ) ); + if( !EMPTY_STR(psz_meta) ) p_tag->setTrack( atoi( psz_meta ) ); free( psz_meta ); // Try now to write special tags +#ifdef TAGLIB_HAVE_APEFILE_H + if( APE::File* ape = dynamic_cast(f.file()) ) + { + if( ape->APETag() ) + WriteMetaToAPE( ape->APETag(), p_item ); + } + else +#endif if( FLAC::File* flac = dynamic_cast(f.file()) ) { if( flac->ID3v2Tag() ) @@ -652,7 +800,7 @@ static int WriteMeta( vlc_object_t *p_this ) else if( mpeg->APETag() ) WriteMetaToAPE( mpeg->APETag(), p_item ); } - else if( Ogg::File* ogg = dynamic_cast(f.file()) ) + else if( dynamic_cast(f.file()) ) { if( Ogg::FLAC::File* ogg_flac = dynamic_cast(f.file())) WriteMetaToXiph( ogg_flac->tag(), p_item ); @@ -661,8 +809,8 @@ static int WriteMeta( vlc_object_t *p_this ) else if( Ogg::Vorbis::File* ogg_vorbis = dynamic_cast(f.file()) ) WriteMetaToXiph( ogg_vorbis->tag(), p_item ); } -#ifdef TAGLIB_WITH_ASF - else if( RIFF::File* riff = dynamic_cast(f.file()) ) +#ifdef TAGLIB_HAVE_AIFF_WAV_H + else if( dynamic_cast(f.file()) ) { if( RIFF::AIFF::File* riff_aiff = dynamic_cast(f.file()) ) WriteMetaToId3v2( riff_aiff->tag(), p_item );