当前位置: 首页>>代码示例>>C++>>正文


C++ CoverArtList::isEmpty方法代码示例

本文整理汇总了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);
}
开发者ID:Atrament666,项目名称:Clementine,代码行数:32,代码来源:mp4tag.cpp

示例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();
//.........这里部分代码省略.........
开发者ID:JERUKA9,项目名称:QMPlay2,代码行数:101,代码来源:TagEditor.cpp


注:本文中的mp4::CoverArtList::isEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。