本文整理汇总了C++中mp4::File::readBlock方法的典型用法代码示例。如果您正苦于以下问题:C++ File::readBlock方法的具体用法?C++ File::readBlock怎么用?C++ File::readBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mp4::File
的用法示例。
在下文中一共展示了File::readBlock方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testUpdateStco
void testUpdateStco()
{
string filename = copyFile("no-tags", ".3g2");
MP4::File *f = new MP4::File(filename.c_str());
f->tag()->setArtist(ByteVector(3000, 'x'));
ByteVectorList data1;
{
MP4::Atoms a(f);
MP4::Atom *stco = a.find("moov")->findall("stco", true)[0];
f->seek(stco->offset + 12);
ByteVector data = f->readBlock(stco->length - 12);
unsigned int count = data.mid(0, 4).toUInt();
int pos = 4;
while (count--) {
unsigned int offset = data.mid(pos, 4).toUInt();
f->seek(offset);
data1.append(f->readBlock(20));
pos += 4;
}
}
f->save();
delete f;
f = new MP4::File(filename.c_str());
{
MP4::Atoms a(f);
MP4::Atom *stco = a.find("moov")->findall("stco", true)[0];
f->seek(stco->offset + 12);
ByteVector data = f->readBlock(stco->length - 12);
unsigned int count = data.mid(0, 4).toUInt();
int pos = 4, i = 0;
while (count--) {
unsigned int offset = data.mid(pos, 4).toUInt();
f->seek(offset);
CPPUNIT_ASSERT_EQUAL(data1[i], f->readBlock(20));
pos += 4;
i++;
}
}
delete f;
deleteFile(filename);
}