1 /*****************************************************************************
2 * taglib.cpp: Taglib tag parser/writer
3 *****************************************************************************
4 * Copyright (C) 2003-2011 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@videolan.org>
8 * Rafaël Carré <funman@videolanorg>
9 * Rémi Duraffort <ivoire@videolan.org>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24 *****************************************************************************/
30 #include <vlc_common.h>
31 #include <vlc_plugin.h>
32 #include <vlc_demux.h> /* demux_meta_t */
33 #include <vlc_strings.h> /* vlc_b64_decode_binary */
34 #include <vlc_input.h> /* for attachment_new */
37 # include <vlc_charset.h>
46 #define VERSION_INT(a, b, c) ((a)<<16 | (b)<<8 | (c))
47 #define TAGLIB_VERSION VERSION_INT(TAGLIB_MAJOR_VERSION, \
48 TAGLIB_MINOR_VERSION, \
53 #include <tbytevector.h>
55 #if TAGLIB_VERSION >= VERSION_INT(1,7,0)
56 # define TAGLIB_HAVE_APEFILE_H
58 # ifdef TAGLIB_WITH_ASF // ASF pictures comes with v1.7.0
59 # define TAGLIB_HAVE_ASFPICTURE_H
69 #include <oggflacfile.h>
70 #include "../demux/vorbis.h"
72 #if TAGLIB_VERSION >= VERSION_INT(1,6,0)
73 # define TAGLIB_HAVE_AIFF_WAV_H
74 # include <aifffile.h>
77 # include <id3v2tag.h>
80 #if TAGLIB_VERSION >= VERSION_INT(1,6,1) && defined(TAGLIB_WITH_MP4)
81 # define TAGLIB_HAVE_MP4COVERTART_H
85 #include <speexfile.h>
86 #include <trueaudiofile.h>
87 #include <vorbisfile.h>
88 #include <wavpackfile.h>
90 #include <attachedpictureframe.h>
91 #include <textidentificationframe.h>
92 #include <uniquefileidentifierframe.h>
94 // taglib is not thread safe
95 static vlc_mutex_t taglib_lock = VLC_STATIC_MUTEX;
98 static int ReadMeta ( vlc_object_t * );
99 static int WriteMeta ( vlc_object_t * );
102 set_capability( "meta reader", 1000 )
103 set_callbacks( ReadMeta, NULL )
105 set_capability( "meta writer", 50 )
106 set_callbacks( WriteMeta, NULL )
109 using namespace TagLib;
113 * Read meta information from APE tags
114 * @param tag: the APE tag
115 * @param p_demux_meta: the demuxer meta
116 * @param p_meta: the meta
118 static void ReadMetaFromAPE( APE::Tag* tag, demux_meta_t*, vlc_meta_t* p_meta )
121 #define SET( keyName, metaName ) \
122 item = tag->itemListMap()[keyName]; \
123 if( !item.isEmpty() ) vlc_meta_Set##metaName( p_meta, item.toString().toCString( true ) ); \
125 SET( "COPYRIGHT", Copyright );
126 SET( "LANGUAGE", Language );
127 SET( "PUBLISHER", Publisher );
133 #ifdef TAGLIB_HAVE_ASFPICTURE_H
135 * Read meta information from APE tags
136 * @param tag: the APE tag
137 * @param p_demux_meta: the demuxer meta
138 * @param p_meta: the meta
140 static void ReadMetaFromASF( ASF::Tag* tag, demux_meta_t* p_demux_meta, vlc_meta_t* p_meta )
143 ASF::AttributeList list = tag->attributeListMap()["WM/Picture"];
144 ASF::AttributeList::Iterator iter;
145 for( iter = list.begin(); iter != list.end(); iter++ )
147 const ASF::Picture asfPicture = (*iter).toPicture();
148 const ByteVector picture = asfPicture.picture();
149 const char *psz_mime = asfPicture.mimeType().toCString();
150 const char *p_data = picture.data();
151 const unsigned i_data = picture.size();
153 input_attachment_t *p_attachment;
155 if( asfPicture.description().size() > 0 )
156 psz_name = strdup( asfPicture.description().toCString( true ) );
159 if( asprintf( &psz_name, "%i", asfPicture.type() ) == -1 )
163 msg_Dbg( p_demux_meta, "Found embedded art: %s (%s) is %u bytes",
164 psz_name, psz_mime, i_data );
166 p_attachment = vlc_input_attachment_New( psz_name, psz_mime,
167 psz_name, p_data, i_data );
169 TAB_APPEND_CAST( (input_attachment_t**),
170 p_demux_meta->i_attachments, p_demux_meta->attachments,
175 if( asprintf( &psz_url, "attachment://%s",
176 p_attachment->psz_name ) == -1 )
178 vlc_meta_SetArtURL( p_meta, psz_url );
186 * Read meta information from id3v2 tags
187 * @param tag: the id3v2 tag
188 * @param p_demux_meta: the demuxer meta
189 * @param p_meta: the meta
191 static void ReadMetaFromId3v2( ID3v2::Tag* tag, demux_meta_t* p_demux_meta, vlc_meta_t* p_meta )
193 // Get the unique file identifier
194 ID3v2::FrameList list = tag->frameListMap()["UFID"];
195 ID3v2::FrameList::Iterator iter;
196 for( iter = list.begin(); iter != list.end(); iter++ )
198 ID3v2::UniqueFileIdentifierFrame* p_ufid =
199 dynamic_cast<ID3v2::UniqueFileIdentifierFrame*>(*iter);
202 const char *owner = p_ufid->owner().toCString();
203 if (!strcmp( owner, "http://musicbrainz.org" ))
205 /* ID3v2 UFID contains up to 64 bytes binary data
206 * but in our case it will be a '\0'
207 * terminated string */
209 int max_size = __MIN( p_ufid->identifier().size(), 63);
210 strncpy( psz_ufid, p_ufid->identifier().data(), max_size );
211 psz_ufid[max_size] = '\0';
212 vlc_meta_SetTrackID( p_meta, psz_ufid );
217 list = tag->frameListMap()["TXXX"];
218 for( iter = list.begin(); iter != list.end(); iter++ )
220 ID3v2::UserTextIdentificationFrame* p_txxx =
221 dynamic_cast<ID3v2::UserTextIdentificationFrame*>(*iter);
224 vlc_meta_AddExtra( p_meta, p_txxx->description().toCString( true ),
225 p_txxx->fieldList().back().toCString( true ) );
228 // Get some more information
229 #define SET( tagName, metaName ) \
230 list = tag->frameListMap()[tagName]; \
231 if( !list.isEmpty() ) \
232 vlc_meta_Set##metaName( p_meta, \
233 (*list.begin())->toString().toCString( true ) );
235 SET( "TCOP", Copyright );
236 SET( "TENC", EncodedBy );
237 SET( "TLAN", Language );
238 SET( "TPUB", Publisher );
242 /* Preferred type of image
243 * The 21 types are defined in id3v2 standard:
244 * http://www.id3.org/id3v2.4.0-frames */
245 static const int pi_cover_score[] = {
247 5, /* 32x32 PNG image that should be used as the file icon */
248 4, /* File icon of a different size or format. */
249 20, /* Front cover image of the album. */
250 19, /* Back cover image of the album. */
251 13, /* Inside leaflet page of the album. */
252 18, /* Image from the album itself. */
253 17, /* Picture of the lead artist or soloist. */
254 16, /* Picture of the artist or performer. */
255 14, /* Picture of the conductor. */
256 15, /* Picture of the band or orchestra. */
257 9, /* Picture of the composer. */
258 8, /* Picture of the lyricist or text writer. */
259 7, /* Picture of the recording location or studio. */
260 10, /* Picture of the artists during recording. */
261 11, /* Picture of the artists during performance. */
262 6, /* Picture from a movie or video related to the track. */
263 1, /* Picture of a large, coloured fish. */
264 12, /* Illustration related to the track. */
265 3, /* Logo of the band or performer. */
266 2 /* Logo of the publisher (record company). */
268 #define PI_COVER_SCORE_SIZE (sizeof (pi_cover_score) / sizeof (pi_cover_score[0]))
271 // Try now to get embedded art
272 list = tag->frameListMap()[ "APIC" ];
276 TAB_INIT( p_demux_meta->i_attachments, p_demux_meta->attachments );
277 for( iter = list.begin(); iter != list.end(); iter++ )
279 ID3v2::AttachedPictureFrame* p_apic =
280 dynamic_cast<ID3v2::AttachedPictureFrame*>(*iter);
283 input_attachment_t *p_attachment;
285 const char *psz_mime;
286 char *psz_name, *psz_description;
288 // Get the mime and description of the image.
289 // If the description is empty, take the type as a description
290 psz_mime = p_apic->mimeType().toCString( true );
291 if( p_apic->description().size() > 0 )
292 psz_description = strdup( p_apic->description().toCString( true ) );
295 if( asprintf( &psz_description, "%i", p_apic->type() ) == -1 )
296 psz_description = NULL;
299 if( !psz_description )
301 psz_name = psz_description;
303 /* some old iTunes version not only sets incorrectly the mime type
304 * or the description of the image,
305 * but also embeds incorrectly the image.
306 * Recent versions seem to behave correctly */
307 if( !strncmp( psz_mime, "PNG", 3 ) ||
308 !strncmp( psz_name, "\xC2\x89PNG", 5 ) )
310 msg_Warn( p_demux_meta, "Invalid picture embedded by broken iTunes version" );
311 free( psz_description );
315 const ByteVector picture = p_apic->picture();
316 const char *p_data = picture.data();
317 const unsigned i_data = picture.size();
319 msg_Dbg( p_demux_meta, "Found embedded art: %s (%s) is %u bytes",
320 psz_name, psz_mime, i_data );
322 p_attachment = vlc_input_attachment_New( psz_name, psz_mime,
323 psz_description, p_data, i_data );
325 TAB_APPEND_CAST( (input_attachment_t**),
326 p_demux_meta->i_attachments, p_demux_meta->attachments,
328 free( psz_description );
330 unsigned i_pic_type = p_apic->type();
331 if( i_pic_type >= PI_COVER_SCORE_SIZE )
332 i_pic_type = 0; // Defaults to "Other"
334 if( pi_cover_score[i_pic_type] > i_score )
336 i_score = pi_cover_score[i_pic_type];
338 if( asprintf( &psz_url, "attachment://%s",
339 p_attachment->psz_name ) == -1 )
341 vlc_meta_SetArtURL( p_meta, psz_url );
349 * Read the meta information from XiphComments
350 * @param tag: the Xiph Comment
351 * @param p_demux_meta: the demuxer meta
352 * @param p_meta: the meta
354 static void ReadMetaFromXiph( Ogg::XiphComment* tag, demux_meta_t* p_demux_meta, vlc_meta_t* p_meta )
357 #define SET( keyName, metaName ) \
358 list = tag->fieldListMap()[keyName]; \
359 if( !list.isEmpty() ) \
360 vlc_meta_Set##metaName( p_meta, (*list.begin()).toCString( true ) );
362 SET( "COPYRIGHT", Copyright );
365 // Try now to get embedded art
366 StringList mime_list = tag->fieldListMap()[ "COVERARTMIME" ];
367 StringList art_list = tag->fieldListMap()[ "COVERART" ];
369 input_attachment_t *p_attachment;
371 if( mime_list.size() != 0 && art_list.size() != 0 )
373 // We get only the first covert art
374 if( mime_list.size() > 1 || art_list.size() > 1 )
375 msg_Warn( p_demux_meta, "Found %i embedded arts, so using only the first one",
378 const char* psz_name = "cover";
379 const char* psz_mime = mime_list[0].toCString(true);
380 const char* psz_description = "cover";
383 int i_data = vlc_b64_decode_binary( &p_data, art_list[0].toCString(true) );
385 msg_Dbg( p_demux_meta, "Found embedded art: %s (%s) is %i bytes",
386 psz_name, psz_mime, i_data );
388 p_attachment = vlc_input_attachment_New( psz_name, psz_mime,
389 psz_description, p_data, i_data );
394 art_list = tag->fieldListMap()[ "METADATA_BLOCK_PICTURE" ];
395 if( art_list.size() == 0 )
400 int i_data = vlc_b64_decode_binary( &p_data, art_list[0].toCString(true) );
401 p_attachment = ParseFlacPicture( p_data, i_data, 0, &type );
404 TAB_INIT( p_demux_meta->i_attachments, p_demux_meta->attachments );
405 TAB_APPEND_CAST( (input_attachment_t**),
406 p_demux_meta->i_attachments, p_demux_meta->attachments,
410 if( asprintf( &psz_url, "attachment://%s", p_attachment->psz_name ) != -1 ) {
411 vlc_meta_SetArtURL( p_meta, psz_url );
417 #ifdef TAGLIB_HAVE_MP4COVERTART_H
419 * Read the meta information from mp4 specific tags
420 * @param tag: the mp4 tag
421 * @param p_demux_meta: the demuxer meta
422 * @param p_meta: the meta
424 static void ReadMetaFromMP4( MP4::Tag* tag, demux_meta_t *p_demux_meta, vlc_meta_t* p_meta )
426 if( tag->itemListMap().contains("covr") )
428 MP4::CoverArtList list = tag->itemListMap()["covr"].toCoverArtList();
429 const char *psz_format = list[0].format() == MP4::CoverArt::PNG ? "image/png" : "image/jpeg";
431 msg_Dbg( p_demux_meta, "Found embedded art (%s) is %i bytes",
432 psz_format, list[0].data().size() );
434 TAB_INIT( p_demux_meta->i_attachments, p_demux_meta->attachments );
435 input_attachment_t *p_attachment =
436 vlc_input_attachment_New( "cover", psz_format, "cover",
437 list[0].data().data(), list[0].data().size() );
438 TAB_APPEND_CAST( (input_attachment_t**),
439 p_demux_meta->i_attachments, p_demux_meta->attachments,
441 vlc_meta_SetArtURL( p_meta, "attachment://cover" );
448 * Get the tags from the file using TagLib
449 * @param p_this: the demux object
450 * @return VLC_SUCCESS if the operation success
452 static int ReadMeta( vlc_object_t* p_this)
454 vlc_mutex_locker locker (&taglib_lock);
455 demux_meta_t* p_demux_meta = (demux_meta_t *)p_this;
456 demux_t* p_demux = p_demux_meta->p_demux;
460 p_demux_meta->p_meta = NULL;
461 if( strcmp( p_demux->psz_access, "file" ) )
464 char *psz_path = strdup( p_demux->psz_file );
468 #if defined(WIN32) || defined (UNDER_CE)
469 wchar_t *wpath = ToWide( psz_path );
475 f = FileRef( wpath );
478 f = FileRef( psz_path );
484 if( !f.tag() || f.tag()->isEmpty() )
487 p_demux_meta->p_meta = p_meta = vlc_meta_New();
492 // Read the tags from the file
493 Tag* p_tag = f.tag();
495 #define SET( tag, meta ) \
496 if( !p_tag->tag().isNull() && !p_tag->tag().isEmpty() ) \
497 vlc_meta_Set##meta( p_meta, p_tag->tag().toCString(true) )
498 #define SETINT( tag, meta ) \
502 snprintf( psz_tmp, 10, "%d", p_tag->tag() ); \
503 vlc_meta_Set##meta( p_meta, psz_tmp ); \
507 SET( artist, Artist );
509 SET( comment, Description );
511 SETINT( year, Date );
512 SETINT( track, TrackNum );
518 // Try now to read special tags
519 #ifdef TAGLIB_HAVE_APEFILE_H
520 if( APE::File* ape = dynamic_cast<APE::File*>(f.file()) )
523 ReadMetaFromAPE( ape->APETag(), p_demux_meta, p_meta );
527 #ifdef TAGLIB_HAVE_ASFPICTURE_H
528 if( ASF::File* asf = dynamic_cast<ASF::File*>(f.file()) )
531 ReadMetaFromASF( asf->tag(), p_demux_meta, p_meta );
535 if( FLAC::File* flac = dynamic_cast<FLAC::File*>(f.file()) )
537 if( flac->ID3v2Tag() )
538 ReadMetaFromId3v2( flac->ID3v2Tag(), p_demux_meta, p_meta );
539 else if( flac->xiphComment() )
540 ReadMetaFromXiph( flac->xiphComment(), p_demux_meta, p_meta );
542 #ifdef TAGLIB_HAVE_MP4COVERTART_H
543 else if( MP4::File *mp4 = dynamic_cast<MP4::File*>(f.file()) )
546 ReadMetaFromMP4( mp4->tag(), p_demux_meta, p_meta );
549 else if( MPC::File* mpc = dynamic_cast<MPC::File*>(f.file()) )
552 ReadMetaFromAPE( mpc->APETag(), p_demux_meta, p_meta );
554 else if( MPEG::File* mpeg = dynamic_cast<MPEG::File*>(f.file()) )
556 if( mpeg->ID3v2Tag() )
557 ReadMetaFromId3v2( mpeg->ID3v2Tag(), p_demux_meta, p_meta );
558 else if( mpeg->APETag() )
559 ReadMetaFromAPE( mpeg->APETag(), p_demux_meta, p_meta );
561 else if( dynamic_cast<Ogg::File*>(f.file()) )
563 if( Ogg::FLAC::File* ogg_flac = dynamic_cast<Ogg::FLAC::File*>(f.file()))
564 ReadMetaFromXiph( ogg_flac->tag(), p_demux_meta, p_meta );
565 else if( Ogg::Speex::File* ogg_speex = dynamic_cast<Ogg::Speex::File*>(f.file()) )
566 ReadMetaFromXiph( ogg_speex->tag(), p_demux_meta, p_meta );
567 else if( Ogg::Vorbis::File* ogg_vorbis = dynamic_cast<Ogg::Vorbis::File*>(f.file()) )
568 ReadMetaFromXiph( ogg_vorbis->tag(), p_demux_meta, p_meta );
570 #ifdef TAGLIB_HAVE_AIFF_WAV_H
571 else if( dynamic_cast<RIFF::File*>(f.file()) )
573 if( RIFF::AIFF::File* riff_aiff = dynamic_cast<RIFF::AIFF::File*>(f.file()) )
574 ReadMetaFromId3v2( riff_aiff->tag(), p_demux_meta, p_meta );
575 else if( RIFF::WAV::File* riff_wav = dynamic_cast<RIFF::WAV::File*>(f.file()) )
576 ReadMetaFromId3v2( riff_wav->tag(), p_demux_meta, p_meta );
579 else if( TrueAudio::File* trueaudio = dynamic_cast<TrueAudio::File*>(f.file()) )
581 if( trueaudio->ID3v2Tag() )
582 ReadMetaFromId3v2( trueaudio->ID3v2Tag(), p_demux_meta, p_meta );
584 else if( WavPack::File* wavpack = dynamic_cast<WavPack::File*>(f.file()) )
586 if( wavpack->APETag() )
587 ReadMetaFromAPE( wavpack->APETag(), p_demux_meta, p_meta );
595 * Write meta information to APE tags
596 * @param tag: the APE tag
597 * @param p_item: the input item
599 static void WriteMetaToAPE( APE::Tag* tag, input_item_t* p_item )
602 #define WRITE( metaName, keyName ) \
603 psz_meta = input_item_Get##metaName( p_item ); \
606 String key( keyName, String::UTF8 ); \
607 String value( psz_meta, String::UTF8 ); \
608 tag->addValue( key, value, true ); \
612 WRITE( Copyright, "COPYRIGHT" );
613 WRITE( Language, "LANGUAGE" );
614 WRITE( Publisher, "PUBLISHER" );
621 * Write meta information to id3v2 tags
622 * @param tag: the id3v2 tag
623 * @param p_input: the input item
625 static void WriteMetaToId3v2( ID3v2::Tag* tag, input_item_t* p_item )
628 #define WRITE( metaName, tagName ) \
629 psz_meta = input_item_Get##metaName( p_item ); \
632 ByteVector p_byte( tagName, 4 ); \
633 tag->removeFrames( p_byte ); \
634 ID3v2::TextIdentificationFrame* p_frame = \
635 new ID3v2::TextIdentificationFrame( p_byte, String::UTF8 ); \
636 p_frame->setText( psz_meta ); \
637 tag->addFrame( p_frame ); \
641 WRITE( Copyright, "TCOP" );
642 WRITE( EncodedBy, "TENC" );
643 WRITE( Language, "TLAN" );
644 WRITE( Publisher, "TPUB" );
651 * Write the meta information to XiphComments
652 * @param tag: the Xiph Comment
653 * @param p_input: the input item
655 static void WriteMetaToXiph( Ogg::XiphComment* tag, input_item_t* p_item )
658 #define WRITE( metaName, keyName ) \
659 psz_meta = input_item_Get##metaName( p_item ); \
662 String key( keyName, String::UTF8 ); \
663 String value( psz_meta, String::UTF8 ); \
664 tag->addField( key, value, true ); \
668 WRITE( Copyright, "COPYRIGHT" );
675 * Set the tags to the file using TagLib
676 * @param p_this: the demux object
677 * @return VLC_SUCCESS if the operation success
680 static int WriteMeta( vlc_object_t *p_this )
682 vlc_mutex_locker locker (&taglib_lock);
683 meta_export_t *p_export = (meta_export_t *)p_this;
684 input_item_t *p_item = p_export->p_item;
689 msg_Err( p_this, "Can't save meta data of an empty input" );
693 #if defined(WIN32) || defined (UNDER_CE)
694 wchar_t *wpath = ToWide( p_export->psz_file );
697 f = FileRef( wpath );
700 f = FileRef( p_export->psz_file );
703 if( f.isNull() || !f.tag() || f.file()->readOnly() )
705 msg_Err( p_this, "File %s can't be opened for tag writing",
706 p_export->psz_file );
710 msg_Dbg( p_this, "Writing metadata for %s", p_export->psz_file );
712 Tag *p_tag = f.tag();
716 #define SET( a, b ) \
717 psz_meta = input_item_Get ## a( p_item ); \
720 String tmp( psz_meta, String::UTF8 ); \
721 p_tag->set##b( tmp ); \
725 // Saving all common fields
726 // If the title is empty, use the name
727 SET( TitleFbName, Title );
728 SET( Artist, Artist );
730 SET( Description, Comment );
735 psz_meta = input_item_GetDate( p_item );
736 if( !EMPTY_STR(psz_meta) ) p_tag->setYear( atoi( psz_meta ) );
739 psz_meta = input_item_GetTrackNum( p_item );
740 if( !EMPTY_STR(psz_meta) ) p_tag->setTrack( atoi( psz_meta ) );
744 // Try now to write special tags
745 #ifdef TAGLIB_HAVE_APEFILE_H
746 if( APE::File* ape = dynamic_cast<APE::File*>(f.file()) )
749 WriteMetaToAPE( ape->APETag(), p_item );
753 if( FLAC::File* flac = dynamic_cast<FLAC::File*>(f.file()) )
755 if( flac->ID3v2Tag() )
756 WriteMetaToId3v2( flac->ID3v2Tag(), p_item );
757 else if( flac->xiphComment() )
758 WriteMetaToXiph( flac->xiphComment(), p_item );
760 else if( MPC::File* mpc = dynamic_cast<MPC::File*>(f.file()) )
763 WriteMetaToAPE( mpc->APETag(), p_item );
765 else if( MPEG::File* mpeg = dynamic_cast<MPEG::File*>(f.file()) )
767 if( mpeg->ID3v2Tag() )
768 WriteMetaToId3v2( mpeg->ID3v2Tag(), p_item );
769 else if( mpeg->APETag() )
770 WriteMetaToAPE( mpeg->APETag(), p_item );
772 else if( dynamic_cast<Ogg::File*>(f.file()) )
774 if( Ogg::FLAC::File* ogg_flac = dynamic_cast<Ogg::FLAC::File*>(f.file()))
775 WriteMetaToXiph( ogg_flac->tag(), p_item );
776 else if( Ogg::Speex::File* ogg_speex = dynamic_cast<Ogg::Speex::File*>(f.file()) )
777 WriteMetaToXiph( ogg_speex->tag(), p_item );
778 else if( Ogg::Vorbis::File* ogg_vorbis = dynamic_cast<Ogg::Vorbis::File*>(f.file()) )
779 WriteMetaToXiph( ogg_vorbis->tag(), p_item );
781 #ifdef TAGLIB_HAVE_AIFF_WAV_H
782 else if( dynamic_cast<RIFF::File*>(f.file()) )
784 if( RIFF::AIFF::File* riff_aiff = dynamic_cast<RIFF::AIFF::File*>(f.file()) )
785 WriteMetaToId3v2( riff_aiff->tag(), p_item );
786 else if( RIFF::WAV::File* riff_wav = dynamic_cast<RIFF::WAV::File*>(f.file()) )
787 WriteMetaToId3v2( riff_wav->tag(), p_item );
790 else if( TrueAudio::File* trueaudio = dynamic_cast<TrueAudio::File*>(f.file()) )
792 if( trueaudio->ID3v2Tag() )
793 WriteMetaToId3v2( trueaudio->ID3v2Tag(), p_item );
795 else if( WavPack::File* wavpack = dynamic_cast<WavPack::File*>(f.file()) )
797 if( wavpack->APETag() )
798 WriteMetaToAPE( wavpack->APETag(), p_item );
801 // Save the meta data