]> git.sesse.net Git - vlc/blob - modules/meta_engine/taglib.cpp
taglib: remove a dummy sub-module (taglib can't act as an "art downloader").
[vlc] / modules / meta_engine / taglib.cpp
1 /*****************************************************************************
2  * taglib.cpp: Taglib tag parser/writer
3  *****************************************************************************
4  * Copyright (C) 2003-2009 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Clément Stenac <zorglub@videolan.org>
8  *          Rafaël Carré <funman@videolanorg>
9  *          Rémi Duraffort <ivoire@videolan.org>
10  *
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.
15  *
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.
20  *
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  *****************************************************************************/
25
26 #ifdef HAVE_CONFIG_H
27 # include "config.h"
28 #endif
29
30 #include <vlc_common.h>
31 #include <vlc_plugin.h>
32 #include <vlc_playlist.h>
33 #include <vlc_meta.h>
34 #include <vlc_demux.h>
35 #include <vlc_strings.h>
36 #include <vlc_charset.h>
37
38 #ifdef WIN32
39 # include <io.h>
40 #else
41 # include <unistd.h>
42 #endif
43
44
45 // Taglib headers
46 #include <fileref.h>
47 #include <tag.h>
48 #include <tbytevector.h>
49
50 #include <apetag.h>
51 #include <id3v2tag.h>
52 #include <xiphcomment.h>
53
54 #include <flacfile.h>
55 #include <mpcfile.h>
56 #include <mpegfile.h>
57 #include <oggfile.h>
58 #include <oggflacfile.h>
59 #include <speexfile.h>
60 #include <trueaudiofile.h>
61 #include <vorbisfile.h>
62 #include <wavpackfile.h>
63
64 #include <attachedpictureframe.h>
65 #include <textidentificationframe.h>
66 #include <uniquefileidentifierframe.h>
67
68
69 // Local functions
70 static int ReadMeta    ( vlc_object_t * );
71 static int WriteMeta   ( vlc_object_t * );
72
73 vlc_module_begin ()
74     set_capability( "meta reader", 1000 )
75     set_callbacks( ReadMeta, NULL )
76     add_submodule ()
77         set_capability( "meta writer", 50 )
78         set_callbacks( WriteMeta, NULL )
79 vlc_module_end ()
80
81 using namespace TagLib;
82
83
84 /**
85  * Read meta informations from APE tags
86  * @param tag: the APE tag
87  * @param p_demux; the demux object
88  * @param p_demux_meta: the demuxer meta
89  * @param p_meta: the meta
90  */
91 static void ReadMetaFromAPE( APE::Tag* tag, demux_t* p_demux, demux_meta_t* p_demux_meta, vlc_meta_t* p_meta )
92 {
93     APE::Item item;
94 #define SET( keyName, metaName ) \
95     item = tag->itemListMap()[keyName]; \
96     vlc_meta_Set##metaName( p_meta, item.toString().toCString( true ) );\
97
98     SET( "COPYRIGHT", Copyright );
99     SET( "LANGUAGE", Language );
100     SET( "PUBLISHER", Publisher );
101
102 #undef SET
103 }
104
105
106
107 /**
108  * Read meta information from id3v2 tags
109  * @param tag: the id3v2 tag
110  * @param p_demux; the demux object
111  * @param p_demux_meta: the demuxer meta
112  * @param p_meta: the meta
113  */
114 static void ReadMetaFromId3v2( ID3v2::Tag* tag, demux_t* p_demux, demux_meta_t* p_demux_meta, vlc_meta_t* p_meta )
115 {
116     // Get the unique file identifier
117     ID3v2::FrameList list = tag->frameListMap()["UFID"];
118     ID3v2::FrameList::Iterator iter;
119     for( iter = list.begin(); iter != list.end(); iter++ )
120     {
121         ID3v2::UniqueFileIdentifierFrame* p_ufid =
122                 dynamic_cast<ID3v2::UniqueFileIdentifierFrame*>(*iter);
123         const char *owner = p_ufid->owner().toCString();
124         if (!strcmp( owner, "http://musicbrainz.org" ))
125         {
126             /* ID3v2 UFID contains up to 64 bytes binary data
127              * but in our case it will be a '\0'
128              * terminated string */
129             char psz_ufid[64];
130             int max_size = __MIN( p_ufid->identifier().size(), 63);
131             strncpy( psz_ufid, p_ufid->identifier().data(), max_size );
132             psz_ufid[max_size] = '\0';
133             vlc_meta_SetTrackID( p_meta, psz_ufid );
134         }
135     }
136
137     // Get the use text
138     list = tag->frameListMap()["TXXX"];
139     for( iter = list.begin(); iter != list.end(); iter++ )
140     {
141         ID3v2::UserTextIdentificationFrame* p_txxx =
142                 dynamic_cast<ID3v2::UserTextIdentificationFrame*>(*iter);
143         vlc_meta_AddExtra( p_meta, p_txxx->description().toCString( true ),
144                            p_txxx->fieldList().toString().toCString( true ) );
145     }
146
147     // Get some more informations
148 #define SET( tagName, metaName )                                               \
149     list = tag->frameListMap()[tagName];                                       \
150     if( !list.isEmpty() )                                                      \
151         vlc_meta_Set##metaName( p_meta,                                        \
152                                 (*list.begin())->toString().toCString( true ) );
153
154     SET( "TCOP", Copyright );
155     SET( "TENC", EncodedBy );
156     SET( "TLAN", Language );
157     SET( "TPUB", Publisher );
158
159 #undef SET
160
161     /* Preferred type of image
162      * The 21 types are defined in id3v2 standard:
163      * http://www.id3.org/id3v2.4.0-frames */
164     static const int pi_cover_score[] = {
165         0,  /* Other */
166         5,  /* 32x32 PNG image that should be used as the file icon */
167         4,  /* File icon of a different size or format. */
168         20, /* Front cover image of the album. */
169         19, /* Back cover image of the album. */
170         13, /* Inside leaflet page of the album. */
171         18, /* Image from the album itself. */
172         17, /* Picture of the lead artist or soloist. */
173         16, /* Picture of the artist or performer. */
174         14, /* Picture of the conductor. */
175         15, /* Picture of the band or orchestra. */
176         9,  /* Picture of the composer. */
177         8,  /* Picture of the lyricist or text writer. */
178         7,  /* Picture of the recording location or studio. */
179         10, /* Picture of the artists during recording. */
180         11, /* Picture of the artists during performance. */
181         6,  /* Picture from a movie or video related to the track. */
182         1,  /* Picture of a large, coloured fish. */
183         12, /* Illustration related to the track. */
184         3,  /* Logo of the band or performer. */
185         2   /* Logo of the publisher (record company). */
186     };
187     int i_score = -1;
188
189     // Try now to get embedded art
190     list = tag->frameListMap()[ "APIC" ];
191     if( list.isEmpty() )
192         return;
193
194     TAB_INIT( p_demux_meta->i_attachments, p_demux_meta->attachments );
195     for( iter = list.begin(); iter != list.end(); iter++ )
196     {
197         ID3v2::AttachedPictureFrame* p_apic =
198             dynamic_cast<ID3v2::AttachedPictureFrame*>(*iter);
199         input_attachment_t *p_attachment;
200
201         const char *psz_mime;
202         char *psz_name, *psz_description;
203
204         // Get the mime and description of the image.
205         // If the description is empty, take the type as a description
206         psz_mime = p_apic->mimeType().toCString( true );
207         if( p_apic->description().size() > 0 )
208             psz_description = strdup( p_apic->description().toCString( true ) );
209         else
210         {
211             if( asprintf( &psz_description, "%i", p_apic->type() ) == -1 )
212                 psz_description = NULL;
213         }
214
215         if( !psz_description )
216             continue;
217         psz_name = psz_description;
218
219         /* some old iTunes version not only sets incorrectly the mime type
220          * or the description of the image,
221          * but also embeds incorrectly the image.
222          * Recent versions seem to behave correctly */
223         if( !strncmp( psz_mime, "PNG", 3 ) ||
224             !strncmp( psz_name, "\xC2\x89PNG", 5 ) )
225         {
226             msg_Warn( p_demux, "Invalid picture embedded by broken iTunes version" );
227             free( psz_description );
228             continue;
229         }
230
231         const ByteVector picture = p_apic->picture();
232         const char *p_data = picture.data();
233         const unsigned i_data = picture.size();
234
235         msg_Dbg( p_demux, "Found embedded art: %s (%s) is %u bytes",
236                  psz_name, psz_mime, i_data );
237
238         p_attachment = vlc_input_attachment_New( psz_name, psz_mime,
239                                 psz_description, p_data, i_data );
240         if( p_attachment )
241             TAB_APPEND_CAST( (input_attachment_t**),
242                              p_demux_meta->i_attachments, p_demux_meta->attachments,
243                              p_attachment );
244         free( psz_description );
245
246         if( pi_cover_score[p_apic->type()] > i_score )
247         {
248             i_score = pi_cover_score[p_apic->type()];
249             char *psz_url;
250             if( asprintf( &psz_url, "attachment://%s",
251                           p_attachment->psz_name ) == -1 )
252                 continue;
253             vlc_meta_SetArtURL( p_meta, psz_url );
254             free( psz_url );
255         }
256     }
257 }
258
259
260
261 /**
262  * Read the meta informations from XiphComments
263  * @param tag: the Xiph Comment
264  * @param p_demux; the demux object
265  * @param p_demux_meta: the demuxer meta
266  * @param p_meta: the meta
267  */
268 static void ReadMetaFromXiph( Ogg::XiphComment* tag, demux_t* p_demux, demux_meta_t* p_demux_meta, vlc_meta_t* p_meta )
269 {
270 #define SET( keyName, metaName )                                               \
271     StringList list = tag->fieldListMap()[keyName];                            \
272     if( !list.isEmpty() )                                                      \
273         vlc_meta_Set##metaName( p_meta, (*list.begin()).toCString( true ) );
274
275     SET( "COPYRIGHT", Copyright );
276 #undef SET
277
278     // Try now to get embedded art
279     StringList mime_list = tag->fieldListMap()[ "COVERARTMIME" ];
280     StringList art_list = tag->fieldListMap()[ "COVERART" ];
281
282     // We get only the first covert art
283     if( mime_list.size() > 1 || art_list.size() > 1 )
284         msg_Warn( p_demux, "Found %i embedded arts, so using only the first one",
285                   art_list.size() );
286     else if( mime_list.size() == 0 || art_list.size() == 0 )
287         return;
288
289     input_attachment_t *p_attachment;
290
291     const char* psz_name = "cover";
292     const char* psz_mime = mime_list[0].toCString(true);
293     const char* psz_description = "cover";
294
295     uint8_t *p_data;
296     int i_data = vlc_b64_decode_binary( &p_data, art_list[0].toCString(true) );
297
298     msg_Dbg( p_demux, "Found embedded art: %s (%s) is %i bytes",
299              psz_name, psz_mime, i_data );
300
301     TAB_INIT( p_demux_meta->i_attachments, p_demux_meta->attachments );
302               p_attachment = vlc_input_attachment_New( psz_name, psz_mime,
303               psz_description, p_data, i_data );
304     free( p_data );
305
306     TAB_APPEND_CAST( (input_attachment_t**),
307                      p_demux_meta->i_attachments, p_demux_meta->attachments,
308                      p_attachment );
309
310     vlc_meta_SetArtURL( p_meta, "attachment://cover" );
311 }
312
313
314
315 /**
316  * Get the tags from the file using TagLib
317  * @param p_this: the demux object
318  * @return VLC_SUCCESS if the operation success
319  */
320 static int ReadMeta( vlc_object_t* p_this)
321 {
322     demux_t*        p_demux = (demux_t*)p_this;
323     demux_meta_t*   p_demux_meta = (demux_meta_t*)p_demux->p_private;
324     vlc_meta_t*     p_meta;
325     FileRef f;
326
327     p_demux_meta->p_meta = NULL;
328
329
330 #if defined(WIN32) || defined (UNDER_CE)
331     if(GetVersion() < 0x80000000)
332     {
333         wchar_t wpath[MAX_PATH + 1];
334         if( !MultiByteToWideChar( CP_UTF8, 0, p_demux->psz_path, -1, wpath, MAX_PATH) )
335             return VLC_EGENERIC;
336         wpath[MAX_PATH] = L'\0';
337         f = FileRef( wpath );
338     }
339     else
340         return VLC_EGENERIC;
341 #else
342     const char* local_name = ToLocale( p_demux->psz_path );
343     if( !local_name )
344         return VLC_EGENERIC;
345     f = FileRef( local_name );
346     LocaleFree( local_name );
347 #endif
348
349     if( f.isNull() )
350         return VLC_EGENERIC;
351     if( !f.tag() || f.tag()->isEmpty() )
352         return VLC_EGENERIC;
353
354     p_demux_meta->p_meta = p_meta = vlc_meta_New();
355     if( !p_meta )
356         return VLC_ENOMEM;
357
358
359     // Read the tags from the file
360     Tag* p_tag = f.tag();
361
362 #define SET( tag, meta )                                                       \
363     if( !p_tag->tag().isNull() && !p_tag->tag().isEmpty() )                    \
364         vlc_meta_Set##meta( p_meta, p_tag->tag().toCString(true) )
365 #define SETINT( tag, meta )                                                    \
366     if( p_tag->tag() )                                                         \
367     {                                                                          \
368         char psz_tmp[10];                                                      \
369         snprintf( psz_tmp, 10, "%d", p_tag->tag() );                           \
370         vlc_meta_Set##meta( p_meta, psz_tmp );                                 \
371     }
372
373     SET( title, Title );
374     SET( artist, Artist );
375     SET( album, Album );
376     SET( comment, Description );
377     SET( genre, Genre );
378     SETINT( year, Date );
379     SETINT( track, TrackNum );
380
381 #undef SETINT
382 #undef SET
383
384
385     // Try now to read special tags
386     if( FLAC::File* flac = dynamic_cast<FLAC::File*>(f.file()) )
387     {
388         if( flac->ID3v2Tag() )
389             ReadMetaFromId3v2( flac->ID3v2Tag(), p_demux, p_demux_meta, p_meta );
390         else if( flac->xiphComment() )
391             ReadMetaFromXiph( flac->xiphComment(), p_demux, p_demux_meta, p_meta );
392     }
393     else if( MPC::File* mpc = dynamic_cast<MPC::File*>(f.file()) )
394     {
395         if( mpc->APETag() )
396             ReadMetaFromAPE( mpc->APETag(), p_demux, p_demux_meta, p_meta );
397     }
398     else if( MPEG::File* mpeg = dynamic_cast<MPEG::File*>(f.file()) )
399     {
400         if( mpeg->ID3v2Tag() )
401             ReadMetaFromId3v2( mpeg->ID3v2Tag(), p_demux, p_demux_meta, p_meta );
402         else if( mpeg->APETag() )
403             ReadMetaFromAPE( mpeg->APETag(), p_demux, p_demux_meta, p_meta );
404     }
405     else if( Ogg::File* ogg = dynamic_cast<Ogg::File*>(f.file()) )
406     {
407         if( Ogg::FLAC::File* ogg_flac = dynamic_cast<Ogg::FLAC::File*>(f.file()))
408             ReadMetaFromXiph( ogg_flac->tag(), p_demux, p_demux_meta, p_meta );
409         else if( Ogg::Speex::File* ogg_speex = dynamic_cast<Ogg::Speex::File*>(f.file()) )
410             ReadMetaFromXiph( ogg_speex->tag(), p_demux, p_demux_meta, p_meta );
411         else if( Ogg::Vorbis::File* ogg_vorbis = dynamic_cast<Ogg::Vorbis::File*>(f.file()) )
412             ReadMetaFromXiph( ogg_vorbis->tag(), p_demux, p_demux_meta, p_meta );
413     }
414     else if( TrueAudio::File* trueaudio = dynamic_cast<TrueAudio::File*>(f.file()) )
415     {
416         if( trueaudio->ID3v2Tag() )
417             ReadMetaFromId3v2( trueaudio->ID3v2Tag(), p_demux, p_demux_meta, p_meta );
418     }
419     else if( WavPack::File* wavpack = dynamic_cast<WavPack::File*>(f.file()) )
420     {
421         if( wavpack->APETag() )
422             ReadMetaFromAPE( wavpack->APETag(), p_demux, p_demux_meta, p_meta );
423     }
424
425     return VLC_SUCCESS;
426 }
427
428
429
430 /**
431  * Write meta informations to APE tags
432  * @param tag: the APE tag
433  * @param p_item: the input item
434  */
435 static void WriteMetaToAPE( APE::Tag* tag, input_item_t* p_item )
436 {
437     char* psz_meta;
438 #define WRITE( metaName, keyName )                      \
439     psz_meta = input_item_Get##metaName( p_item );      \
440     if( psz_meta )                                      \
441     {                                                   \
442         String key( keyName, String::UTF8 );            \
443         String value( psz_meta, String::UTF8 );         \
444         tag->addValue( key, value, true );              \
445     }                                                   \
446     free( psz_meta );
447
448     WRITE( Copyright, "COPYRIGHT" );
449     WRITE( Language, "LANGUAGE" );
450     WRITE( Publisher, "PUBLISHER" );
451
452 #undef WRITE
453 }
454
455
456
457 /**
458  * Write meta information to id3v2 tags
459  * @param tag: the id3v2 tag
460  * @param p_input: the input item
461  */
462 static void WriteMetaToId3v2( ID3v2::Tag* tag, input_item_t* p_item )
463 {
464     char* psz_meta;
465 #define WRITE( metaName, tagName )                                            \
466     psz_meta = input_item_Get##metaName( p_item );                            \
467     if( psz_meta )                                                            \
468     {                                                                         \
469         ByteVector p_byte( tagName, 4 );                                      \
470         tag->removeFrames( p_byte );                                         \
471         ID3v2::TextIdentificationFrame* p_frame =                             \
472             new ID3v2::TextIdentificationFrame( p_byte, String::UTF8 );       \
473         p_frame->setText( psz_meta );                                         \
474         tag->addFrame( p_frame );                                             \
475     }                                                                         \
476     free( psz_meta );
477
478     WRITE( Copyright, "TCOP" );
479     WRITE( EncodedBy, "TENC" );
480     WRITE( Language,  "TLAN" );
481     WRITE( Publisher, "TPUB" );
482
483 #undef WRITE
484 }
485
486
487
488 /**
489  * Write the meta informations to XiphComments
490  * @param tag: the Xiph Comment
491  * @param p_input: the input item
492  */
493 static void WriteMetaToXiph( Ogg::XiphComment* tag, input_item_t* p_item )
494 {
495     char* psz_meta;
496 #define WRITE( metaName, keyName )                      \
497     psz_meta = input_item_Get##metaName( p_item );      \
498     if( psz_meta )                                      \
499     {                                                   \
500         String key( keyName, String::UTF8 );            \
501         String value( psz_meta, String::UTF8 );         \
502         tag->addField( key, value, true );              \
503     }                                                   \
504     free( psz_meta );
505
506     WRITE( Copyright, "COPYRIGHT" );
507
508 #undef WRITE
509 }
510
511
512
513 /**
514  * Set the tags to the file using TagLib
515  * @param p_this: the demux object
516  * @return VLC_SUCCESS if the operation success
517  */
518
519 static int WriteMeta( vlc_object_t *p_this )
520 {
521     playlist_t *p_playlist = (playlist_t *)p_this;
522     meta_export_t *p_export = (meta_export_t *)p_playlist->p_private;
523     input_item_t *p_item = p_export->p_item;
524     FileRef f;
525
526     if( !p_item )
527     {
528         msg_Err( p_this, "Can't save meta data of an empty input" );
529         return VLC_EGENERIC;
530     }
531
532 #if defined(WIN32) || defined (UNDER_CE)
533     if(GetVersion() < 0x80000000)
534     {
535         wchar_t wpath[MAX_PATH + 1];
536         if( !MultiByteToWideChar( CP_UTF8, 0, p_export->psz_file, -1, wpath, MAX_PATH) )
537             return VLC_EGENERIC;
538         wpath[MAX_PATH] = L'\0';
539         f = FileRef( wpath );
540     }
541     else
542         return VLC_EGENERIC;
543 #else
544     const char* local_name = ToLocale( p_export->psz_file );
545     if( !local_name )
546         return VLC_EGENERIC;
547     f = FileRef( local_name );
548     LocaleFree( local_name );
549 #endif
550
551     if( f.isNull() || !f.tag() || f.file()->readOnly() )
552     {
553         msg_Err( p_this, "File %s can't be opened for tag writing\n",
554             p_export->psz_file );
555         return VLC_EGENERIC;
556     }
557
558     msg_Dbg( p_this, "Writing metadata for %s", p_export->psz_file );
559
560     Tag *p_tag = f.tag();
561
562     char *psz_meta;
563
564 #define SET( a, b )                                         \
565     if( b )                                                 \
566     {                                                       \
567         String* psz_tmp = new String( b, String::UTF8 );    \
568         p_tag->set##a( *psz_tmp );                          \
569         delete psz_tmp;                                     \
570     }
571
572     // Saving all common fields
573     // If the title is empty, use the name
574     psz_meta = input_item_GetTitle( p_item );
575     if( !psz_meta ) psz_meta = input_item_GetName( p_item );
576     SET( Title, psz_meta );
577     free( psz_meta );
578
579     psz_meta = input_item_GetArtist( p_item );
580     SET( Artist, psz_meta );
581     free( psz_meta );
582
583     psz_meta = input_item_GetAlbum( p_item );
584     SET( Album, psz_meta );
585     free( psz_meta );
586
587     psz_meta = input_item_GetDescription( p_item );
588     SET( Comment, psz_meta );
589     free( psz_meta );
590
591     psz_meta = input_item_GetGenre( p_item );
592     SET( Genre, psz_meta );
593     free( psz_meta );
594
595 #undef SET
596
597     psz_meta = input_item_GetDate( p_item );
598     if( psz_meta ) p_tag->setYear( atoi( psz_meta ) );
599     free( psz_meta );
600
601     psz_meta = input_item_GetTrackNum( p_item );
602     if( psz_meta ) p_tag->setTrack( atoi( psz_meta ) );
603     free( psz_meta );
604
605
606     // Try now to write special tags
607     if( FLAC::File* flac = dynamic_cast<FLAC::File*>(f.file()) )
608     {
609         if( flac->ID3v2Tag() )
610             WriteMetaToId3v2( flac->ID3v2Tag(), p_item );
611         else if( flac->xiphComment() )
612             WriteMetaToXiph( flac->xiphComment(), p_item );
613     }
614     else if( MPC::File* mpc = dynamic_cast<MPC::File*>(f.file()) )
615     {
616         if( mpc->APETag() )
617             WriteMetaToAPE( mpc->APETag(), p_item );
618     }
619     else if( MPEG::File* mpeg = dynamic_cast<MPEG::File*>(f.file()) )
620     {
621         if( mpeg->ID3v2Tag() )
622             WriteMetaToId3v2( mpeg->ID3v2Tag(), p_item );
623         else if( mpeg->APETag() )
624             WriteMetaToAPE( mpeg->APETag(), p_item );
625     }
626     else if( Ogg::File* ogg = dynamic_cast<Ogg::File*>(f.file()) )
627     {
628         if( Ogg::FLAC::File* ogg_flac = dynamic_cast<Ogg::FLAC::File*>(f.file()))
629             WriteMetaToXiph( ogg_flac->tag(), p_item );
630         else if( Ogg::Speex::File* ogg_speex = dynamic_cast<Ogg::Speex::File*>(f.file()) )
631             WriteMetaToXiph( ogg_speex->tag(), p_item );
632         else if( Ogg::Vorbis::File* ogg_vorbis = dynamic_cast<Ogg::Vorbis::File*>(f.file()) )
633             WriteMetaToXiph( ogg_vorbis->tag(), p_item );
634     }
635     else if( TrueAudio::File* trueaudio = dynamic_cast<TrueAudio::File*>(f.file()) )
636     {
637         if( trueaudio->ID3v2Tag() )
638             WriteMetaToId3v2( trueaudio->ID3v2Tag(), p_item );
639     }
640     else if( WavPack::File* wavpack = dynamic_cast<WavPack::File*>(f.file()) )
641     {
642         if( wavpack->APETag() )
643             WriteMetaToAPE( wavpack->APETag(), p_item );
644     }
645
646     // Save the meta data
647     f.save();
648
649     return VLC_SUCCESS;
650 }
651