本文整理汇总了C++中taglib::id3v2::AttachedPictureFrame::setDescription方法的典型用法代码示例。如果您正苦于以下问题:C++ AttachedPictureFrame::setDescription方法的具体用法?C++ AttachedPictureFrame::setDescription怎么用?C++ AttachedPictureFrame::setDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类taglib::id3v2::AttachedPictureFrame
的用法示例。
在下文中一共展示了AttachedPictureFrame::setDescription方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: attachPicture
bool MetaDSF::attachPicture(const TagLib::String &path,
const TagLib::ID3v2::AttachedPictureFrame::Type t,
const TagLib::String &comment)
{
// Determine MIME type
TagLib::String mimeType;
TagLib::String ext = path.substr(path.rfind(".") + 1);
transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
if (extToMIMETypeMap.find(ext) == extToMIMETypeMap.end()) {
std::cerr << "Unknown image format " << ext << std::endl;
return false;
}
mimeType = extToMIMETypeMap[ext];
// Load file into memory
TagLib::ByteVector v;
if (loadFileIntoVector(path.toCString(), v) <= 0) {
return false;
}
TagLib::ID3v2::AttachedPictureFrame *apic =
new TagLib::ID3v2::AttachedPictureFrame();
apic->setPicture(v);
apic->setMimeType(mimeType);
apic->setType(t);
apic->setDescription(comment);
_i->_file.ID3v2Tag()->addFrame(apic);
_i->_changed = true;
return true;
}
示例2: if
//.........这里部分代码省略.........
tag->addFrame(frame);
}
else if(discTotal) {
SFB::CFString str = CFStringCreateWithFormat(kCFAllocatorDefault, nullptr, CFSTR("/%@"), discTotal);
auto frame = new TagLib::ID3v2::TextIdentificationFrame("TPOS", TagLib::String::Latin1);
frame->setText(TagLib::StringFromCFString(str));
tag->addFrame(frame);
}
// Lyrics
tag->removeFrames("USLT");
if(metadata.GetLyrics()) {
auto frame = new TagLib::ID3v2::UnsynchronizedLyricsFrame(TagLib::String::UTF8);
frame->setText(TagLib::StringFromCFString(metadata.GetLyrics()));
tag->addFrame(frame);
}
tag->removeFrames("TSRC");
if(metadata.GetISRC()) {
auto frame = new TagLib::ID3v2::TextIdentificationFrame("TSRC", TagLib::String::Latin1);
frame->setText(TagLib::StringFromCFString(metadata.GetISRC()));
tag->addFrame(frame);
}
// MusicBrainz
auto musicBrainzReleaseIDFrame = TagLib::ID3v2::UserTextIdentificationFrame::find(tag, "MusicBrainz Album Id");
if(nullptr != musicBrainzReleaseIDFrame)
tag->removeFrame(musicBrainzReleaseIDFrame);
CFStringRef musicBrainzReleaseID = metadata.GetMusicBrainzReleaseID();
if(musicBrainzReleaseID) {
auto frame = new TagLib::ID3v2::UserTextIdentificationFrame();
frame->setDescription("MusicBrainz Album Id");
frame->setText(TagLib::StringFromCFString(musicBrainzReleaseID));
tag->addFrame(frame);
}
auto musicBrainzRecordingIDFrame = TagLib::ID3v2::UserTextIdentificationFrame::find(const_cast<TagLib::ID3v2::Tag *>(tag), "MusicBrainz Track Id");
if(nullptr != musicBrainzRecordingIDFrame)
tag->removeFrame(musicBrainzRecordingIDFrame);
CFStringRef musicBrainzRecordingID = metadata.GetMusicBrainzRecordingID();
if(musicBrainzRecordingID) {
auto frame = new TagLib::ID3v2::UserTextIdentificationFrame();
frame->setDescription("MusicBrainz Track Id");
frame->setText(TagLib::StringFromCFString(musicBrainzRecordingID));
tag->addFrame(frame);
}
// Sorting and grouping
tag->removeFrames("TSOT");
if(metadata.GetTitleSortOrder()) {
auto frame = new TagLib::ID3v2::TextIdentificationFrame("TSOT", TagLib::String::UTF8);
frame->setText(TagLib::StringFromCFString(metadata.GetTitleSortOrder()));
tag->addFrame(frame);
}
tag->removeFrames("TSOA");
if(metadata.GetAlbumTitleSortOrder()) {
auto frame = new TagLib::ID3v2::TextIdentificationFrame("TSOA", TagLib::String::UTF8);
frame->setText(TagLib::StringFromCFString(metadata.GetAlbumTitleSortOrder()));
tag->addFrame(frame);
}