コード例 #1
0
//------------------------------------------------------------------
void Ebml_StartSubElement(EbmlGlobal *global, off_t *ebmlLoc, unsigned int class_id)
{
	const uint64_t kEbmlUnknownLength = LITERALU64(0x01FFFFFF, 0xFFFFFFFF);
	Ebml_WriteID(global, class_id);
	*ebmlLoc = ftello(global->stream);
	Ebml_Serialize(global, &kEbmlUnknownLength, sizeof(kEbmlUnknownLength), 8);
}
コード例 #2
0
ファイル: webmenc.c プロジェクト: Brainiarc7/libvpx
static void Ebml_EndSubElement(struct EbmlGlobal *glob, EbmlLoc *ebmlLoc) {
  off_t pos;
  uint64_t size;

  /* Save the current stream pointer. */
  pos = ftello(glob->stream);

  /* Calculate the size of this element. */
  size = pos - *ebmlLoc - 8;
  size |= LITERALU64(0x01000000, 0x00000000);

  /* Seek back to the beginning of the element and write the new size. */
  fseeko(glob->stream, *ebmlLoc, SEEK_SET);
  Ebml_Serialize(glob, &size, sizeof(size), 8);

  /* Reset the stream pointer. */
  fseeko(glob->stream, pos, SEEK_SET);
}