1 /*
2  * Copyright (C) 2014 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef WEBMCONSTANTS_H_
18 #define WEBMCONSTANTS_H_
19 
20 #include <stdint.h>
21 
22 namespace webm {
23 
24 const int kMinEbmlVoidSize = 2;
25 const int64_t kMaxMetaSeekSize = 64;
26 const int64_t kMkvUnknownLength = 0x01ffffffffffffffl;
27 
28 // EBML element id's from http://matroska.org/technical/specs/index.html
29 enum Mkv {
30     kMkvEbml = 0x1A45DFA3,
31     kMkvEbmlVersion = 0x4286,
32     kMkvEbmlReadVersion = 0x42F7,
33     kMkvEbmlMaxIdlength = 0x42F2,
34     kMkvEbmlMaxSizeLength = 0x42F3,
35     kMkvDocType = 0x4282,
36     kMkvDocTypeVersion = 0x4287,
37     kMkvDocTypeReadVersion = 0x4285,
38     kMkvVoid = 0xEC,
39     kMkvSignatureSlot = 0x1B538667,
40     kMkvSignatureAlgo = 0x7E8A,
41     kMkvSignatureHash = 0x7E9A,
42     kMkvSignaturePublicKey = 0x7EA5,
43     kMkvSignature = 0x7EB5,
44     kMkvSignatureElements = 0x7E5B,
45     kMkvSignatureElementList = 0x7E7B,
46     kMkvSignedElement = 0x6532,
47     kMkvSegment = 0x18538067,
48     kMkvSeekHead = 0x114D9B74,
49     kMkvSeek = 0x4DBB,
50     kMkvSeekId = 0x53AB,
51     kMkvSeekPosition = 0x53AC,
52     kMkvInfo = 0x1549A966,
53     kMkvTimecodeScale = 0x2AD7B1,
54     kMkvSegmentDuration = 0x4489,
55     kMkvDateUtc = 0x4461,
56     kMkvMuxingApp = 0x4D80,
57     kMkvWritingApp = 0x5741,
58     kMkvCluster = 0x1F43B675,
59     kMkvTimecode = 0xE7,
60     kMkvPrevSize = 0xAB,
61     kMkvBlockGroup = 0xA0,
62     kMkvBlock = 0xA1,
63     kMkvBlockAdditions = 0x75A1,
64     kMkvBlockMore = 0xA6,
65     kMkvBlockAddId = 0xEE,
66     kMkvBlockAdditional = 0xA5,
67     kMkvBlockDuration = 0x9B,
68     kMkvReferenceBlock = 0xFB,
69     kMkvLaceNumber = 0xCC,
70     kMkvSimpleBlock = 0xA3,
71     kMkvTracks = 0x1654AE6B,
72     kMkvTrackEntry = 0xAE,
73     kMkvTrackNumber = 0xD7,
74     kMkvTrackUid = 0x73C5,
75     kMkvTrackType = 0x83,
76     kMkvFlagEnabled = 0xB9,
77     kMkvFlagDefault = 0x88,
78     kMkvFlagForced = 0x55AA,
79     kMkvFlagLacing = 0x9C,
80     kMkvDefaultDuration = 0x23E383,
81     kMkvMaxBlockAdditionId = 0x55EE,
82     kMkvName = 0x536E,
83     kMkvLanguage = 0x22B59C,
84     kMkvCodecId = 0x86,
85     kMkvCodecPrivate = 0x63A2,
86     kMkvCodecName = 0x258688,
87     kMkvVideo = 0xE0,
88     kMkvFlagInterlaced = 0x9A,
89     kMkvStereoMode = 0x53B8,
90     kMkvAlphaMode = 0x53C0,
91     kMkvPixelWidth = 0xB0,
92     kMkvPixelHeight = 0xBA,
93     kMkvPixelCropBottom = 0x54AA,
94     kMkvPixelCropTop = 0x54BB,
95     kMkvPixelCropLeft = 0x54CC,
96     kMkvPixelCropRight = 0x54DD,
97     kMkvDisplayWidth = 0x54B0,
98     kMkvDisplayHeight = 0x54BA,
99     kMkvDisplayUnit = 0x54B2,
100     kMkvAspectRatioType = 0x54B3,
101     kMkvColour = 0x55B0,
102     kMkvMatrixCoefficients = 0x55B1,
103     kMkvRange = 0x55B9,
104     kMkvTransferCharacteristics = 0x55BA,
105     kMkvPrimaries = 0x55BB,
106     kMkvMaxCLL = 0x55BC,
107     kMkvMaxFALL = 0x55BD,
108     kMkvMasteringMetadata = 0x55D0,
109     kMkvPrimaryRChromaticityX = 0x55D1,
110     kMkvPrimaryRChromaticityY = 0x55D2,
111     kMkvPrimaryGChromaticityX = 0x55D3,
112     kMkvPrimaryGChromaticityY = 0x55D4,
113     kMkvPrimaryBChromaticityX = 0x55D5,
114     kMkvPrimaryBChromaticityY = 0x55D6,
115     kMkvWhitePointChromaticityX = 0x55D7,
116     kMkvWhitePointChromaticityY = 0x55D8,
117     kMkvLuminanceMax = 0x55D9,
118     kMkvLuminanceMin = 0x55DA,
119     kMkvFrameRate = 0x2383E3,
120     kMkvAudio = 0xE1,
121     kMkvSamplingFrequency = 0xB5,
122     kMkvOutputSamplingFrequency = 0x78B5,
123     kMkvChannels = 0x9F,
124     kMkvBitDepth = 0x6264,
125     kMkvCues = 0x1C53BB6B,
126     kMkvCuePoint = 0xBB,
127     kMkvCueTime = 0xB3,
128     kMkvCueTrackPositions = 0xB7,
129     kMkvCueTrack = 0xF7,
130     kMkvCueClusterPosition = 0xF1,
131     kMkvCueBlockNumber = 0x5378
132 };
133 
134 enum TrackTypes {
135     kInvalidType = -1,
136     kVideoType = 0x1,
137     kAudioType = 0x2,
138     kComplexType = 0x3,
139     kLogoType = 0x10,
140     kSubtitleType = 0x11,
141     kButtonsType = 0x12,
142     kControlType = 0x20
143 };
144 
145 enum TrackNum {
146     kVideoTrackNum = 0x1,
147     kAudioTrackNum = 0x2
148 };
149 }
150 
151 #endif /* WEBMCONSTANTS_H_ */
152