예제 #1
0
/*
** Extracts cover art embedded in ASF/WMA files.
**
*/
bool QCoverArt::ExtractASF(TagLib::ASF::File* file)
{
    const TagLib::ASF::AttributeListMap& attrListMap = file->tag()->attributeListMap();
    if (attrListMap.contains("WM/Picture"))
    {
        const TagLib::ASF::AttributeList& attrList = attrListMap["WM/Picture"];

        if (!attrList.isEmpty())
        {
            // Let's grab the first cover. TODO: Check/loop for correct type
            TagLib::ASF::Picture wmpic = attrList[0].toPicture();
            if (wmpic.isValid())
            {
                img.loadFromData((const unsigned char*)wmpic.picture().data(), (int)wmpic.picture().size());

                return true;
            }
        }
    }

    return false;
}
예제 #2
0
/*
** Extracts cover art embedded in ASF/WMA files.
**
*/
bool CCover::ExtractASF(TagLib::ASF::File* file, const std::wstring& target)
{
	const TagLib::ASF::AttributeListMap& attrListMap = file->tag()->attributeListMap();
	if (attrListMap.contains("WM/Picture"))
	{
		const TagLib::ASF::AttributeList& attrList = attrListMap["WM/Picture"];

		if (!attrList.isEmpty())
		{
			// Let's grab the first cover. TODO: Check/loop for correct type
			TagLib::ASF::Picture wmpic = attrList[0].toPicture();
			if (wmpic.isValid())
			{
				return WriteCover(wmpic.picture(), target);
			}
		}
	}

	return false;
}