本文整理汇总了C++中Metadata::GetAttachedPictures方法的典型用法代码示例。如果您正苦于以下问题:C++ Metadata::GetAttachedPictures方法的具体用法?C++ Metadata::GetAttachedPictures怎么用?C++ Metadata::GetAttachedPictures使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Metadata
的用法示例。
在下文中一共展示了Metadata::GetAttachedPictures方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
if(nullptr != trackGainFrame)
tag->removeFrame(trackGainFrame);
if(nullptr != trackPeakFrame)
tag->removeFrame(trackPeakFrame);
if(nullptr != albumGainFrame)
tag->removeFrame(albumGainFrame);
if(nullptr != albumPeakFrame)
tag->removeFrame(albumPeakFrame);
if(trackGain) {
SFB::CFString str = CreateStringFromNumberWithFormat(trackGain, kCFNumberDoubleType, CFSTR("%+2.2f dB"));
auto frame = new TagLib::ID3v2::UserTextIdentificationFrame();
frame->setDescription("replaygain_track_gain");
frame->setText(TagLib::StringFromCFString(str));
tag->addFrame(frame);
}
if(trackPeak) {
SFB::CFString str = CreateStringFromNumberWithFormat(trackPeak, kCFNumberDoubleType, CFSTR("%1.8f dB"));
auto frame = new TagLib::ID3v2::UserTextIdentificationFrame();
frame->setDescription("replaygain_track_peak");
frame->setText(TagLib::StringFromCFString(str));
tag->addFrame(frame);
}
if(albumGain) {
SFB::CFString str = CreateStringFromNumberWithFormat(albumGain, kCFNumberDoubleType, CFSTR("%+2.2f dB"));
auto frame = new TagLib::ID3v2::UserTextIdentificationFrame();
frame->setDescription("replaygain_album_gain");
frame->setText(TagLib::StringFromCFString(str));
tag->addFrame(frame);
}
if(albumPeak) {
SFB::CFString str = CreateStringFromNumberWithFormat(albumPeak, kCFNumberDoubleType, CFSTR("%1.8f dB"));
auto frame = new TagLib::ID3v2::UserTextIdentificationFrame();
frame->setDescription("replaygain_album_peak");
frame->setText(TagLib::StringFromCFString(str));
tag->addFrame(frame);
}
// Also write the RVA2 frames
tag->removeFrames("RVA2");
if(trackGain) {
auto relativeVolume = new TagLib::ID3v2::RelativeVolumeFrame();
float f;
CFNumberGetValue(trackGain, kCFNumberFloatType, &f);
relativeVolume->setIdentification(TagLib::String("track", TagLib::String::Latin1));
relativeVolume->setVolumeAdjustment(f, TagLib::ID3v2::RelativeVolumeFrame::MasterVolume);
tag->addFrame(relativeVolume);
}
if(albumGain) {
auto relativeVolume = new TagLib::ID3v2::RelativeVolumeFrame();
float f;
CFNumberGetValue(albumGain, kCFNumberFloatType, &f);
relativeVolume->setIdentification(TagLib::String("album", TagLib::String::Latin1));
relativeVolume->setVolumeAdjustment(f, TagLib::ID3v2::RelativeVolumeFrame::MasterVolume);
tag->addFrame(relativeVolume);
}
// Album art
if(setAlbumArt) {
tag->removeFrames("APIC");
for(auto attachedPicture : metadata.GetAttachedPictures()) {
SFB::CGImageSource imageSource = CGImageSourceCreateWithData(attachedPicture->GetData(), nullptr);
if(!imageSource)
continue;
TagLib::ID3v2::AttachedPictureFrame *frame = new TagLib::ID3v2::AttachedPictureFrame;
// Convert the image's UTI into a MIME type
SFB::CFString mimeType = UTTypeCopyPreferredTagWithClass(CGImageSourceGetType(imageSource), kUTTagClassMIMEType);
if(mimeType)
frame->setMimeType(TagLib::StringFromCFString(mimeType));
frame->setPicture(TagLib::ByteVector((const char *)CFDataGetBytePtr(attachedPicture->GetData()), (TagLib::uint)CFDataGetLength(attachedPicture->GetData())));
frame->setType((TagLib::ID3v2::AttachedPictureFrame::Type)attachedPicture->GetType());
if(attachedPicture->GetDescription())
frame->setDescription(TagLib::StringFromCFString(attachedPicture->GetDescription()));
tag->addFrame(frame);
}
}
return true;
}
示例2:
void SFB::Audio::Metadata::CopyAttachedPictures(const Metadata& metadata)
{
RemoveAllAttachedPictures();
for(auto picture : metadata.GetAttachedPictures())
AttachPicture(std::make_shared<AttachedPicture>(picture->GetData(), picture->GetType(), picture->GetDescription()));
}