本文整理汇总了C++中taglib::StringList::size方法的典型用法代码示例。如果您正苦于以下问题:C++ StringList::size方法的具体用法?C++ StringList::size怎么用?C++ StringList::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类taglib::StringList
的用法示例。
在下文中一共展示了StringList::size方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cover
QPixmap VorbisMetaDataModel::cover()
{
TagLib::Ogg::Vorbis::File file(m_path.toLocal8Bit().constData());
TagLib::Ogg::XiphComment *tag = file.tag();
if(!tag)
return QPixmap();
TagLib::StringList list = tag->fieldListMap()["METADATA_BLOCK_PICTURE"];
if(list.isEmpty())
return QPixmap();
for(uint i = 0; i < list.size(); ++i)
{
TagLib::String value = list[i];
QByteArray block = QByteArray::fromBase64(TStringToQString_qt4(value).toAscii());
if(block.size() < 32)
continue;
qint64 pos = 0;
if(readPictureBlockField(block, pos) != 3) //picture type, use front cover only
continue;
pos += 4;
int mimeLength = readPictureBlockField(block, pos); //mime type length
pos += 4;
pos += mimeLength; //skip mime type
int descLength = readPictureBlockField(block, pos); //description length
pos += 4;
pos += descLength; //skip description
pos += 4; //width
pos += 4; //height
pos += 4; //color depth
pos += 4; //the number of colors used
int length = readPictureBlockField(block, pos); //picture size
pos += 4;
QPixmap cover;
cover.loadFromData(block.mid(pos, length)); //read binary picture data
return cover;
}
return QPixmap();
}
示例2: QString
QString FileHelper::extractMp4Feature(const QString &featureToExtract) const
{
QString feature;
if (TagLib::MP4::File *mp4File = static_cast<TagLib::MP4::File*>(_file)) {
if (mp4File->tag()) {
TagLib::MP4::ItemListMap &items = mp4File->tag()->itemListMap();
if (items.contains(featureToExtract.toStdString().data())) {
TagLib::MP4::Item item = items[featureToExtract.toStdString().data()];
TagLib::StringList list = item.toStringList();
if (list.size() > 0) {
feature = list[0].toCString(true);
}
/*for (uint i = 0; i < list.size(); i++) {
TagLib::String s = list[i];
qDebug() << Q_FUNC_INFO << s.toCString(true);
}*/
}
/*for (auto it = items.begin(); it != items.end(); ++it) {
qDebug() << Q_FUNC_INFO << QString(it->first.toCString(false));
}*/
}
}
return feature;
}
示例3: extract
//.........这里部分代码省略.........
}
// Genre.
itOgg = lstOgg.find("GENRE");
if (itOgg != lstOgg.end()) {
genres.append((*itOgg).second);
}
}
}
// Handling multiple tags in Musepack files.
if (mimeType == QLatin1String("audio/x-musepack")) {
TagLib::MPC::File mpcFile(fileUrl.toUtf8().constData(), true);
if (mpcFile.tag() && !mpcFile.tag()->isEmpty()) {
TagLib::APE::ItemListMap lstMusepack = mpcFile.APETag()->itemListMap();
TagLib::APE::ItemListMap::ConstIterator itMPC;
// Artist.
itMPC = lstMusepack.find("ARTIST");
if (itMPC != lstMusepack.end()) {
if (!artists.isEmpty()) {
artists += ", ";
}
artists += (*itMPC).second.toString();
}
// Album Artist.
itMPC = lstMusepack.find("ALBUMARTIST");
if (itMPC != lstMusepack.end()) {
if(!albumArtists.isEmpty()) {
albumArtists += ", ";
}
albumArtists += (*itMPC).second.toString();
}
// Composer.
itMPC = lstMusepack.find("COMPOSER");
if (itMPC != lstMusepack.end()) {
if (!composers.isEmpty()) {
composers += ", ";
}
composers += (*itMPC).second.toString();
}
// Lyricist.
itMPC = lstMusepack.find("LYRICIST");
if (itMPC != lstMusepack.end()) {
if (!lyricists.isEmpty()) {
lyricists += ", ";
}
lyricists += (*itMPC).second.toString();
}
// Genre.
itMPC = lstMusepack.find("GENRE");
if (itMPC != lstMusepack.end()) {
genres.append((*itMPC).second.toString());
}
}
}
if (!tags->isEmpty()) {
QString title = t2q(tags->title());
if (!title.isEmpty()) {
result->add(Property::Title, title);
}
QString comment = t2q(tags->comment());
if (!comment.isEmpty()) {
result->add(Property::Comment, comment);
}
if (genres.isEmpty()) {
genres.append(tags->genre());
}
for (uint i = 0; i < genres.size(); i++) {
QString genre = t2q(genres[i]).trimmed();
// Convert from int
bool ok = false;
int genreNum = genre.toInt(&ok);
if (ok) {
genre = t2q(TagLib::ID3v1::genre(genreNum));
}
result->add(Property::Genre, genre);
}
QString artistString;
if (artists.isEmpty()) {
artistString = t2q(tags->artist());
} else {
artistString = t2q(artists).trimmed();
}
QStringList artists = contactsFromString(artistString);
foreach(const QString& artist, artists) {
result->add(Property::Artist, artist);
}
示例4: if
Meta::FieldHash
ID3v2TagHelper::tags() const
{
Meta::FieldHash data = TagHelper::tags();
TagLib::ID3v2::FrameList list = m_tag->frameList();
for( TagLib::ID3v2::FrameList::ConstIterator it = list.begin(); it != list.end(); ++it )
{
qint64 field;
TagLib::String frameName = TagLib::String( ( *it )->frameID() );
if( ( field = fieldName( frameName ) ) )
{
if( field == Meta::valUniqueId )
{
TagLib::ID3v2::UniqueFileIdentifierFrame *frame =
dynamic_cast< TagLib::ID3v2::UniqueFileIdentifierFrame * >( *it );
if( !frame )
continue;
QString identifier = TStringToQString( TagLib::String( frame->identifier() ) );
if( identifier.isEmpty() )
continue;
if( frame->owner() == uidFieldName( UIDAFT ) && isValidUID( identifier, UIDAFT ) )
data.insert( Meta::valUniqueId, identifier );
continue;
}
else if( field == Meta::valHasCover )
{
TagLib::ID3v2::AttachedPictureFrame *frame =
dynamic_cast< TagLib::ID3v2::AttachedPictureFrame * >( *it );
if( !frame )
continue;
if( ( frame->type() == TagLib::ID3v2::AttachedPictureFrame::FrontCover ||
frame->type() == TagLib::ID3v2::AttachedPictureFrame::Other ) &&
frame->picture().size() > MIN_COVER_SIZE ) // must be at least 1kb
{
data.insert( Meta::valHasCover, true );
}
continue;
}
TagLib::ID3v2::TextIdentificationFrame *frame =
dynamic_cast< TagLib::ID3v2::TextIdentificationFrame * >( *it );
if( !frame )
continue;
QString value = TStringToQString( frame->fieldList().toString( '\n' ) );
if( field == Meta::valDiscNr )
{
int disc;
if( ( disc = splitDiscNr( value ).first ) )
data.insert( field, disc );
}
else if( field == Meta::valBpm )
data.insert( field, value.toFloat() );
else
data.insert( field, value );
}
else if( frameName == POPM_Frame )
{
TagLib::ID3v2::PopularimeterFrame *frame =
dynamic_cast< TagLib::ID3v2::PopularimeterFrame * >( *it );
if( !frame )
continue;
if( TStringToQString( frame->email() ).isEmpty() ) // only read anonymous ratings
{
// FMPS tags have precedence
if( !data.contains( Meta::valRating ) && frame->rating() != 0 )
data.insert( Meta::valRating, qRound( frame->rating() / 256.0 * 10.0 ) );
if( !data.contains( Meta::valPlaycount ) && frame->counter() < 10000 )
data.insert( Meta::valPlaycount, frame->counter() );
}
}
else if( frameName == TXXX_Frame )
{
TagLib::ID3v2::UserTextIdentificationFrame *frame =
dynamic_cast< TagLib::ID3v2::UserTextIdentificationFrame * >( *it );
if( !frame )
continue;
// the value of the user text frame is stored in the
// second and following fields.
TagLib::StringList fields = frame->fieldList();
if( fields.size() >= 2 )
{
QString value = TStringToQString( fields[1] );
if( fields[0] == fmpsFieldName( FMPSRating ) )
data.insert( Meta::valRating, qRound( value.toFloat() * 10.0 ) );
else if( fields[0] == fmpsFieldName( FMPSScore ) )
//.........这里部分代码省略.........