Esempio n. 1
0
/*
** Attempts to extract cover art from audio files.
**
*/
bool CCover::GetEmbedded(const TagLib::FileRef& fr, const std::string& target)
{
    bool found = false;

    if (TagLib::MPEG::File* file = dynamic_cast<TagLib::MPEG::File*>(fr.file()))
    {
        if (file->ID3v2Tag())
        {
            found = ExtractID3(file->ID3v2Tag(), target);
        }
        if (!found && file->APETag())
        {
            found = ExtractAPE(file->APETag(), target);
        }
    }
    else if (TagLib::MP4::File* file = dynamic_cast<TagLib::MP4::File*>(fr.file()))
    {
        if (file->tag())
        {
            found = ExtractMP4(file, target);
        }
    }
    else if (TagLib::FLAC::File* file = dynamic_cast<TagLib::FLAC::File*>(fr.file()))
    {
        found = ExtractFLAC(file, target);

        if (!found && file->ID3v2Tag())
        {
            found = ExtractID3(file->ID3v2Tag(), target);
        }
    }
    else if (TagLib::ASF::File* file = dynamic_cast<TagLib::ASF::File*>(fr.file()))
    {
        found = ExtractASF(file, target);
    }
    else if (TagLib::APE::File* file = dynamic_cast<TagLib::APE::File*>(fr.file()))
    {
        if (file->APETag())
        {
            found = ExtractAPE(file->APETag(), target);
        }
    }
    else if (TagLib::MPC::File* file = dynamic_cast<TagLib::MPC::File*>(fr.file()))
    {
        if (file->APETag())
        {
            found = ExtractAPE(file->APETag(), target);
        }
    }
    else if (TagLib::WavPack::File* file = dynamic_cast<TagLib::WavPack::File*>(fr.file()))
    {
        if (file->APETag())
        {
            found = ExtractAPE(file->APETag(), target);
        }
    }

    return found;
}
Esempio n. 2
0
/*
** Attempts to extract cover art from audio files.
**
*/
bool QCoverArt::GetCover(const TagLib::FileRef& fr)
{
    bool found = false;

    if (TagLib::MPEG::File* file = dynamic_cast<TagLib::MPEG::File*>(fr.file()))
    {
        if (file->ID3v2Tag())
        {
            found = ExtractID3(file->ID3v2Tag());
        }
        if (!found && file->APETag())
        {
            found = ExtractAPE(file->APETag());
        }
    }
    else if (TagLib::ASF::File* file = dynamic_cast<TagLib::ASF::File*>(fr.file()))
    {
        found = ExtractASF(file);
    }
    else if (TagLib::MP4::File* file = dynamic_cast<TagLib::MP4::File*>(fr.file()))
    {
        if (file->tag())
        {
            found = ExtractMP4(file);
        }
    }
    else if (TagLib::FLAC::File* file = dynamic_cast<TagLib::FLAC::File*>(fr.file()))
    {
        found = ExtractFLAC(file);

        if (!found && file->ID3v2Tag())
        {
            found = ExtractID3(file->ID3v2Tag());
        }
    }
    else if (TagLib::APE::File* file = dynamic_cast<TagLib::APE::File*>(fr.file()))
    {
        if (file->APETag())
        {
            found = ExtractAPE(file->APETag());
        }
    }
    else if (TagLib::MPC::File* file = dynamic_cast<TagLib::MPC::File*>(fr.file()))
    {
        if (file->APETag())
        {
            found = ExtractAPE(file->APETag());
        }
    }
    else if (TagLib::WavPack::File* file = dynamic_cast<TagLib::WavPack::File*>(fr.file()))
    {
        if (file->APETag())
        {
            found = ExtractAPE(file->APETag());
        }
    }

    return found;
}