C++来自 MPEG 4 文件的 Taglib 封面艺术
作为一个副业/有趣的项目,我正在构建一个音频播放器(Qt 应用程序),其中一个障碍是显示嵌入式封面艺术。对于 *.mp3 文件,这最终不是太大的问题,主要归功于提供的示例 此处:
static QImage imageForTag(TagLib::ID3v2::Tag *tag)
{
TagLib::ID3v2::FrameList l = tag->frameList("APIC");
QImage image;
if(l.isEmpty())
return image;
TagLib::ID3v2::AttachedPictureFrame *f =
static_cast<TagLib::ID3v2::AttachedPictureFrame *>(l.front());
image.loadFromData((const uchar *) f->picture().data(), f->picture().size());
return image;
}
但是,如何为 MPEG 4 文件(特别是 *.m4a)提取嵌入的封面艺术?
As a side/fun project I'm building an audio player (Qt application), and one of the hurdles is displaying embedded cover art. With *.mp3 files this ended up not being too much of an issue, mainly thanks to the example provided here:
static QImage imageForTag(TagLib::ID3v2::Tag *tag)
{
TagLib::ID3v2::FrameList l = tag->frameList("APIC");
QImage image;
if(l.isEmpty())
return image;
TagLib::ID3v2::AttachedPictureFrame *f =
static_cast<TagLib::ID3v2::AttachedPictureFrame *>(l.front());
image.loadFromData((const uchar *) f->picture().data(), f->picture().size());
return image;
}
However, how can embedded cover arts be extracted for MPEG 4 files (particularly *.m4a)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
操作方法如下:
image
来自 QtQImage
类,“file”只是一个char*
变量。Here is how to do it:
image
is from the QtQImage
class, and "file" is simply achar*
variable.