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     kMkvFrameRate = 0x2383E3,
102     kMkvAudio = 0xE1,
103     kMkvSamplingFrequency = 0xB5,
104     kMkvOutputSamplingFrequency = 0x78B5,
105     kMkvChannels = 0x9F,
106     kMkvBitDepth = 0x6264,
107     kMkvCues = 0x1C53BB6B,
108     kMkvCuePoint = 0xBB,
109     kMkvCueTime = 0xB3,
110     kMkvCueTrackPositions = 0xB7,
111     kMkvCueTrack = 0xF7,
112     kMkvCueClusterPosition = 0xF1,
113     kMkvCueBlockNumber = 0x5378
114 };
115 
116 enum TrackTypes {
117     kInvalidType = -1,
118     kVideoType = 0x1,
119     kAudioType = 0x2,
120     kComplexType = 0x3,
121     kLogoType = 0x10,
122     kSubtitleType = 0x11,
123     kButtonsType = 0x12,
124     kControlType = 0x20
125 };
126 
127 enum TrackNum {
128     kVideoTrackNum = 0x1,
129     kAudioTrackNum = 0x2
130 };
131 }
132 
133 #endif /* WEBMCONSTANTS_H_ */
134