本文整理汇总了C++中taglib::id3v2::FrameList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ FrameList::begin方法的具体用法?C++ FrameList::begin怎么用?C++ FrameList::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类taglib::id3v2::FrameList
的用法示例。
在下文中一共展示了FrameList::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: malloc
/* GET ALBUM COVER
*/
const char * tag_data_get_cover (TagDatac * data, uint * len)
{
TagLib::ID3v2::AttachedPictureFrame * pic = NULL;
if (!(reinterpret_cast<TagData *>(data))->id3v2 || (reinterpret_cast<TagData *>(data))->id3v2->frameListMap()["APIC"].isEmpty())
{
*len = 0;
return NULL;
}
TagLib::ID3v2::FrameList::ConstIterator it;
TagLib::ID3v2::FrameList l = (reinterpret_cast<TagData *>(data))->id3v2->frameListMap()["APIC"];
for(it=l.begin(); it!=l.end(); ++it)
{
TagLib::ID3v2::AttachedPictureFrame * t = dynamic_cast<TagLib::ID3v2::AttachedPictureFrame*>(*it);
if (pic == NULL)
pic = t;
if (t->type () == TagLib::ID3v2::AttachedPictureFrame::FrontCover)
{
pic = t;
break;
}
}
if (pic == NULL)
{
*len = 0;
return NULL;
}
*len = pic->picture ().size ();
const char * out = (const char *) malloc (*len);
memcpy ((void *) out, pic->picture ().data(), *len);
return out;
}
示例2: if
ID3v2Tag::ID3v2Tag( TagLib::Tag *tag, TagLib::ID3v2::Tag *id3v2Tag )
: Tag( tag )
, m_id3v2Tag( id3v2Tag )
{
TagLib::ID3v2::FrameList fList = m_id3v2Tag->frameList();
for( TagLib::ID3v2::FrameList::ConstIterator it = fList.begin();
it != fList.end(); ++it )
{
TagLib::String frameId = TagLib::String( (*it)->frameID() );
TagLib::ID3v2::TextIdentificationFrame *frame =
dynamic_cast< TagLib::ID3v2::TextIdentificationFrame * >( *it );
if( frame )
{
QString val = TStringToQString( frame->fieldList().toString( '\n' ) );
if( frameId == TagLib::String( "TPE2" ) ) //album artist
{
m_albumArtist = val;
}
else if( frameId == TagLib::String( "TCOM" ) ) //composer
{
m_composer = val;
}
else if( frameId == TagLib::String( "TPOS" ) ) //disc number
{
m_discNumber = processDiscNumber( val );
}
}
}
}
示例3: tag_data_get_gain
/* GET REPLAY GAIN
*/
float tag_data_get_gain (TagDatac * data)
{
if ((reinterpret_cast<TagData *>(data))->xiph && !(reinterpret_cast<TagData *>(data))->xiph->fieldListMap()["REPLAYGAIN_ALBUM_GAIN"].isEmpty())
return atof((reinterpret_cast<TagData *>(data))->xiph->fieldListMap()["REPLAYGAIN_ALBUM_GAIN"].front().toCString(1));
if ((reinterpret_cast<TagData *>(data))->xiph && !(reinterpret_cast<TagData *>(data))->xiph->fieldListMap()["REPLAYGAIN_TRACK_GAIN"].isEmpty())
return atof((reinterpret_cast<TagData *>(data))->xiph->fieldListMap()["REPLAYGAIN_TRACK_GAIN"].front().toCString(1));
if ((reinterpret_cast<TagData *>(data))->xiph && !(reinterpret_cast<TagData *>(data))->xiph->fieldListMap()["RG_AUDIOPHILE"].isEmpty())
return atof((reinterpret_cast<TagData *>(data))->xiph->fieldListMap()["RG_AUDIOPHILE"].front().toCString(1));
if ((reinterpret_cast<TagData *>(data))->xiph && !(reinterpret_cast<TagData *>(data))->xiph->fieldListMap()["RG_RADIO"].isEmpty())
return atof((reinterpret_cast<TagData *>(data))->xiph->fieldListMap()["RG_RADIO"].front().toCString(1));
if ((reinterpret_cast<TagData *>(data))->id3v2 && !(reinterpret_cast<TagData *>(data))->id3v2->frameListMap()["RVA2"].isEmpty())
{
TagLib::ID3v2::FrameList::ConstIterator it;
TagLib::ID3v2::FrameList l = (reinterpret_cast<TagData *>(data))->id3v2->frameListMap()["RVA2"];
for(it=l.begin(); it!=l.end(); ++it)
{
TagLib::ID3v2::RelativeVolumeFrame * rva = dynamic_cast<TagLib::ID3v2::RelativeVolumeFrame*>(*it);
if (rva->channelType () == TagLib::ID3v2::RelativeVolumeFrame::MasterVolume)
return rva->volumeAdjustment ();
}
}
return 0.0;
}
示例4: fileref
Tag::Tag(const QString &filename)
: m_filename(filename)
{
TagLib::MPEG::File mpegfile(filename.toLocal8Bit().constData());
TagLib::ID3v2::Tag* id3v2 = mpegfile.ID3v2Tag();
if (id3v2 && !id3v2->isEmpty()) {
readRegularTag(id3v2, m_data);
int picnum = 0;
TagLib::ID3v2::FrameList frames = id3v2->frameListMap()["APIC"]; // attached picture
TagLib::ID3v2::FrameList::ConstIterator it = frames.begin();
while (it != frames.end()) {
TagLib::ID3v2::AttachedPictureFrame* apic = static_cast<TagLib::ID3v2::AttachedPictureFrame*>(*it);
TagLib::ByteVector bytes = apic->picture();
QImage img = QImage::fromData(reinterpret_cast<const uchar*>(bytes.data()), bytes.size());
if (!img.isNull()) {
m_data[QLatin1String("picture") + QString::number(picnum++)] = QVariant(img);
}
++it;
}
} else {
TagLib::FileRef fileref(filename.toLocal8Bit().constData());
if (fileref.isNull())
return;
TagLib::Tag* tag = fileref.tag();
if (!tag || tag->isEmpty())
return;
readRegularTag(tag, m_data);
}
}
示例5: is_framelist_empty
bool is_framelist_empty(const TagLib::ID3v2::FrameList &list)
{
for (auto it = list.begin(); it != list.end(); ++it)
if ((*it)->toString() != TagLib::String::null)
return false;
return true;
}
示例6: QImage
/*!
* \brief Read the albumart image from the file
*
* \param filename The filename for which we want to find the length.
* \param type The type of image we want - front/back etc
* \returns A pointer to a QImage owned by the caller or NULL if not found.
*/
QImage* MetaIOID3::getAlbumArt(QString filename, ImageType type)
{
QImage *picture = new QImage();
AttachedPictureFrame::Type apicType
= AttachedPictureFrame::FrontCover;
switch (type)
{
case IT_UNKNOWN :
apicType = AttachedPictureFrame::Other;
break;
case IT_FRONTCOVER :
apicType = AttachedPictureFrame::FrontCover;
break;
case IT_BACKCOVER :
apicType = AttachedPictureFrame::BackCover;
break;
case IT_CD :
apicType = AttachedPictureFrame::Media;
break;
case IT_INLAY :
apicType = AttachedPictureFrame::LeafletPage;
break;
default:
return picture;
}
QByteArray fname = filename.toLocal8Bit();
TagLib::MPEG::File *mpegfile = new TagLib::MPEG::File(fname.constData());
if (mpegfile)
{
if (mpegfile->isOpen()
&& !mpegfile->ID3v2Tag()->frameListMap()["APIC"].isEmpty())
{
TagLib::ID3v2::FrameList apicframes =
mpegfile->ID3v2Tag()->frameListMap()["APIC"];
for(TagLib::ID3v2::FrameList::Iterator it = apicframes.begin();
it != apicframes.end(); ++it)
{
AttachedPictureFrame *frame =
static_cast<AttachedPictureFrame *>(*it);
if (frame && frame->type() == apicType)
{
picture->loadFromData((const uchar *)frame->picture().data(),
frame->picture().size());
return picture;
}
}
}
delete mpegfile;
}
delete picture;
return NULL;
}
示例7: if
QImage
ID3v2TagHelper::embeddedCover() const
{
TagLib::ID3v2::FrameList apicList = m_tag->frameListMap()[fieldName( Meta::valHasCover ).toCString()];
TagLib::ID3v2::AttachedPictureFrame *cover = NULL;
TagLib::ID3v2::AttachedPictureFrame *otherCover = NULL;
for( TagLib::ID3v2::FrameList::ConstIterator it = apicList.begin(); it != apicList.end(); ++it )
{
TagLib::ID3v2::AttachedPictureFrame *currFrame =
dynamic_cast< TagLib::ID3v2::AttachedPictureFrame * >( *it );
if( currFrame->picture().size() < MIN_COVER_SIZE )
continue;
if( currFrame->type() == TagLib::ID3v2::AttachedPictureFrame::FrontCover )
{
cover = currFrame;
}
else if( currFrame->type() == TagLib::ID3v2::AttachedPictureFrame::Other )
{
otherCover = currFrame;
}
}
if( !cover && otherCover )
cover = otherCover;
if( !cover )
return QImage();
return QImage::fromData( ( uchar * )( cover->picture().data() ), cover->picture().size() );
}
示例8: exportPictures
bool MetaDSF::exportPictures(const char *prefix) const
{
std::map<std::string, unsigned int> counter;
TagLib::ID3v2::FrameList l = _i->_file.ID3v2Tag()->frameList("APIC");
TagLib::ID3v2::FrameList::ConstIterator it;
for (it = l.begin(); it != l.end(); ++it) {
TagLib::ID3v2::AttachedPictureFrame *f =
static_cast<TagLib::ID3v2::AttachedPictureFrame *>(*it);
std::string fname = prefix;
std::string tname = picTypeDesc[f->type()].toCString();
std::string ext = MIMETypeToExtMap[f->mimeType()].toCString();
if (counter.find(tname) == counter.end())
counter[tname] = 1;
else
counter[tname] += 1;
fname += "_";
fname += tname;
fname += "_";
fname += std::to_string(counter[tname]);
fname += ".";
fname += ext;
//std::cout << "fname = " << fname << std::endl;
writeFileFromVector(fname.c_str(), f->picture());
}
return true;
}
示例9:
//// Private ////
void MetaDSF::MetaDSFImpl::deleteFrames(const TagLib::ID3v2::FrameList &l)
{
TagLib::ID3v2::FrameList::ConstIterator it;
for (it = l.begin(); it != l.end(); it++) {
_file.ID3v2Tag()->removeFrame(*it);
}
}
示例10: QImage
/*!
* \brief Read the albumart image from the file
*
* \param filename The filename for which we want to find the albumart.
* \param type The type of image we want - front/back etc
* \returns A pointer to a QImage owned by the caller or nullptr if not found.
*/
QImage* MetaIOID3::getAlbumArt(const QString &filename, ImageType type)
{
QImage *picture = new QImage();
AttachedPictureFrame::Type apicType
= AttachedPictureFrame::FrontCover;
switch (type)
{
case IT_UNKNOWN :
apicType = AttachedPictureFrame::Other;
break;
case IT_FRONTCOVER :
apicType = AttachedPictureFrame::FrontCover;
break;
case IT_BACKCOVER :
apicType = AttachedPictureFrame::BackCover;
break;
case IT_CD :
apicType = AttachedPictureFrame::Media;
break;
case IT_INLAY :
apicType = AttachedPictureFrame::LeafletPage;
break;
case IT_ARTIST :
apicType = AttachedPictureFrame::Artist;
break;
default:
return picture;
}
if (OpenFile(filename))
{
TagLib::ID3v2::Tag *tag = GetID3v2Tag();
if (tag && !tag->frameListMap()["APIC"].isEmpty())
{
TagLib::ID3v2::FrameList apicframes = tag->frameListMap()["APIC"];
for(TagLib::ID3v2::FrameList::Iterator it = apicframes.begin();
it != apicframes.end(); ++it)
{
AttachedPictureFrame *frame =
static_cast<AttachedPictureFrame *>(*it);
if (frame && frame->type() == apicType)
{
picture->loadFromData((const uchar *)frame->picture().data(),
frame->picture().size());
return picture;
}
}
}
}
delete picture;
return nullptr;
}
示例11:
/*!
* \brief Find the POPM tag associated with MythTV
*
* \param tag Pointer to TagLib::ID3v2::Tag object
* \param email Email address associated with this POPM frame
* \returns Pointer to frame
*/
PopularimeterFrame* MetaIOID3::findPOPM(TagLib::ID3v2::Tag *tag,
const String &_email)
{
TagLib::ID3v2::FrameList l = tag->frameList("POPM");
for(TagLib::ID3v2::FrameList::Iterator it = l.begin(); it != l.end(); ++it)
{
PopularimeterFrame *f = static_cast<PopularimeterFrame *>(*it);
if (f && f->email() == _email)
return f;
}
return nullptr;
}
示例12: printTags
void MetaDSF::printTags(const char *prefix) const
{
if (_i->_file.ID3v2Tag()->isEmpty()) {
return;
}
TagLib::ID3v2::FrameList l = _i->_file.ID3v2Tag()->frameList();
TagLib::ID3v2::FrameList::ConstIterator it;
for (it = l.begin(); it != l.end(); it++) {
std::cout << prefix;
std::cout << (*it)->frameID() << "=" << (*it)->toString() << std::endl;
}
}
示例13: qDebug
bool SoundSource::processID3v2Tag(TagLib::ID3v2::Tag* id3v2) {
// Print every frame in the file.
if (s_bDebugMetadata) {
TagLib::ID3v2::FrameList::ConstIterator it = id3v2->frameList().begin();
for(; it != id3v2->frameList().end(); it++) {
qDebug() << "ID3V2" << (*it)->frameID().data() << "-"
<< TStringToQString((*it)->toString());
}
}
TagLib::ID3v2::FrameList bpmFrame = id3v2->frameListMap()["TBPM"];
if (!bpmFrame.isEmpty()) {
QString sBpm = TStringToQString(bpmFrame.front()->toString());
processBpmString("ID3v2", sBpm);
}
TagLib::ID3v2::FrameList keyFrame = id3v2->frameListMap()["TKEY"];
if (!keyFrame.isEmpty()) {
QString sKey = TStringToQString(keyFrame.front()->toString());
setKey(sKey);
}
// Foobar2000-style ID3v2.3.0 tags
// TODO: Check if everything is ok.
TagLib::ID3v2::FrameList frames = id3v2->frameListMap()["TXXX"];
for ( TagLib::ID3v2::FrameList::Iterator it = frames.begin(); it != frames.end(); ++it ) {
TagLib::ID3v2::UserTextIdentificationFrame* ReplayGainframe =
dynamic_cast<TagLib::ID3v2::UserTextIdentificationFrame*>( *it );
if ( ReplayGainframe && ReplayGainframe->fieldList().size() >= 2 )
{
QString desc = TStringToQString( ReplayGainframe->description() ).toLower();
if ( desc == "replaygain_album_gain" ){
QString sReplayGain = TStringToQString( ReplayGainframe->fieldList()[1]);
parseReplayGainString(sReplayGain);
}
if ( desc == "replaygain_track_gain" ){
QString sReplayGain = TStringToQString( ReplayGainframe->fieldList()[1]);
parseReplayGainString(sReplayGain);
}
}
}
TagLib::ID3v2::FrameList composerFrame = id3v2->frameListMap()["TCOM"];
if (!composerFrame.isEmpty()) {
QString sComposer = TStringToQString(composerFrame.front()->toString());
setComposer(sComposer);
}
return true;
}
示例14: extractMBIDFromFile
QString extractMBIDFromFile(TagLib::MPEG::File *file)
{
TagLib::ID3v2::Tag *tag = file->ID3v2Tag();
TagLib::ID3v2::FrameList ufid = tag->frameListMap()["UFID"];
if (!ufid.isEmpty()) {
for (TagLib::ID3v2::FrameList::Iterator i = ufid.begin(); i != ufid.end(); i++) {
TagLib::ID3v2::UniqueFileIdentifierFrame *frame = dynamic_cast<TagLib::ID3v2::UniqueFileIdentifierFrame *>(*i);
if (frame && frame->owner() == "http://musicbrainz.org") {
TagLib::ByteVector id = frame->identifier();
return QString::fromAscii(id.data(), id.size());
}
}
}
return QString();
}
示例15:
bool
ID3v2TagHelper::hasEmbeddedCover() const
{
TagLib::ID3v2::FrameList apicList = m_tag->frameListMap()[fieldName( Meta::valHasCover ).toCString()];
for( TagLib::ID3v2::FrameList::ConstIterator it = apicList.begin(); it != apicList.end(); ++it )
{
TagLib::ID3v2::AttachedPictureFrame *currFrame =
dynamic_cast< TagLib::ID3v2::AttachedPictureFrame * >( *it );
if( currFrame->picture().size() < MIN_COVER_SIZE )
continue;
if( currFrame->type() == TagLib::ID3v2::AttachedPictureFrame::FrontCover ||
currFrame->type() == TagLib::ID3v2::AttachedPictureFrame::Other )
return true;
}
return false;
}