shithub: mcfs

ref: 74533c8ff1ab84ff0949d52c3726ccfcfc1bf76a
dir: /ebml.h/

View raw version
typedef struct Elspec Elspec;

struct Elspec {
	vlong id;
	char *name;
	int type;
};

enum {
	/* ebml element value types */
	Eunknown,
	Emaster,
	Ebinary,
	Efloat,
	Eunsigned,
	Esigned,
	Eunicode,
	Eascii,
	Etimestamp,

	/* known track types */
	Etrackvideo = 1,
	Etrackaudio = 2,
	Etrackcomplex = 3,
	Etracklogo = 16,
	Etracksubtitles = 17,
	Etrackbuttons = 18,
	Etrackcontrol = 32,
	Etrackmetadata = 33,

	/* ids */
	EChapterDisplay = 0x80,
	ETrackType = 0x83,
	EChapString = 0x85,
	ECodecID = 0x86,
	EFlagDefault = 0x88,
	EChapterTrackUID = 0x89,
	ESlices = 0x8e,
	EChapterTrack = 0x8f,
	EChapterTimeStart = 0x91,
	EChapterTimeEnd = 0x92,
	ECueRefTime = 0x96,
	ECueRefCluster = 0x97,
	EChapterFlagHidden = 0x98,
	EFlagInterlaced = 0x9a,
	EBlockDuration = 0x9b,
	EFlagLacing = 0x9c,
	EFieldOrder = 0x9d,
	EChannels = 0x9f,
	EBlockGroup = 0xa0,
	EBlock = 0xa1,
	EBlockVirtual = 0xa2,
	ESimpleBlock = 0xa3,
	ECodecState = 0xa4,
	EBlockAdditional = 0xa5,
	EBlockMore = 0xa6,
	EPosition = 0xa7,
	ECodecDecodeAll = 0xaa,
	EPrevSize = 0xab,
	ETrackEntry = 0xae,
	EEncryptedBlock = 0xaf,
	EPixelWidth = 0xb0,
	ECueDuration = 0xb2,
	ECueTime = 0xb3,
	ESamplingFrequency = 0xb5,
	EChapterAtom = 0xb6,
	ECueTrackPositions = 0xb7,
	EFlagEnabled = 0xb9,
	EPixelHeight = 0xba,
	ECuePoint = 0xbb,
	ECRC32 = 0xbf,
	EReferenceFrame = 0xc8,
	EReferenceOffset = 0xc9,
	EReferenceTimestamp = 0xca,
	EBlockAdditionID = 0xcb,
	ELaceNumber = 0xcc,
	EFrameNumber = 0xcd,
	EDelay = 0xce,
	ESliceDuration = 0xcf,
	ETrackNumber = 0xd7,
	ECueReference = 0xdb,
	EVideo = 0xe0,
	EAudio = 0xe1,
	ETrackOperation = 0xe2,
	ETrackCombinePlanes = 0xe3,
	ETrackPlane = 0xe4,
	ETrackPlaneUID = 0xe5,
	ETrackPlaneType = 0xe6,
	ETimestamp = 0xe7,
	ETimeSlice = 0xe8,
	ETrackJoinBlocks = 0xe9,
	ECueCodecState = 0xea,
	ECueRefCodecState = 0xeb,
	EVoid = 0xec,
	ETrackJoinUID = 0xed,
	EBlockAddID = 0xee,
	ECueRelativePosition = 0xf0,
	ECueClusterPosition = 0xf1,
	ECueTrack = 0xf7,
	EReferencePriority = 0xfa,
	EReferenceBlock = 0xfb,
	EReferenceVirtual = 0xfd,
	EBlockAddIDName = 0x41a4,
	EBlockAdditionMapping = 0x41e4,
	EBlockAddIDType = 0x41e7,
	EBlockAddIDExtraData = 0x41ed,
	EBlockAddIDValue = 0x41f0,
	EContentCompAlgo = 0x4254,
	EContentCompSettings = 0x4255,
	EDocTypeExtension = 0x4281,
	EDocType = 0x4282,
	EDocTypeExtensionName = 0x4283,
	EDocTypeExtensionVersion = 0x4284,
	EDocTypeReadVersion = 0x4285,
	EEBMLVersion = 0x4286,
	EDocTypeVersion = 0x4287,
	EEBMLMaxIDLength = 0x42f2,
	EEBMLMaxSizeLength = 0x42f3,
	EEBMLReadVersion = 0x42f7,
	EChapLanguage = 0x437c,
	EChapLanguageIETF = 0x437d,
	EChapCountry = 0x437e,
	ESegmentFamily = 0x4444,
	EDateUTC = 0x4461,
	ETagLanguage = 0x447a,
	ETagLanguageIETF = 0x447b,
	ETagDefault = 0x4484,
	ETagBinary = 0x4485,
	ETagString = 0x4487,
	EDuration = 0x4489,
	EChapProcessPrivate = 0x450d,
	EChapterFlagEnabled = 0x4598,
	ETagName = 0x45a3,
	EEditionEntry = 0x45b9,
	EEditionUID = 0x45bc,
	EEditionFlagHidden = 0x45bd,
	EEditionFlagDefault = 0x45db,
	EEditionFlagOrdered = 0x45dd,
	EFileData = 0x465c,
	EFileMimeType = 0x4660,
	EFileUsedStartTime = 0x4661,
	EFileUsedEndTime = 0x4662,
	EFileName = 0x466e,
	EFileReferral = 0x4675,
	EFileDescription = 0x467e,
	EFileUID = 0x46ae,
	EContentEncAlgo = 0x47e1,
	EContentEncKeyID = 0x47e2,
	EContentSignature = 0x47e3,
	EContentSigKeyID = 0x47e4,
	EContentSigAlgo = 0x47e5,
	EContentSigHashAlgo = 0x47e6,
	EContentAESSettings = 0x47e7,
	EAESSettingsCipherMode = 0x47e8,
	EMuxingApp = 0x4d80,
	ESeek = 0x4dbb,
	EContentEncodingOrder = 0x5031,
	EContentEncodingScope = 0x5032,
	EContentEncodingType = 0x5033,
	EContentCompression = 0x5034,
	EContentEncryption = 0x5035,
	ECueRefNumber = 0x535f,
	EName = 0x536e,
	ECueBlockNumber = 0x5378,
	ETrackOffset = 0x537f,
	ESeekID = 0x53ab,
	ESeekPosition = 0x53ac,
	EStereoMode = 0x53b8,
	EOldStereoMode = 0x53b9,
	EAlphaMode = 0x53c0,
	EPixelCropBottom = 0x54aa,
	EDisplayWidth = 0x54b0,
	EDisplayUnit = 0x54b2,
	EAspectRatioType = 0x54b3,
	EDisplayHeight = 0x54ba,
	EPixelCropTop = 0x54bb,
	EPixelCropLeft = 0x54cc,
	EPixelCropRight = 0x54dd,
	EFlagForced = 0x55aa,
	EColour = 0x55b0,
	EMatrixCoefficients = 0x55b1,
	EBitsPerChannel = 0x55b2,
	EChromaSubsamplingHorz = 0x55b3,
	EChromaSubsamplingVert = 0x55b4,
	ECbSubSamplingHorz = 0x55b5,
	ECbSubSamplingVert = 0x55b6,
	EChromaSitingHorz = 0x55b7,
	EChromaSitingVert = 0x55b8,
	ERange = 0x55b9,
	ETransferCharacteristics = 0x55ba,
	EPrimaries = 0x55bb,
	EMaxCLL = 0x55bc,
	EMaxFALL = 0x55bd,
	EMasteringMetadata = 0x55d0,
	EPrimaryRChromaticityX = 0x55d1,
	EPrimaryRChromaticityY = 0x55d2,
	EPrimaryGChromaticityX = 0x55d3,
	EPrimaryGChromaticityY = 0x55d4,
	EPrimaryBChromaticityX = 0x55d5,
	EPrimaryBChromaticityY = 0x55d6,
	EWhitePointChromaticityX = 0x55d7,
	EWhitePointChromaticityY = 0x55d8,
	ELuminanceMax = 0x55d9,
	ELuminanceMin = 0x55da,
	EMaxBlockAdditionID = 0x55ee,
	EChapterStringUID = 0x5654,
	ECodecDelay = 0x56aa,
	ESeekPreRoll = 0x56bb,
	EWritingApp = 0x5741,
	ESilentTracks = 0x5854,
	ESilentTrackNumber = 0x58d7,
	EAttachedFile = 0x61a7,
	EContentEncoding = 0x6240,
	EBitDepth = 0x6264,
	ECodecPrivate = 0x63a2,
	ETargets = 0x63c0,
	EChapterPhysicalEquiv = 0x63c3,
	ETagChapterUID = 0x63c4,
	ETagTrackUID = 0x63c5,
	ETagAttachmentUID = 0x63c6,
	ETagEditionUID = 0x63c9,
	ETargetType = 0x63ca,
	ETrackTranslate = 0x6624,
	ETrackTranslateTrackID = 0x66a5,
	ETrackTranslateCodec = 0x66bf,
	ETrackTranslateEditionUID = 0x66fc,
	ESimpleTag = 0x67c8,
	ETargetTypeValue = 0x68ca,
	EChapProcessCommand = 0x6911,
	EChapProcessTime = 0x6922,
	EChapterTranslate = 0x6924,
	EChapProcessData = 0x6933,
	EChapProcess = 0x6944,
	EChapProcessCodecID = 0x6955,
	EChapterTranslateID = 0x69a5,
	EChapterTranslateCodec = 0x69bf,
	EChapterTranslateEditionUID = 0x69fc,
	EContentEncodings = 0x6d80,
	EMinCache = 0x6de7,
	EMaxCache = 0x6df8,
	EChapterSegmentUID = 0x6e67,
	EChapterSegmentEditionUID = 0x6ebc,
	ETrackOverlay = 0x6fab,
	ETag = 0x7373,
	ESegmentFilename = 0x7384,
	ESegmentUID = 0x73a4,
	EChapterUID = 0x73c4,
	ETrackUID = 0x73c5,
	EAttachmentLink = 0x7446,
	EBlockAdditions = 0x75a1,
	EDiscardPadding = 0x75a2,
	EProjection = 0x7670,
	EProjectionType = 0x7671,
	EProjectionPrivate = 0x7672,
	EProjectionPoseYaw = 0x7673,
	EProjectionPosePitch = 0x7674,
	EProjectionPoseRoll = 0x7675,
	EOutputSamplingFrequency = 0x78b5,
	ETitle = 0x7ba9,
	EChannelPositions = 0x7d7b,
	ELanguage = 0x22b59c,
	ELanguageIETF = 0x22b59d,
	ETrackTimestampScale = 0x23314f,
	EDefaultDecodedFieldDuration = 0x234e7a,
	EFrameRate = 0x2383e3,
	EDefaultDuration = 0x23e383,
	ECodecName = 0x258688,
	ECodecDownloadURL = 0x26b240,
	ETimestampScale = 0x2ad7b1,
	EColourSpace = 0x2eb524,
	EGammaValue = 0x2fb523,
	ECodecSettings = 0x3a9697,
	ECodecInfoURL = 0x3b4040,
	EPrevFilename = 0x3c83ab,
	EPrevUID = 0x3cb923,
	ENextFilename = 0x3e83bb,
	ENextUID = 0x3eb923,
	EChapters = 0x1043a770,
	ESeekHead = 0x114d9b74,
	ETags = 0x1254c367,
	EInfo = 0x1549a966,
	ETracks = 0x1654ae6b,
	ESegment = 0x18538067,
	EAttachments = 0x1941a469,
	EEBML = 0x1a45dfa3,
	ECues = 0x1c53bb6b,
	ECluster = 0x1f43b675,
};

int ebmluintb(u8int *b, vlong sz, vlong *out);
int ebmlsintb(u8int *b, vlong sz, vlong *out);
int ebmluint(Biobuf *f, vlong sz, vlong *out);
int ebmlsint(Biobuf *f, vlong sz, vlong *out);
int ebmlfloat(Biobuf *f, vlong sz, double *out);
vlong ebmlel(Biobuf *f, vlong sz, Elspec *el, vlong *esz);
vlong ebmlrawuint(Biobuf *f, vlong sz, vlong *dst);
vlong ebmlrawsint(Biobuf *f, vlong sz, vlong *dst);
char *ebmltracktype(int t);