1 | /********** |
2 | This library is free software; you can redistribute it and/or modify it under |
3 | the terms of the GNU Lesser General Public License as published by the |
4 | Free Software Foundation; either version 3 of the License, or (at your |
5 | option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.) |
6 | |
7 | This library is distributed in the hope that it will be useful, but WITHOUT |
8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for |
10 | more details. |
11 | |
12 | You should have received a copy of the GNU Lesser General Public License |
13 | along with this library; if not, write to the Free Software Foundation, Inc., |
14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
15 | **********/ |
16 | // "liveMedia" |
17 | // Copyright (c) 1996-2020 Live Networks, Inc. All rights reserved. |
18 | // EBML numbers (ids and sizes) |
19 | // C++ header |
20 | |
21 | #ifndef _EBML_NUMBER_HH |
22 | #define _EBML_NUMBER_HH |
23 | |
24 | #include "NetCommon.h" |
25 | #include "Boolean.hh" |
26 | #include <stdio.h> |
27 | |
28 | #define EBML_NUMBER_MAX_LEN 8 |
29 | |
30 | class EBMLNumber { |
31 | public: |
32 | EBMLNumber(Boolean stripLeading1 = True); |
33 | virtual ~EBMLNumber(); |
34 | |
35 | u_int64_t val() const; |
36 | char* hexString() const; // used for debugging |
37 | Boolean operator==(u_int64_t arg2) const { return val() == arg2; } |
38 | Boolean operator!=(u_int64_t arg2) const { return !(*this == arg2); } |
39 | |
40 | public: |
41 | Boolean stripLeading1; |
42 | unsigned len; |
43 | u_int8_t data[EBML_NUMBER_MAX_LEN]; |
44 | }; |
45 | |
46 | // Definitions of some Matroska/EBML IDs (including the ones that we check for): |
47 | #define MATROSKA_ID_EBML 0x1A45DFA3 |
48 | #define MATROSKA_ID_VOID 0xEC |
49 | #define MATROSKA_ID_CRC_32 0xBF |
50 | #define MATROSKA_ID_SEGMENT 0x18538067 |
51 | #define MATROSKA_ID_SEEK_HEAD 0x114D9B74 |
52 | #define MATROSKA_ID_SEEK 0x4DBB |
53 | #define MATROSKA_ID_SEEK_ID 0x53AB |
54 | #define MATROSKA_ID_SEEK_POSITION 0x53AC |
55 | #define MATROSKA_ID_INFO 0x1549A966 |
56 | #define MATROSKA_ID_SEGMENT_UID 0x73A4 |
57 | #define MATROSKA_ID_TIMECODE_SCALE 0x2AD7B1 |
58 | #define MATROSKA_ID_DURATION 0x4489 |
59 | #define MATROSKA_ID_DATE_UTC 0x4461 |
60 | #define MATROSKA_ID_TITLE 0x7BA9 |
61 | #define MATROSKA_ID_MUXING_APP 0x4D80 |
62 | #define MATROSKA_ID_WRITING_APP 0x5741 |
63 | #define MATROSKA_ID_CLUSTER 0x1F43B675 |
64 | #define MATROSKA_ID_TIMECODE 0xE7 |
65 | #define MATROSKA_ID_POSITION 0xA7 |
66 | #define MATROSKA_ID_PREV_SIZE 0xAB |
67 | #define MATROSKA_ID_SIMPLEBLOCK 0xA3 |
68 | #define MATROSKA_ID_BLOCK_GROUP 0xA0 |
69 | #define MATROSKA_ID_BLOCK 0xA1 |
70 | #define MATROSKA_ID_BLOCK_DURATION 0x9B |
71 | #define MATROSKA_ID_REFERENCE_BLOCK 0xFB |
72 | #define MATROSKA_ID_TRACKS 0x1654AE6B |
73 | #define MATROSKA_ID_TRACK_ENTRY 0xAE |
74 | #define MATROSKA_ID_TRACK_NUMBER 0xD7 |
75 | #define MATROSKA_ID_TRACK_UID 0x73C5 |
76 | #define MATROSKA_ID_TRACK_TYPE 0x83 |
77 | #define MATROSKA_ID_FLAG_ENABLED 0xB9 |
78 | #define MATROSKA_ID_FLAG_DEFAULT 0x88 |
79 | #define MATROSKA_ID_FLAG_FORCED 0x55AA |
80 | #define MATROSKA_ID_FLAG_LACING 0x9C |
81 | #define MATROSKA_ID_MIN_CACHE 0x6DE7 |
82 | #define MATROSKA_ID_DEFAULT_DURATION 0x23E383 |
83 | #define MATROSKA_ID_TRACK_TIMECODE_SCALE 0x23314F |
84 | #define MATROSKA_ID_MAX_BLOCK_ADDITION_ID 0x55EE |
85 | #define MATROSKA_ID_NAME 0x536E |
86 | #define MATROSKA_ID_LANGUAGE 0x22B59C |
87 | #define MATROSKA_ID_CODEC 0x86 |
88 | #define MATROSKA_ID_CODEC_PRIVATE 0x63A2 |
89 | #define MATROSKA_ID_CODEC_NAME 0x258688 |
90 | #define MATROSKA_ID_CODEC_DECODE_ALL 0xAA |
91 | #define MATROSKA_ID_VIDEO 0xE0 |
92 | #define MATROSKA_ID_FLAG_INTERLACED 0x9A |
93 | #define MATROSKA_ID_PIXEL_WIDTH 0xB0 |
94 | #define MATROSKA_ID_PIXEL_HEIGHT 0xBA |
95 | #define MATROSKA_ID_DISPLAY_WIDTH 0x54B0 |
96 | #define MATROSKA_ID_DISPLAY_HEIGHT 0x54BA |
97 | #define MATROSKA_ID_DISPLAY_UNIT 0x54B2 |
98 | #define MATROSKA_ID_AUDIO 0xE1 |
99 | #define MATROSKA_ID_SAMPLING_FREQUENCY 0xB5 |
100 | #define MATROSKA_ID_OUTPUT_SAMPLING_FREQUENCY 0x78B5 |
101 | #define MATROSKA_ID_CHANNELS 0x9F |
102 | #define MATROSKA_ID_BIT_DEPTH 0x6264 |
103 | #define MATROSKA_ID_CONTENT_ENCODINGS 0x6D80 |
104 | #define MATROSKA_ID_CONTENT_ENCODING 0x6240 |
105 | #define MATROSKA_ID_CONTENT_COMPRESSION 0x5034 |
106 | #define MATROSKA_ID_CONTENT_COMP_ALGO 0x4254 |
107 | #define MATROSKA_ID_CONTENT_COMP_SETTINGS 0x4255 |
108 | #define MATROSKA_ID_CONTENT_ENCRYPTION 0x5035 |
109 | #define MATROSKA_ID_ATTACHMENTS 0x1941A469 |
110 | #define MATROSKA_ID_ATTACHED_FILE 0x61A7 |
111 | #define MATROSKA_ID_FILE_DESCRIPTION 0x467E |
112 | #define MATROSKA_ID_FILE_NAME 0x466E |
113 | #define MATROSKA_ID_FILE_MIME_TYPE 0x4660 |
114 | #define MATROSKA_ID_FILE_DATA 0x465C |
115 | #define MATROSKA_ID_FILE_UID 0x46AE |
116 | #define MATROSKA_ID_CUES 0x1C53BB6B |
117 | #define MATROSKA_ID_CUE_POINT 0xBB |
118 | #define MATROSKA_ID_CUE_TIME 0xB3 |
119 | #define MATROSKA_ID_CUE_TRACK_POSITIONS 0xB7 |
120 | #define MATROSKA_ID_CUE_TRACK 0xF7 |
121 | #define MATROSKA_ID_CUE_CLUSTER_POSITION 0xF1 |
122 | #define MATROSKA_ID_CUE_BLOCK_NUMBER 0x5378 |
123 | #define MATROSKA_ID_TAGS 0x1254C367 |
124 | #define MATROSKA_ID_SEEK_PRE_ROLL 0x56BB |
125 | #define MATROSKA_ID_CODEC_DELAY 0x56AA |
126 | #define MATROSKA_ID_DISCARD_PADDING 0x75A2 |
127 | #define MATROSKA_ID_COLOR_SPACE 0x2EB524 |
128 | #define MATROSKA_ID_PRIMARIES 0x55BB |
129 | |
130 | class EBMLId: public EBMLNumber { |
131 | public: |
132 | EBMLId(); |
133 | virtual ~EBMLId(); |
134 | |
135 | char const* stringName() const; // used for debugging |
136 | }; |
137 | |
138 | class EBMLDataSize: public EBMLNumber { |
139 | public: |
140 | EBMLDataSize(); |
141 | virtual ~EBMLDataSize(); |
142 | }; |
143 | |
144 | #endif |
145 | |