mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
commit
b7e3ff8cb5
@ -22,7 +22,7 @@
|
||||
* License Version 1.1. You may obtain a copy of the License at *
|
||||
* http://www.mozilla.org/MPL/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include <cstring>
|
||||
#include <tdebug.h>
|
||||
#include <tstring.h>
|
||||
#include <tpicturemap.h>
|
||||
@ -741,7 +741,37 @@ MP4::Tag::track() const
|
||||
PictureMap
|
||||
MP4::Tag::pictures() const
|
||||
{
|
||||
if(!d->items.contains("covr"))
|
||||
return PictureMap();
|
||||
|
||||
CoverArtList list = d->items["covr"].toCoverArtList();
|
||||
if(list.isEmpty())
|
||||
return PictureMap();
|
||||
|
||||
PictureMap map;
|
||||
for(CoverArtList::ConstIterator it = list.begin(); it != list.end(); ++it) {
|
||||
CoverArt art = *it;
|
||||
String mime = "image/";
|
||||
switch(art.format()) {
|
||||
case CoverArt::BMP:
|
||||
mime.append("bmp");
|
||||
break;
|
||||
case CoverArt::JPEG:
|
||||
mime.append("jpeg");
|
||||
break;
|
||||
case CoverArt::GIF:
|
||||
mime.append("gif");
|
||||
break;
|
||||
case CoverArt::PNG:
|
||||
mime.append("png");
|
||||
break;
|
||||
case CoverArt::Unknown:
|
||||
break;
|
||||
}
|
||||
Picture picture(art.data(), Picture::Other, mime);
|
||||
map.insert(picture);
|
||||
}
|
||||
return PictureMap(map);
|
||||
}
|
||||
|
||||
void
|
||||
@ -789,6 +819,34 @@ MP4::Tag::setTrack(uint value)
|
||||
void
|
||||
MP4::Tag::setPictures(const PictureMap &l)
|
||||
{
|
||||
CoverArtList list;
|
||||
for(PictureMap::ConstIterator pictureMapIt = l.begin();
|
||||
pictureMapIt != l.end();
|
||||
++pictureMapIt) {
|
||||
PictureList pictures = pictureMapIt->second;
|
||||
for(PictureList::ConstIterator pictureListIt = pictures.begin();
|
||||
pictureListIt != pictures.end();
|
||||
++pictureListIt) {
|
||||
Picture picture = *pictureListIt;
|
||||
CoverArt::Format format;
|
||||
const char *mime = picture.mime().toCString();
|
||||
if(std::strcmp("image/", mime) == 0)
|
||||
format = CoverArt::Unknown;
|
||||
else if(std::strcmp("image/bmp", mime) == 0)
|
||||
format = CoverArt::BMP;
|
||||
else if(std::strcmp("image/png", mime) == 0)
|
||||
format = CoverArt::PNG;
|
||||
else if(std::strcmp("image/gif", mime) == 0)
|
||||
format = CoverArt::GIF;
|
||||
else if(std::strcmp("image/jpeg", mime) == 0)
|
||||
format = CoverArt::JPEG;
|
||||
else
|
||||
format = CoverArt::Unknown;
|
||||
CoverArt art(format, picture.data());
|
||||
list.append(art);
|
||||
}
|
||||
}
|
||||
d->items["covr"] = list;
|
||||
}
|
||||
|
||||
bool MP4::Tag::isEmpty() const
|
||||
|
Loading…
x
Reference in New Issue
Block a user