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


C++ Tag::genre方法代码示例

本文整理汇总了C++中Tag::genre方法的典型用法代码示例。如果您正苦于以下问题:C++ Tag::genre方法的具体用法?C++ Tag::genre怎么用?C++ Tag::genre使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tag的用法示例。


在下文中一共展示了Tag::genre方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: testInsertAndExtract

  void testInsertAndExtract()
  {
    ScopedFileCopy copy("matroska", ".mka");
    string filename = copy.fileName();

    {
      EBML::Matroska::File f1(filename.c_str());
      CPPUNIT_ASSERT(f1.isValid());

      Tag* t = f1.tag();

      CPPUNIT_ASSERT(t != 0);
      t->setTitle("Seconds of Silence");
      t->setArtist("Nobody");
      t->setAlbum("TagLib Test Suite");
      t->setComment("Well, there's nothing to say - a few special signs: ©’…ä–€ſ");
      t->setGenre("Air");
      t->setYear(2013);
      t->setTrack(15);

      CPPUNIT_ASSERT(f1.save());
    }
    {
      EBML::Matroska::File f2(filename.c_str());
      CPPUNIT_ASSERT(f2.isValid());

      Tag* t = f2.tag();

      CPPUNIT_ASSERT(t != 0);
      CPPUNIT_ASSERT_EQUAL(String("Seconds of Silence"), t->title());
      CPPUNIT_ASSERT_EQUAL(String("Nobody"), t->artist());
      CPPUNIT_ASSERT_EQUAL(String("TagLib Test Suite"), t->album());
      CPPUNIT_ASSERT_EQUAL(String("Well, there's nothing to say - a few special signs: ©’…ä–€ſ"), t->comment());
      CPPUNIT_ASSERT_EQUAL(String("Air"), t->genre());
      CPPUNIT_ASSERT_EQUAL(2013u, t->year());
      CPPUNIT_ASSERT_EQUAL(15u, t->track());

      PropertyMap pm = f2.properties();
      pm.erase("COMMENT");
      f2.setProperties(pm);

      CPPUNIT_ASSERT(f2.save());
    }

    {
      EBML::Matroska::File f3(filename.c_str());
      CPPUNIT_ASSERT(f3.isValid());

      PropertyMap pm = f3.properties();
      PropertyMap::Iterator i = pm.find("GENRE");

      CPPUNIT_ASSERT(i != pm.end());
      CPPUNIT_ASSERT_EQUAL(String("Air"), i->second.front());
    }
  }
开发者ID:Linko91,项目名称:node-taglib2,代码行数:55,代码来源:test_matroska.cpp

示例2:

QMPlay_Tag::QMPlay_Tag( const char *_fileName )
{
	using namespace TagLib;

	fileName = _fileName;
	isNull = true;
	canWriteID3 = false;
	dontUse = false;

	isFLAC = fileName.right( 5 ) == ".flac";
	if ( !isFLAC )
	{
		QByteArray r4 = fileName.right( 4 );
		if ( r4 == ".wav" )
		{
			dontUse = true;
			return;
		}
		if ( r4 == ".mp3" )
			canWriteID3 = true;
	}

	//General tags
	{
		Load_FileRef
		if ( !f->isNull() && f->tag() )
		{
			Tag *tag = f->tag();

			title = tag->title();
			artist = tag->artist();
			album = tag->album();
			comment = tag->comment();
			genre = tag->genre();
			year = tag->year();
			track = tag->track();

			isNull = false;
		}
		delete f;
	}

	//ID3v2 picture
	if ( canWriteID3 )
	{
		Load_MPEG_File
		ID3v2::Tag *id3v2 = f->ID3v2Tag();
		if ( id3v2 && !id3v2->isEmpty() )
		{
			ID3v2::FrameList pict = id3v2->frameList( "APIC" );
			if ( !pict.isEmpty() )
			{
				picture = ID3v2::AttachedPictureFrame( pict.front()->render() ).picture();
				isNull = false;
			}
		}
		delete f;
	}

	//FLAC picture
	if ( isFLAC )
	{
		Load_FLAC_File
		if ( f->pictureList().size() )
		{
			FLAC::Picture *p = f->pictureList().front();
			if ( p )
			{
				picture = p->data();
				isNull = false;
			}
		}
		delete f;
	}
}
开发者ID:darwinbeing,项目名称:Hifi-Pod,代码行数:75,代码来源:struct.cpp


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