EbmlWriter.cpp revision 45aec286e984e04cde6ddea6b9eea66f113fc045
1N/A * Copyright (C) 2013-2014 Oracle Corporation 1N/A * This file is part of VirtualBox Open Source Edition (OSE), as 1N/A * you can redistribute it and/or modify it under the terms of the GNU 1N/A * General Public License (GPL) as published by the Free Software 1N/A * Foundation, in version 2 as it comes in the "COPYING" file of the 1N/A * VirtualBox OSE distribution. VirtualBox OSE is distributed in the 1N/A * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 1N/A * This code is based on: 1N/A * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 1N/A * Use of this source code is governed by a BSD-style license 1N/A * that can be found in the LICENSE file in the root of the source 1N/A * tree. An additional intellectual property rights grant can be found 1N/A * in the file PATENTS. All contributing project authors may 1N/A * be found in the AUTHORS file in the root of the source tree. 1N/A/* Matroska EBML Class IDs supported by WebM */ 1N/A //Meta Seek Information 1N/A //Segment Information 1N/A // SegmentUID = 0x73A4, 1N/A // SegmentFilename = 0x7384, 1N/A // PrevUID = 0x3CB923, 1N/A // PrevFilename = 0x3C83AB, 1N/A // NextUID = 0x3EB923, 1N/A // NextFilename = 0x3E83BB, 1N/A // SegmentFamily = 0x4444, 1N/A // ChapterTranslate = 0x6924, // ChapterTranslateEditionUID = 0x69FC, // ChapterTranslateCodec = 0x69BF, // ChapterTranslateID = 0x69A5, // SilentTracks = 0x5854, // SilentTrackNumber = 0x58D7, // BlockAdditions = 0x75A1, // BlockAdditional = 0xA5, // ReferencePriority = 0xFA, // ReferenceVirtual = 0xFD, // BlockAdditionID = 0xCB, // Cluster_Duration = 0xCF, // EncryptedBlock = 0xAF, // TrackTimecodeScale = 0x23314F, // MaxBlockAdditionID = 0x55EE, // AttachmentLink = 0x7446, // CodecSettings = 0x3A9697, // CodecInfoURL = 0x3B4040, // CodecDownloadURL = 0x26B240, // CodecDecodeAll = 0xAA, // TrackOverlay = 0x6FAB, // TrackTranslate = 0x6624, // TrackTranslateEditionUID = 0x66FC, // TrackTranslateCodec = 0x66BF, // TrackTranslateTrackID = 0x66A5, // ColourSpace = 0x2EB524, // GammaValue = 0x2FB523, // ChannelPositions = 0x7D7B, // ContentEncodings = 0x6d80, // ContentEncoding = 0x6240, // ContentEncodingOrder = 0x5031, // ContentEncodingScope = 0x5032, // ContentEncodingType = 0x5033, // ContentCompression = 0x5034, // ContentCompAlgo = 0x4254, // ContentCompSettings = 0x4255, // ContentEncryption = 0x5035, // ContentEncAlgo = 0x47e1, // ContentEncKeyID = 0x47e2, // ContentSignature = 0x47e3, // ContentSigKeyID = 0x47e4, // ContentSigAlgo = 0x47e5, // ContentSigHashAlgo = 0x47e6, // CueRefNumber = 0x535F, // CueRefCodecState = 0xEB, // Attachments = 0x1941A469, // AttachedFile = 0x61A7, // FileDescription = 0x467E, // FileMimeType = 0x4660, // FileReferral = 0x4675, // Chapters = 0x1043A770, // EditionEntry = 0x45B9, // EditionFlagHidden = 0x45BD, // EditionFlagDefault = 0x45DB, // EditionFlagOrdered = 0x45DD, // ChapterTimeStart = 0x91, // ChapterTimeEnd = 0x92, // ChapterFlagHidden = 0x98, // ChapterFlagEnabled = 0x4598, // ChapterSegmentUID = 0x6E67, // ChapterSegmentEditionUID = 0x6EBC, // ChapterPhysicalEquiv = 0x63C3, // ChapterTrackNumber = 0x89, // ChapterDisplay = 0x80, // ChapLanguage = 0x437C, // ChapProcessCodecID = 0x6955, // ChapProcessPrivate = 0x450D, // ChapProcessCommand = 0x6911, // ChapProcessTime = 0x6922, // ChapProcessData = 0x6933, // TargetTypeValue = 0x68CA, // Tagging_TrackUID = 0x63C5, // Tagging_EditionUID = 0x63C9, // Tagging_ChapterUID = 0x63C4, // AttachmentUID = 0x63C6, /* Creates EBML output file. */ /* Get reference to file descriptor */ /* Returns available space on storage. */ /* Starts an EBML sub-element. */ /* store the current file offset. */ /* Indicates that size of the element * is unkown (as according to EBML specs). /* Ends an EBML sub-element. */ /* Class ID on the top of the stack should match the class ID passed * to the function. Otherwise it may mean that we have a bug in the code. /* make sure that size will be serialized as uint64 */ /* Serializes a null-terminated string. */ /* Serializes an UNSIGNED integer * If size is zero then it will be detected automatically. */ /* Serializes a floating point value. * Only 8-bytes double precision values are supported /* Writes raw data to file. */ /* Writes an unsigned integer of variable of fixed size. */ /* convert to big-endian */ /* Writes EBML class ID to file. * EBML ID already has a UTF8-like represenation * so getSizeOfUInt is used to determine * the number of its bytes. /* Writes data size value. */ /* The following expression defines the size of the value that will be serialized * as an EBML UTF-8 like integer (with trailing bits represeting its size): 1xxx xxxx - value 0 to 2^7-2 01xx xxxx xxxx xxxx - value 0 to 2^14-2 001x xxxx xxxx xxxx xxxx xxxx - value 0 to 2^21-2 0001 xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^28-2 0000 1xxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^35-2 0000 01xx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^42-2 0000 001x xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^49-2 0000 0001 xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^56-2 /* One is subtracted in order to avoid loosing significant bit when size = 8. */ /* Size calculation for variable size UNSIGNED integer. * The function defines the size of the number by trimming * consequent trailing zero bytes starting from the most significant. * The following statement is always true: * 1 <= getSizeOfUInt(arg) <= 8. * Every !(arg & (UINT64_MAX << X)) expression gives one * if an only if all the bits from X to 63 are set to zero. void operator=(
const Ebml &);
/* Calculate the PTS of this frame in milliseconds */ /* Calculate the relative time of this block */ /* Save a cue point if this is a keyframe. */ /* Write a Simple Block */