Changeset a2d07c0596ca2994e8c463833516faab371d921e

Show
Ignore:
Timestamp:
24/09/06 17:09:25 (2 years ago)
Author:
Clément Stenac <zorglub@videolan.org>
git-committer:
Clément Stenac <zorglub@videolan.org> 1159110565 +0000
git-parent:

[b59b5633c5d4fce70a9dddfb3e3230b0eaa64f73]

git-author:
Clément Stenac <zorglub@videolan.org> 1159110565 +0000
Message:

Read album, also detect images in FLAC

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/meta_engine/taglib.cpp

    rb59b563 ra2d07c0  
    2929#include <id3v2tag.h> 
    3030#include <mpegfile.h> 
     31#include <flacfile.h> 
    3132 
    3233static int  ReadMeta ( vlc_object_t * ); 
     
    3738vlc_module_end(); 
    3839 
    39 bool checkID3Image( const TagLib::ID3v2::Tag *tag ) 
     40static bool checkID3Image( const TagLib::ID3v2::Tag *tag ) 
    4041{ 
    4142    TagLib::ID3v2::FrameList l = tag->frameListMap()[ "APIC" ]; 
     
    4344} 
    4445 
     46/* Try detecting embedded art */ 
     47static void DetectImage( TagLib::FileRef f, vlc_meta_t *p_meta ) 
     48{ 
     49    if( TagLib::MPEG::File *mpeg = 
     50               dynamic_cast<TagLib::MPEG::File *>(f.file() ) ) 
     51    { 
     52        if( mpeg->ID3v2Tag() && checkID3Image( mpeg->ID3v2Tag() ) ) 
     53            vlc_meta_SetArtURL( p_meta, "APIC" ); 
     54    } 
     55    else if( TagLib::FLAC::File *flac = 
     56             dynamic_cast<TagLib::FLAC::File *>(f.file() ) ) 
     57    { 
     58        if( flac->ID3v2Tag() && checkID3Image( flac->ID3v2Tag() ) ) 
     59            vlc_meta_SetArtURL( p_meta, "APIC" ); 
     60    } 
     61#if 0 
     62/* This needs special additions to taglib */ 
     63 * else if( TagLib::MP4::File *mp4 = 
     64               dynamic_cast<TagLib::MP4::File *>( f.file() ) ) 
     65    { 
     66        TagLib::MP4::Tag *mp4tag = 
     67                dynamic_cast<TagLib::MP4::Tag *>( mp4->tag() ); 
     68        if( mp4tag && mp4tag->cover().size() ) 
     69            vlc_meta_SetArtURL( p_meta, "MP4C" ); 
     70    } 
     71#endif 
     72} 
    4573 
    4674static int ReadMeta( vlc_object_t *p_this ) 
     
    5886            vlc_meta_t *p_meta = (vlc_meta_t *)(p_demux->p_private ); 
    5987 
    60             vlc_meta_SetTitle( p_meta, tag->title().toCString( true ) ); 
    61             vlc_meta_SetArtist( p_meta, tag->artist().toCString( true ) ); 
     88#define SET( foo, bar ) vlc_meta_Set##foo( p_meta, tag->bar ().toCString(true)) 
     89            SET( Title, title ); 
     90            SET( Artist, artist ); 
     91            SET( Album, album ); 
     92//            SET( Comment, comment ); 
     93            SET( Genre, genre ); 
     94//            SET( Year, year ); Gra, this is an int, need to convert 
     95//            SET( Tracknum , track ); Same 
     96#undef SET 
     97            DetectImage( f, p_meta ); 
    6298 
    63             if( TagLib::MPEG::File *mpeg = 
    64                            dynamic_cast<TagLib::MPEG::File *>(f.file() ) ) 
    65             { 
    66                 if( mpeg->ID3v2Tag() && checkID3Image( mpeg->ID3v2Tag() ) ) 
    67                 { 
    68                     fprintf( stderr, "%s has APIC\n", p_meta->psz_title ); 
    69                     vlc_meta_SetArtURL( p_meta, "APIC" ); /// Means that the interface will use us to actually fetch it 
    70                 } 
    71             } 
    7299            return VLC_SUCCESS; 
    73100        }