1 /* GStreamer
2 * Copyright (C) <2009> Sebastian Dröge <sebastian.droege@collabora.co.uk>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 #ifdef HAVE_CONFIG_H
21 #include <config.h>
22 #endif
23
24 #include <string.h>
25
26 #include "mxful.h"
27
28 const MXFUL _mxf_ul_table[] = {
29 /* SMPTE */
30 {{0x06, 0x0e, 0x2b, 0x34, 0x00,}},
31 /* FILL, SMPTE 336M */
32 {{0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x01,
33 0x03, 0x01, 0x02, 0x10, 0x01, 0x00,}},
34 /* PARTITION_PACK, SMPTE 377M 6.1 */
35 {{0x06, 0x0e, 0x2b, 0x34, 0x02, 0x05, 0x01, 0x01,
36 0x0d, 0x01, 0x02, 0x01, 0x01, 0x00,}},
37 /* PRIMER_PACK, SMPTE 377M 8.1 */
38 {{0x06, 0x0e, 0x2b, 0x34, 0x02, 0x05, 0x01, 0x01,
39 0x0d, 0x01, 0x02, 0x01, 0x01, 0x05, 0x01, 0x00}},
40 /* METADATA, SMPTE 377M 8.6 */
41 {{0x06, 0x0e, 0x2b, 0x34, 0x02, 0x53, 0x01, 0x01,
42 0x0d, 0x01, 0x01, 0x01, 0x01, 0x00,}},
43 /* DESCRIPTIVE_METADATA, SMPTE 377M 8.7.3 */
44 {{0x06, 0x0e, 0x2b, 0x34, 0x02, 0x00, 0x01, 0x01,
45 0x0d, 0x01, 0x04, 0x01, 0x00,}},
46 /* RANDOM_INDEX_PACK, SMPTE 377M 11.1 */
47 {{0x06, 0x0e, 0x2b, 0x34, 0x02, 0x05, 0x01, 0x01,
48 0x0d, 0x01, 0x02, 0x01, 0x01, 0x11, 0x01, 0x00}},
49 /* INDEX_TABLE_SEGMENT, SMPTE 377M 10.2.2 */
50 {{0x06, 0x0e, 0x2b, 0x34, 0x02, 0x53, 0x01, 0x01,
51 0x0d, 0x01, 0x02, 0x01, 0x01, 0x10, 0x01, 0x00}},
52 /* GENERIC_CONTAINER_SYSTEM_ITEM, SMPTE 379M 6.2.1 */
53 {{0x06, 0x0e, 0x2b, 0x34, 0x02, 0x00, 0x01, 0x00,
54 0x0d, 0x01, 0x03, 0x01, 0x00}},
55 /* GENERIC_CONTAINER_ESSENCE_ELEMENT, SMPTE 379M 7.1 */
56 {{0x06, 0x0e, 0x2b, 0x34, 0x01, 0x02, 0x01, 0x00,
57 0x0d, 0x01, 0x03, 0x01, 0x00,}},
58 /* GENERIC_CONTAINER_ESSENCE_CONTAINER_LABEL, SMPTE 379M 8 */
59 {{0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x00,
60 0x0d, 0x01, 0x03, 0x01, 0x00,}},
61 /* AVID_ESSENCE_CONTAINER_ESSENCE_ELEMENT, undocumented */
62 {{0x06, 0x0e, 0x2b, 0x34, 0x01, 0x02, 0x01, 0x01,
63 0x0e, 0x04, 0x03, 0x01, 0x00,}},
64 /* AVID_ESSENCE_CONTAINER_ESSENCE_LABEL, undocumented */
65 {{0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0xff,
66 0x4b, 0x46, 0x41, 0x41, 0x00, 0x0d, 0x4d, 0x4f}},
67 /* OPERATIONAL_PATTERN_IDENTIFICATION */
68 {{0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x01,
69 0x0d, 0x01, 0x02, 0x01, 0x00,}},
70 /* TRACK_TIMECODE_12M_INACTIVE */
71 {{0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x01,
72 0x01, 0x03, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00}},
73 /* TRACK_TIMECODE_12M_ACTIVE */
74 {{0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x01,
75 0x01, 0x03, 0x02, 0x01, 0x02, 0x00, 0x00, 0x00}},
76 /* TRACK_TIMECODE_309M */
77 {{0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x01,
78 0x01, 0x03, 0x02, 0x01, 0x03, 0x00, 0x00, 0x00}},
79 /* TRACK_METADATA */
80 {{0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x01,
81 0x01, 0x03, 0x02, 0x01, 0x10, 0x00, 0x00, 0x00}},
82 /* TRACK_PICTURE_ESSENCE */
83 {{0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x01,
84 0x01, 0x03, 0x02, 0x02, 0x01, 0x00, 0x00, 0x00}},
85 /* TRACK_SOUND_ESSENCE */
86 {{0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x01,
87 0x01, 0x03, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00}},
88 /* TRACK_DATA_ESSENCE */
89 {{0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x01,
90 0x01, 0x03, 0x02, 0x02, 0x03, 0x00, 0x00, 0x00}},
91 /* TRACK_AUXILIARY_DATA */
92 {{0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x01,
93 0x01, 0x03, 0x02, 0x03, 0x01, 0x00, 0x00, 0x00}},
94 /* TRACK_PARSED_TEXT */
95 {{0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x01,
96 0x01, 0x03, 0x02, 0x03, 0x02, 0x00, 0x00, 0x00}},
97 /* TRACK_AVID_PICTURE_ESSENCE */
98 {{0x80, 0x7d, 0x00, 0x60, 0x08, 0x14, 0x3e, 0x6f,
99 0x6f, 0x3c, 0x8c, 0xe1, 0x6c, 0xef, 0x11, 0xd2}},
100 /** MXF Structural Metadata */
101 /* INSTANCE_UID */
102 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
103 0x01, 0x01, 0x15, 0x02, 0x00, 0x00, 0x00, 0x00}},
104 /* GENERATION_UID */
105 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
106 0x05, 0x20, 0x07, 0x01, 0x01, 0x00, 0x00, 0x00}},
107 /* Preface */
108 /* LAST_MODIFIED_DATE */
109 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
110 0x07, 0x02, 0x01, 0x10, 0x02, 0x04, 0x00, 0x00}},
111 /* VERSION */
112 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
113 0x03, 0x01, 0x02, 0x01, 0x05, 0x00, 0x00, 0x00}},
114 /* OBJECT_MODEL_VERSION */
115 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
116 0x03, 0x01, 0x02, 0x01, 0x04, 0x00, 0x00, 0x00}},
117 /* PRIMARY_PACKAGE */
118 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x04,
119 0x06, 0x01, 0x01, 0x04, 0x01, 0x08, 0x00, 0x00}},
120 /* IDENTIFICATIONS */
121 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
122 0x06, 0x01, 0x01, 0x04, 0x06, 0x04, 0x00, 0x00}},
123 /* CONTENT_STORAGE */
124 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
125 0x06, 0x01, 0x01, 0x04, 0x02, 0x01, 0x00, 0x00}},
126 /* OPERATIONAL_PATTERN */
127 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x05,
128 0x01, 0x02, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00}},
129 /* ESSENCE_CONTAINERS */
130 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x05,
131 0x01, 0x02, 0x02, 0x10, 0x02, 0x01, 0x00, 0x00}},
132 /* DM_SCHEMES */
133 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x05,
134 0x01, 0x02, 0x02, 0x10, 0x02, 0x02, 0x00, 0x00}},
135 /* Identification */
136 /* THIS_GENERATION_UID */
137 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
138 0x05, 0x20, 0x07, 0x01, 0x01, 0x00, 0x00, 0x00}},
139 /* COMPANY_NAME */
140 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
141 0x05, 0x20, 0x07, 0x01, 0x02, 0x01, 0x00, 0x00}},
142 /* PRODUCT_NAME */
143 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
144 0x05, 0x20, 0x07, 0x01, 0x03, 0x01, 0x00, 0x00}},
145 /* PRODUCT_VERSION */
146 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
147 0x05, 0x20, 0x07, 0x01, 0x04, 0x00, 0x00, 0x00}},
148 /* VERSION_STRING */
149 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
150 0x05, 0x20, 0x07, 0x01, 0x05, 0x01, 0x00, 0x00}},
151 /* PRODUCT_UID */
152 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
153 0x05, 0x20, 0x07, 0x01, 0x07, 0x00, 0x00, 0x00}},
154 /* MODIFICATION_DATE */
155 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
156 0x07, 0x02, 0x01, 0x10, 0x02, 0x03, 0x00, 0x00}},
157 /* TOOLKIT_VERSION */
158 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
159 0x05, 0x20, 0x07, 0x01, 0x0A, 0x00, 0x00, 0x00}},
160 /* PLATFORM */
161 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
162 0x05, 0x20, 0x07, 0x01, 0x06, 0x01, 0x00, 0x00}},
163 /* Content storage */
164 /* PACKAGES */
165 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
166 0x06, 0x01, 0x01, 0x04, 0x05, 0x01, 0x00, 0x00}},
167 /* ESSENCE_CONTAINER_DATA */
168 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
169 0x06, 0x01, 0x01, 0x04, 0x05, 0x02, 0x00, 0x00}},
170 /* Essence container data */
171 /* LINKED_PACKAGE_UID */
172 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
173 0x06, 0x01, 0x01, 0x06, 0x01, 0x00, 0x00, 0x00}},
174 /* BODY_SID */
175 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x04,
176 0x01, 0x03, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00}},
177 /* INDEX_SID */
178 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x04,
179 0x01, 0x03, 0x04, 0x05, 0x00, 0x00, 0x00, 0x00}},
180 /* Generic package */
181 /* PACKAGE_UID */
182 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
183 0x01, 0x01, 0x15, 0x10, 0x00, 0x00, 0x00, 0x00}},
184 /* PACKAGE_NAME */
185 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
186 0x01, 0x03, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00}},
187 /* PACKAGE_CREATION_DATE */
188 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
189 0x07, 0x02, 0x01, 0x10, 0x01, 0x03, 0x00, 0x00}},
190 /* PACKAGE_MODIFIED_DATE */
191 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
192 0x07, 0x02, 0x01, 0x10, 0x02, 0x05, 0x00, 0x00}},
193 /* TRACKS */
194 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
195 0x06, 0x01, 0x01, 0x04, 0x06, 0x05, 0x00, 0x00}},
196 /* Source package */
197 /* DESCRIPTOR */
198 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
199 0x06, 0x01, 0x01, 0x04, 0x02, 0x03, 0x00, 0x00}},
200 /* Track */
201 /* TRACK_ID */
202 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
203 0x01, 0x07, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00}},
204 /* TRACK_NUMBER */
205 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
206 0x01, 0x04, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00}},
207 /* TRACK_NAME */
208 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
209 0x01, 0x07, 0x01, 0x02, 0x01, 0x00, 0x00, 0x00}},
210 /* SEQUENCE */
211 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
212 0x06, 0x01, 0x01, 0x04, 0x02, 0x04, 0x00, 0x00}},
213 /* Timeline track */
214 /* EDIT_RATE */
215 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
216 0x05, 0x30, 0x04, 0x05, 0x00, 0x00, 0x00, 0x00}},
217 /* ORIGIN */
218 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
219 0x07, 0x02, 0x01, 0x03, 0x01, 0x03, 0x00, 0x00}},
220 /* Event track */
221 /* EVENT_EDIT_RATE */
222 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
223 0x05, 0x30, 0x04, 0x02, 0x00, 0x00, 0x00, 0x00}},
224 /* EVENT_ORIGIN */
225 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x05,
226 0x07, 0x02, 0x01, 0x03, 0x01, 0x0B, 0x00, 0x00}},
227 /* Sequence & structural component */
228 /* DATA_DEFINITION */
229 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
230 0x04, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00}},
231 /* DURATION */
232 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
233 0x07, 0x02, 0x02, 0x01, 0x01, 0x03, 0x00, 0x00}},
234 /* STRUCTURAL_COMPONENTS */
235 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
236 0x06, 0x01, 0x01, 0x04, 0x06, 0x09, 0x00, 0x00}},
237 /* Timecode component */
238 /* ROUNDED_TIMECODE_BASE */
239 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
240 0x04, 0x04, 0x01, 0x01, 0x02, 0x06, 0x00, 0x00}},
241 /* START_TIMECODE */
242 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
243 0x07, 0x02, 0x01, 0x03, 0x01, 0x05, 0x00, 0x00}},
244 /* DROP_FRAME */
245 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
246 0x04, 0x04, 0x01, 0x01, 0x05, 0x00, 0x00, 0x00}},
247 /* Source clip */
248 /* START_POSITION */
249 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
250 0x07, 0x02, 0x01, 0x03, 0x01, 0x04, 0x00, 0x00}},
251 /* SOURCE_PACKAGE_ID */
252 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
253 0x06, 0x01, 0x01, 0x03, 0x01, 0x00, 0x00, 0x00}},
254 /* SOURCE_TRACK_ID */
255 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
256 0x06, 0x01, 0x01, 0x03, 0x02, 0x00, 0x00, 0x0}},
257 /* DM Source clip */
258 /* DM_SOURCELIP_TRACK_IDS */
259 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x05,
260 0x01, 0x07, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00}},
261 /* DM Segment */
262 /* EVENT_START_POSITION */
263 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
264 0x07, 0x02, 0x01, 0x03, 0x03, 0x03, 0x00, 0x00}},
265 /* EVENT_COMMENT */
266 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
267 0x05, 0x30, 0x04, 0x04, 0x01, 0x00, 0x00, 0x00}},
268 /* DM_SEGMENT_TRACK_IDS */
269 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x04,
270 0x01, 0x07, 0x01, 0x05, 0x00, 0x00, 0x00, 0x00}},
271 /* DM_FRAMEWORK */
272 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x05,
273 0x06, 0x01, 0x01, 0x04, 0x02, 0x0C, 0x00, 0x00}},
274 /* Generic descriptor */
275 /* LOCATORS */
276 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
277 0x06, 0x01, 0x01, 0x04, 0x06, 0x03, 0x00, 0x00}},
278 /* File descriptor */
279 /* LINKED_TRACK_ID */
280 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x05,
281 0x06, 0x01, 0x01, 0x03, 0x05, 0x00, 0x00, 0x00}},
282 /* SAMPLE_RATE */
283 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
284 0x04, 0x06, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00}},
285 /* CONTAINER_DURATION */
286 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
287 0x04, 0x06, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00}},
288 /* ESSENCE_CONTAINER */
289 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
290 0x06, 0x01, 0x01, 0x04, 0x01, 0x02, 0x00, 0x00}},
291 /* CODEC */
292 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
293 0x06, 0x01, 0x01, 0x04, 0x01, 0x03, 0x00, 0x00}},
294 /* Generic picture essence descriptor */
295 /* SIGNAL_STANDARD */
296 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x05,
297 0x04, 0x05, 0x01, 0x13, 0x00, 0x00, 0x00, 0x00}},
298 /* FRAME_LAYOUT */
299 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
300 0x04, 0x01, 0x03, 0x01, 0x04, 0x00, 0x00, 0x00}},
301 /* STORED_WIDTH */
302 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
303 0x04, 0x01, 0x05, 0x02, 0x02, 0x00, 0x00, 0x00}},
304 /* STORED_HEIGHT */
305 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
306 0x04, 0x01, 0x05, 0x02, 0x01, 0x00, 0x00, 0x00}},
307 /* STORED_F2_OFFSET */
308 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x05,
309 0x04, 0x01, 0x03, 0x02, 0x08, 0x00, 0x00, 0x00}},
310 /* SAMPLED_WIDTH */
311 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
312 0x04, 0x01, 0x05, 0x01, 0x08, 0x00, 0x00, 0x00}},
313 /* SAMPLED_HEIGHT */
314 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
315 0x04, 0x01, 0x05, 0x01, 0x07, 0x00, 0x00, 0x00}},
316 /* SAMPLED_X_OFFSET */
317 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
318 0x04, 0x01, 0x05, 0x01, 0x09, 0x00, 0x00, 0x00}},
319 /* SAMPLED_Y_OFFSET */
320 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
321 0x04, 0x01, 0x05, 0x01, 0x0A, 0x00, 0x00, 0x00}},
322 /* DISPLAY_HEIGHT */
323 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
324 0x04, 0x01, 0x05, 0x01, 0x0B, 0x00, 0x00, 0x00}},
325 /* DISPLAY_WIDTH */
326 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
327 0x04, 0x01, 0x05, 0x01, 0x0C, 0x00, 0x00, 0x00}},
328 /* DISPLAY_X_OFFSET */
329 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
330 0x04, 0x01, 0x05, 0x01, 0x0D, 0x00, 0x00, 0x00}},
331 /* DISPLAY_Y_OFFSET */
332 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
333 0x04, 0x01, 0x05, 0x01, 0x0E, 0x00, 0x00, 0x00}},
334 /* DISPLAY_F2_OFFSET */
335 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x05,
336 0x04, 0x01, 0x03, 0x02, 0x07, 0x00, 0x00, 0x00}},
337 /* ASPECT_RATIO */
338 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
339 0x04, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00}},
340 /* ACTIVE_FORMAT_DESCRIPTOR */
341 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x05,
342 0x04, 0x01, 0x03, 0x02, 0x09, 0x00, 0x00, 0x00}},
343 /* VIDEO_LINE_MAP */
344 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
345 0x04, 0x01, 0x03, 0x02, 0x05, 0x00, 0x00, 0x00}},
346 /* ALPHA_TRANSPARENCY */
347 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
348 0x05, 0x20, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00}},
349 /* CAPTURE_GAMMA */
350 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
351 0x04, 0x01, 0x02, 0x01, 0x01, 0x01, 0x02, 0x00}},
352 /* IMAGE_ALIGNMENT_OFFSET */
353 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
354 0x04, 0x18, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00}},
355 /* IMAGE_START_OFFSET */
356 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
357 0x04, 0x18, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00}},
358 /* IMAGE_END_OFFSET */
359 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
360 0x04, 0x18, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00}},
361 /* FIELD_DOMINANCE */
362 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
363 0x04, 0x01, 0x03, 0x01, 0x06, 0x00, 0x00, 0x00}},
364 /* PICTURE_ESSENCE_CODING */
365 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
366 0x04, 0x01, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00}},
367 /* Generic audio essence descriptor */
368 /* AUDIO_SAMPLING_RATE */
369 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x05,
370 0x04, 0x02, 0x03, 0x01, 0x01, 0x01, 0x00, 0x00}},
371 /* LOCKED */
372 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x04,
373 0x04, 0x02, 0x03, 0x01, 0x04, 0x00, 0x00, 0x00}},
374 /* AUDIO_REF_LEVEL */
375 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
376 0x04, 0x02, 0x01, 0x01, 0x03, 0x00, 0x00, 0x00}},
377 /* ELECTRO_SPATIAL_FORMULATION */
378 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
379 0x04, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00}},
380 /* CHANNEL_COUNT */
381 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x05,
382 0x04, 0x02, 0x01, 0x01, 0x04, 0x00, 0x00, 0x00}},
383 /* QUANTIZATION_BITS */
384 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x04,
385 0x04, 0x02, 0x03, 0x03, 0x04, 0x00, 0x00, 0x00}},
386 /* DIAL_NORM */
387 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x05,
388 0x04, 0x02, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00}},
389 /* SOUND_ESSENCE_COMPRESSION */
390 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
391 0x04, 0x02, 0x04, 0x02, 0x00, 0x00, 0x00, 0x00}},
392 /* CDCI Picture essence descriptor */
393 /* COMPONENT_DEPTH */
394 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
395 0x04, 0x01, 0x05, 0x03, 0x0A, 0x00, 0x00, 0x00}},
396 /* HORIZONTAL_SUBSAMPLING */
397 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
398 0x04, 0x01, 0x05, 0x01, 0x05, 0x00, 0x00, 0x00}},
399 /* VERTICAL_SUBSAMPLING */
400 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
401 0x04, 0x01, 0x05, 0x01, 0x10, 0x00, 0x00, 0x00}},
402 /* COLOR_SITING */
403 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
404 0x04, 0x01, 0x05, 0x01, 0x06, 0x00, 0x00, 0x00}},
405 /* REVERSED_BYTE_ORDER */
406 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x05,
407 0x03, 0x01, 0x02, 0x01, 0x0A, 0x00, 0x00, 0x00}},
408 /* PADDING_BITS */
409 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
410 0x04, 0x18, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00}},
411 /* ALPHA_SAMPLE_DEPTH */
412 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
413 0x04, 0x01, 0x05, 0x03, 0x07, 0x00, 0x00, 0x00}},
414 /* BLACK_REF_LEVEL */
415 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
416 0x04, 0x01, 0x05, 0x03, 0x03, 0x00, 0x00, 0x00}},
417 /* WHITE_REF_LEVEL */
418 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
419 0x04, 0x01, 0x05, 0x03, 0x04, 0x00, 0x00, 0x00}},
420 /* COLOR_RANGE */
421 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
422 0x04, 0x01, 0x05, 0x03, 0x05, 0x00, 0x00, 0x00}},
423 /* RGBA picture essence descriptor */
424 /* COMPONENT_MAX_REF */
425 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x05,
426 0x04, 0x01, 0x05, 0x03, 0x0B, 0x00, 0x00, 0x00}},
427 /* COMPONENT_MIN_REF */
428 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x05,
429 0x04, 0x01, 0x05, 0x03, 0x0C, 0x00, 0x00, 0x00}},
430 /* ALPHA_MAX_REF */
431 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x05,
432 0x04, 0x01, 0x05, 0x03, 0x0D, 0x00, 0x00, 0x00}},
433 /* ALPHA_MIN_REF */
434 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x05,
435 0x04, 0x01, 0x05, 0x03, 0x0E, 0x00, 0x00, 0x00}},
436 /* SCANNING_DIRECTION */
437 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x05,
438 0x04, 0x01, 0x04, 0x04, 0x01, 0x00, 0x00, 0x00}},
439 /* PIXEL_LAYOUT */
440 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
441 0x04, 0x01, 0x05, 0x03, 0x06, 0x00, 0x00, 0x00}},
442 /* Generic data essence descriptor */
443 /* DATA_ESSENCE_CODING */
444 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x03,
445 0x04, 0x03, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00}},
446 /* Multiple descriptor */
447 /* SUB_DESCRIPTORS */
448 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x04,
449 0x06, 0x01, 0x01, 0x04, 0x06, 0x0B, 0x00, 0x00}},
450 /* Text locator */
451 /* LOCATOR_NAME */
452 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
453 0x01, 0x04, 0x01, 0x02, 0x01, 0x00, 0x00, 0x00}},
454 /* Network locator */
455 /* URL_STRING */
456 {{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x01,
457 0x01, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00}},
458 };
459
460 gboolean
mxf_ul_is_equal(const MXFUL * a,const MXFUL * b)461 mxf_ul_is_equal (const MXFUL * a, const MXFUL * b)
462 {
463 guint i;
464
465 g_return_val_if_fail (a != NULL, FALSE);
466 g_return_val_if_fail (b != NULL, FALSE);
467
468 for (i = 0; i < 16; i++) {
469 /* registry version */
470 if (i == 7)
471 continue;
472
473 if (a->u[i] != b->u[i])
474 return FALSE;
475 }
476
477 return TRUE;
478 }
479
480 gboolean
mxf_ul_is_subclass(const MXFUL * class,const MXFUL * subclass)481 mxf_ul_is_subclass (const MXFUL * class, const MXFUL * subclass)
482 {
483 guint i;
484
485 g_return_val_if_fail (class != NULL, FALSE);
486 g_return_val_if_fail (subclass != NULL, FALSE);
487
488 for (i = 0; i < 16; i++) {
489 if (i == 7)
490 /* registry version */
491 continue;
492
493 if (class->u[i] != 0x00 && class->u[i] != subclass->u[i])
494 return FALSE;
495 }
496
497 return TRUE;
498 }
499
500 gboolean
mxf_ul_is_zero(const MXFUL * ul)501 mxf_ul_is_zero (const MXFUL * ul)
502 {
503 static const guint8 zero[16] = { 0, };
504
505 g_return_val_if_fail (ul != NULL, FALSE);
506
507 return (memcmp (ul, &zero, 16) == 0);
508 }
509
510 gboolean
mxf_ul_is_valid(const MXFUL * ul)511 mxf_ul_is_valid (const MXFUL * ul)
512 {
513 guint i, j;
514
515 g_return_val_if_fail (ul != NULL, FALSE);
516
517 for (i = 0; i < 16; i++) {
518 if (ul->u[i] == 0x00) {
519 for (j = i; j < 16; j++) {
520 if (ul->u[j] != 0x00)
521 return FALSE;
522 }
523
524 return TRUE;
525 }
526
527 if (ul->u[i] > 0x7f)
528 return FALSE;
529 }
530
531 return TRUE;
532 }
533
534 guint
mxf_ul_hash(const MXFUL * ul)535 mxf_ul_hash (const MXFUL * ul)
536 {
537 guint32 ret = 0;
538 guint i;
539
540 g_return_val_if_fail (ul != NULL, 0);
541
542 for (i = 0; i < 4; i++)
543 ret ^= (ul->u[i * 4 + 0] << 24) |
544 (ul->u[i * 4 + 1] << 16) |
545 (ul->u[i * 4 + 2] << 8) | (ul->u[i * 4 + 3] << 0);
546
547 return ret;
548 }
549
550 gchar *
mxf_ul_to_string(const MXFUL * ul,gchar str[48])551 mxf_ul_to_string (const MXFUL * ul, gchar str[48])
552 {
553 gchar *ret = str;
554
555 g_return_val_if_fail (ul != NULL, NULL);
556
557 if (ret == NULL)
558 ret = g_malloc (48);
559
560 g_snprintf (ret, 48,
561 "%02x.%02x.%02x.%02x."
562 "%02x.%02x.%02x.%02x."
563 "%02x.%02x.%02x.%02x."
564 "%02x.%02x.%02x.%02x",
565 ul->u[0], ul->u[1], ul->u[2], ul->u[3],
566 ul->u[4], ul->u[5], ul->u[6], ul->u[7],
567 ul->u[8], ul->u[9], ul->u[10], ul->u[11],
568 ul->u[12], ul->u[13], ul->u[14], ul->u[15]);
569
570 return ret;
571 }
572
573 MXFUL *
mxf_ul_from_string(const gchar * str,MXFUL * ul)574 mxf_ul_from_string (const gchar * str, MXFUL * ul)
575 {
576 MXFUL *ret = ul;
577 gint len;
578 guint i, j;
579
580 g_return_val_if_fail (str != NULL, NULL);
581
582 len = strlen (str);
583 if (len != 47) {
584 GST_ERROR ("Invalid UL string length %d, should be 47", len);
585 return NULL;
586 }
587
588 if (ret == NULL)
589 ret = g_new0 (MXFUL, 1);
590
591 memset (ret, 0, 16);
592
593 for (i = 0, j = 0; i < 16; i++) {
594 if (!g_ascii_isxdigit (str[j]) ||
595 !g_ascii_isxdigit (str[j + 1]) ||
596 (str[j + 2] != '.' && str[j + 2] != '\0')) {
597 GST_ERROR ("Invalid UL string '%s'", str);
598 if (ul == NULL)
599 g_free (ret);
600 return NULL;
601 }
602
603 ret->u[i] = (g_ascii_xdigit_value (str[j]) << 4) |
604 (g_ascii_xdigit_value (str[j + 1]));
605 j += 3;
606 }
607 return ret;
608 }
609
610 gboolean
mxf_ul_array_parse(MXFUL ** array,guint32 * count,const guint8 * data,guint size)611 mxf_ul_array_parse (MXFUL ** array, guint32 * count, const guint8 * data,
612 guint size)
613 {
614 guint32 element_count, element_size;
615 guint i;
616
617 g_return_val_if_fail (array != NULL, FALSE);
618 g_return_val_if_fail (count != NULL, FALSE);
619
620 if (size < 8)
621 return FALSE;
622
623 g_return_val_if_fail (data != NULL, FALSE);
624
625 element_count = GST_READ_UINT32_BE (data);
626 data += 4;
627 size -= 4;
628
629 if (element_count == 0) {
630 *array = NULL;
631 *count = 0;
632 return TRUE;
633 }
634
635 element_size = GST_READ_UINT32_BE (data);
636 data += 4;
637 size -= 4;
638
639 if (element_size != 16) {
640 *array = NULL;
641 *count = 0;
642 return FALSE;
643 }
644
645 if (element_count > size / 16) {
646 *array = NULL;
647 *count = 0;
648 return FALSE;
649 }
650
651 *array = g_new (MXFUL, element_count);
652 *count = element_count;
653
654 for (i = 0; i < element_count; i++) {
655 memcpy (&((*array)[i]), data, 16);
656 data += 16;
657 }
658
659 return TRUE;
660 }
661