本文整理汇总了C++中mp4::CoverArtList::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ CoverArtList::isEmpty方法的具体用法?C++ CoverArtList::isEmpty怎么用?C++ CoverArtList::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mp4::CoverArtList
的用法示例。
在下文中一共展示了CoverArtList::isEmpty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void
MP4::Tag::parseCovr(const MP4::Atom *atom)
{
MP4::CoverArtList value;
ByteVector data = d->file->readBlock(atom->length - 8);
unsigned int pos = 0;
while(pos < data.size()) {
const int length = static_cast<int>(data.toUInt(pos));
if(length < 12) {
debug("MP4: Too short atom");
break;;
}
const ByteVector name = data.mid(pos + 4, 4);
const int flags = static_cast<int>(data.toUInt(pos + 8));
if(name != "data") {
debug("MP4: Unexpected atom \"" + name + "\", expecting \"data\"");
break;
}
if(flags == TypeJPEG || flags == TypePNG || flags == TypeBMP ||
flags == TypeGIF || flags == TypeImplicit) {
value.append(MP4::CoverArt(MP4::CoverArt::Format(flags),
data.mid(pos + 16, length - 16)));
}
else {
debug("MP4: Unknown covr format " + String::number(flags));
}
pos += length;
}
if(!value.isEmpty())
addItem(atom->name, value);
}
示例2: open
bool TagEditor::open( const QString &fileName )
{
clear();
#ifdef Q_OS_WIN
fRef = new FileRef( ( const wchar_t * )fileName.utf16(), false );
#else
fRef = new FileRef( fileName.toLocal8Bit(), false );
#endif
if ( !fRef->isNull() && fRef->tag() )
{
File &file = *fRef->file();
#if TAGLIB19
/* Copy ID3v2 to InfoTag */
if ( instanceOf( file, RIFF::WAV::File ) )
{
const Tag &tag = *fRef->tag();
RIFF::Info::Tag &infoTag = *( ( RIFF::WAV::File & )file ).InfoTag();
if ( infoTag.isEmpty() && !tag.isEmpty() )
{
infoTag.setTitle( tag.title() );
infoTag.setArtist( tag.artist() );
infoTag.setAlbum( tag.album() );
infoTag.setComment( tag.comment() );
infoTag.setGenre( tag.genre() );
infoTag.setYear( tag.year() );
infoTag.setTrack( tag.track() );
}
}
#endif
const Tag &tag = getTag( *fRef, file );
bool hasTags = !tag.isEmpty();
setChecked( true );
if ( hasTags )
{
titleE->setText( tag.title().toCString( true ) );
artistE->setText( tag.artist().toCString( true ) );
albumE->setText( tag.album().toCString( true ) );
commentE->setText( tag.comment().toCString( true ) );
genreE->setText( tag.genre().toCString( true ) );
yearB->setValue( tag.year() );
trackB->setValue( tag.track() );
}
/* Covers */
if ( instanceOf( file, MPEG::File ) || instanceOf( file, RIFF::AIFF::File ) )
{
pictureB->setEnabled( true );
if ( hasTags )
{
ID3v2::Tag *id3v2 = NULL;
if ( instanceOf( file, MPEG::File ) )
{
MPEG::File &mpegF = ( MPEG::File & )file;
#if TAGLIB19
if ( mpegF.hasID3v2Tag() )
#endif
id3v2 = mpegF.ID3v2Tag();
}
else if ( instanceOf( file, RIFF::AIFF::File ) )
id3v2 = ( ( RIFF::AIFF::File & )file ).tag();
if ( id3v2 )
{
const ID3v2::FrameList &frameList = id3v2->frameList( "APIC" );
if ( !frameList.isEmpty() )
{
ID3v2::AttachedPictureFrame &pictureFrame = *( ID3v2::AttachedPictureFrame * )frameList.front();
pictureMimeType = pictureFrame.mimeType().toCString();
*picture = pictureFrame.picture();
pictureB->setChecked( true );
pictureW->update();
}
}
}
}
else if ( instanceOf( file, FLAC::File ) )
{
pictureB->setEnabled( true );
FLAC::File &flacF = ( FLAC::File & )file;
if ( !flacF.pictureList().isEmpty() )
{
FLAC::Picture &flacPicture = *flacF.pictureList().front();
pictureMimeType = flacPicture.mimeType().toCString();
*picture = flacPicture.data();
pictureB->setChecked( true );
pictureW->update();
hasTags = true;
}
}
else if ( instanceOf( file, MP4::File ) )
{
MP4::ItemListMap &itemListMap = ( ( MP4::File & )file ).tag()->itemListMap();
MP4::ItemListMap::ConstIterator it = itemListMap.find( "covr" );
pictureB->setEnabled( true );
if ( it != itemListMap.end() )
{
MP4::CoverArtList coverArtList = it->second.toCoverArtList();
if ( !coverArtList.isEmpty() )
{
MP4::CoverArt coverArt = coverArtList.front();
//.........这里部分代码省略.........