Changeset b59b5633c5d4fce70a9dddfb3e3230b0eaa64f73

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

[be82b7aebdc2046d4030bcac847d811d038fed0d]

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

Detect embedded images

Files:

Legend:

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

    r47bfbd7 rb59b563  
    2727#include <fileref.h> 
    2828#include <tag.h> 
     29#include <id3v2tag.h> 
     30#include <mpegfile.h> 
    2931 
    3032static int  ReadMeta ( vlc_object_t * ); 
     
    3436    set_callbacks( ReadMeta, NULL ); 
    3537vlc_module_end(); 
    36   
     38 
     39bool checkID3Image( const TagLib::ID3v2::Tag *tag ) 
     40
     41    TagLib::ID3v2::FrameList l = tag->frameListMap()[ "APIC" ]; 
     42    return !l.isEmpty(); 
     43
     44 
     45 
    3746static int ReadMeta( vlc_object_t *p_this ) 
    3847{ 
     
    5160            vlc_meta_SetTitle( p_meta, tag->title().toCString( true ) ); 
    5261            vlc_meta_SetArtist( p_meta, tag->artist().toCString( true ) ); 
     62 
     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            } 
    5372            return VLC_SUCCESS; 
    5473        }