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


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

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


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

示例1: testCovrWrite

  void testCovrWrite()
  {
    ScopedFileCopy copy("has-tags", ".m4a");
    string filename = copy.fileName();

    MP4::File *f = new MP4::File(filename.c_str());
    CPPUNIT_ASSERT(f->tag()->contains("covr"));
    MP4::CoverArtList l = f->tag()->item("covr").toCoverArtList();
    l.append(MP4::CoverArt(MP4::CoverArt::PNG, "foo"));
    f->tag()->setItem("covr", l);
    f->save();
    delete f;

    f = new MP4::File(filename.c_str());
    CPPUNIT_ASSERT(f->tag()->contains("covr"));
    l = f->tag()->item("covr").toCoverArtList();
    CPPUNIT_ASSERT_EQUAL(TagLib::uint(3), l.size());
    CPPUNIT_ASSERT_EQUAL(MP4::CoverArt::PNG, l[0].format());
    CPPUNIT_ASSERT_EQUAL(TagLib::uint(79), l[0].data().size());
    CPPUNIT_ASSERT_EQUAL(MP4::CoverArt::JPEG, l[1].format());
    CPPUNIT_ASSERT_EQUAL(TagLib::uint(287), l[1].data().size());
    CPPUNIT_ASSERT_EQUAL(MP4::CoverArt::PNG, l[2].format());
    CPPUNIT_ASSERT_EQUAL(TagLib::uint(3), l[2].data().size());
    delete f;
  }
开发者ID:gogglesmm,项目名称:taglib,代码行数:25,代码来源:test_mp4.cpp

示例2: 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.size() > 0)
    addItem(atom->name, value);
}
开发者ID:ConfusedGiant,项目名称:Clementine,代码行数:32,代码来源:mp4tag.cpp

示例3: testCovrWrite

  void testCovrWrite()
  {
    string filename = copyFile("has-tags", ".m4a");

    MP4::File *f = new MP4::File(filename.c_str());
    CPPUNIT_ASSERT(f->tag()->itemListMap().contains("covr"));
    MP4::CoverArtList l = f->tag()->itemListMap()["covr"].toCoverArtList();
    l.append(MP4::CoverArt(MP4::CoverArt::PNG, "foo"));
    f->tag()->itemListMap()["covr"] = l;
    f->save();
    delete f;

    f = new MP4::File(filename.c_str());
    CPPUNIT_ASSERT(f->tag()->itemListMap().contains("covr"));
    l = f->tag()->itemListMap()["covr"].toCoverArtList();
    CPPUNIT_ASSERT_EQUAL(TagLib::uint(3), l.size());
    CPPUNIT_ASSERT_EQUAL(MP4::CoverArt::PNG, l[0].format());
    CPPUNIT_ASSERT_EQUAL(TagLib::uint(79), l[0].data().size());
    CPPUNIT_ASSERT_EQUAL(MP4::CoverArt::JPEG, l[1].format());
    CPPUNIT_ASSERT_EQUAL(TagLib::uint(287), l[1].data().size());
    CPPUNIT_ASSERT_EQUAL(MP4::CoverArt::PNG, l[2].format());
    CPPUNIT_ASSERT_EQUAL(TagLib::uint(3), l[2].data().size());
    delete f;

    deleteFile(filename);
  }
开发者ID:ABuus,项目名称:partyplayer,代码行数:26,代码来源:test_mp4.cpp

示例4: renderAtom

ByteVector
MP4::Tag::renderCovr(const ByteVector &name, const MP4::Item &item) const
{
  ByteVector data;
  MP4::CoverArtList value = item.toCoverArtList();
  for(unsigned int i = 0; i < value.size(); i++) {
    data.append(renderAtom("data", ByteVector::fromUInt(value[i].format()) +
                                   ByteVector(4, '\0') + value[i].data()));
  }
  return renderAtom(name, data);
}
开发者ID:ConfusedGiant,项目名称:Clementine,代码行数:11,代码来源:mp4tag.cpp

示例5: testCovrRead

 void testCovrRead()
 {
   MP4::File *f = new MP4::File("data/has-tags.m4a");
   CPPUNIT_ASSERT(f->tag()->itemListMap().contains("covr"));
   MP4::CoverArtList l = f->tag()->itemListMap()["covr"].toCoverArtList();
   CPPUNIT_ASSERT_EQUAL(TagLib::uint(2), l.size());
   CPPUNIT_ASSERT_EQUAL(MP4::CoverArt::PNG, l[0].format());
   CPPUNIT_ASSERT_EQUAL(TagLib::uint(79), l[0].data().size());
   CPPUNIT_ASSERT_EQUAL(MP4::CoverArt::JPEG, l[1].format());
   CPPUNIT_ASSERT_EQUAL(TagLib::uint(287), l[1].data().size());
 }
开发者ID:ABuus,项目名称:partyplayer,代码行数:11,代码来源:test_mp4.cpp

示例6:

 void testCovrRead2()
 {
   MP4::File *f = new MP4::File(TEST_FILE_PATH_C("covr-junk.m4a"));
   CPPUNIT_ASSERT(f->tag()->contains("covr"));
   MP4::CoverArtList l = f->tag()->item("covr").toCoverArtList();
   CPPUNIT_ASSERT_EQUAL(TagLib::uint(2), l.size());
   CPPUNIT_ASSERT_EQUAL(MP4::CoverArt::PNG, l[0].format());
   CPPUNIT_ASSERT_EQUAL(TagLib::uint(79), l[0].data().size());
   CPPUNIT_ASSERT_EQUAL(MP4::CoverArt::JPEG, l[1].format());
   CPPUNIT_ASSERT_EQUAL(TagLib::uint(287), l[1].data().size());
   delete f;
 }
开发者ID:gogglesmm,项目名称:taglib,代码行数:12,代码来源:test_mp4.cpp

示例7: while

void
MP4::Tag::parseCovr(MP4::Atom *atom, TagLib::File *file)
{
  MP4::CoverArtList value;
  ByteVector data = file->readBlock(atom->length - 8);
  unsigned int pos = 0;
  while(pos < data.size()) {
    int length = data.mid(pos, 4).toUInt();
    ByteVector name = data.mid(pos + 4, 4);
    int flags = data.mid(pos + 8, 4).toUInt();
    if(name != "data") {
      debug("MP4: Unexpected atom \"" + name + "\", expecting \"data\"");
      return;
    }
    if(flags == MP4::CoverArt::PNG || flags == MP4::CoverArt::JPEG) {
      value.append(MP4::CoverArt(MP4::CoverArt::Format(flags),
                                 data.mid(pos + 16, length - 16)));
    }
    pos += length;
  }
  if(value.size() > 0)
    d->items.insert(atom->name, value);
}
开发者ID:ABuus,项目名称:partyplayer,代码行数:23,代码来源:mp4tag.cpp

示例8: while

void
MP4::Tag::parseCovr(MP4::Atom *atom, TagLib::File *file)
{
  MP4::CoverArtList value;
  ByteVector data = file->readBlock(atom->length - 8);
  unsigned int pos = 0;
  while(pos < data.size()) {
    int length = data.mid(pos, 4).toUInt();
    ByteVector name = data.mid(pos + 4, 4);
    int flags = data.mid(pos + 8, 4).toUInt();
    if(name != "data") {
      debug("MP4: Unexpected atom \"" + name + "\", expecting \"data\"");
      break;
    }
	if (flags == 0) { //detect cover format when the cover format bytes are not set
		ByteVector picHeader = data.mid(pos+16,9);
		const char jpeg[] = {0xff, 0xd8, 0xff, 0xe0 };
		const char jfif[] = {0x10, 0x4a, 0x46, 0x49, 0x46 };
		const char png[] = {0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00 };
		if ((memcmp(picHeader.data(), png, 9) == 0)) {
			flags = MP4::CoverArt::PNG;
		} else if ((memcmp(picHeader.data(), jpeg, 4) == 0)) {
			flags = MP4::CoverArt::JPEG;
		} else if ((memcmp(picHeader.data(), jfif, 5) == 0)) {
			flags = MP4::CoverArt::JPEG;
		}
	}
    if(flags == MP4::CoverArt::PNG || flags == MP4::CoverArt::JPEG || flags == 0) {
      value.append(MP4::CoverArt(MP4::CoverArt::Format(flags),
                                 data.mid(pos + 16, length - 16)));
    }
    pos += length;
  }
  if(value.size() > 0)
    d->items.insert(atom->name, value);
}
开发者ID:avuserow,项目名称:taglib,代码行数:36,代码来源:mp4tag.cpp


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