1 /* GStreamer |
|
2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> |
|
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., 59 Temple Place - Suite 330, |
|
17 * Boston, MA 02111-1307, USA. |
|
18 */ |
|
19 |
|
20 #include "qtdemux_types.h" |
|
21 #include "qtdemux_dump.h" |
|
22 |
|
23 void |
|
24 qtdemux_dump_mvhd (GstQTDemux * qtdemux, guint8 * buffer, int depth) |
|
25 { |
|
26 GST_LOG ("%*s version/flags: %08x", depth, "", QT_UINT32 (buffer + 8)); |
|
27 GST_LOG ("%*s creation time: %u", depth, "", QT_UINT32 (buffer + 12)); |
|
28 GST_LOG ("%*s modify time: %u", depth, "", QT_UINT32 (buffer + 16)); |
|
29 GST_LOG ("%*s time scale: 1/%u sec", depth, "", QT_UINT32 (buffer + 20)); |
|
30 GST_LOG ("%*s duration: %u", depth, "", QT_UINT32 (buffer + 24)); |
|
31 GST_LOG ("%*s pref. rate: %g", depth, "", QT_FP32 (buffer + 28)); |
|
32 GST_LOG ("%*s pref. volume: %g", depth, "", QT_FP16 (buffer + 32)); |
|
33 GST_LOG ("%*s preview time: %u", depth, "", QT_UINT32 (buffer + 80)); |
|
34 GST_LOG ("%*s preview dur.: %u", depth, "", QT_UINT32 (buffer + 84)); |
|
35 GST_LOG ("%*s poster time: %u", depth, "", QT_UINT32 (buffer + 88)); |
|
36 GST_LOG ("%*s select time: %u", depth, "", QT_UINT32 (buffer + 92)); |
|
37 GST_LOG ("%*s select dur.: %u", depth, "", QT_UINT32 (buffer + 96)); |
|
38 GST_LOG ("%*s current time: %u", depth, "", QT_UINT32 (buffer + 100)); |
|
39 GST_LOG ("%*s next track ID: %d", depth, "", QT_UINT32 (buffer + 104)); |
|
40 } |
|
41 |
|
42 void |
|
43 qtdemux_dump_tkhd (GstQTDemux * qtdemux, guint8 * buffer, int depth) |
|
44 { |
|
45 GST_LOG ("%*s version/flags: %08x", depth, "", QT_UINT32 (buffer + 8)); |
|
46 GST_LOG ("%*s creation time: %u", depth, "", QT_UINT32 (buffer + 12)); |
|
47 GST_LOG ("%*s modify time: %u", depth, "", QT_UINT32 (buffer + 16)); |
|
48 GST_LOG ("%*s track ID: %u", depth, "", QT_UINT32 (buffer + 20)); |
|
49 GST_LOG ("%*s duration: %u", depth, "", QT_UINT32 (buffer + 28)); |
|
50 GST_LOG ("%*s layer: %u", depth, "", QT_UINT16 (buffer + 36)); |
|
51 GST_LOG ("%*s alt group: %u", depth, "", QT_UINT16 (buffer + 38)); |
|
52 GST_LOG ("%*s volume: %g", depth, "", QT_FP16 (buffer + 44)); |
|
53 GST_LOG ("%*s track width: %g", depth, "", QT_FP32 (buffer + 84)); |
|
54 GST_LOG ("%*s track height: %g", depth, "", QT_FP32 (buffer + 88)); |
|
55 |
|
56 } |
|
57 |
|
58 void |
|
59 qtdemux_dump_elst (GstQTDemux * qtdemux, guint8 * buffer, int depth) |
|
60 { |
|
61 int i; |
|
62 int n; |
|
63 |
|
64 GST_LOG ("%*s version/flags: %08x", depth, "", QT_UINT32 (buffer + 8)); |
|
65 GST_LOG ("%*s n entries: %u", depth, "", QT_UINT32 (buffer + 12)); |
|
66 n = QT_UINT32 (buffer + 12); |
|
67 for (i = 0; i < n; i++) { |
|
68 GST_LOG ("%*s track dur: %u", depth, "", |
|
69 QT_UINT32 (buffer + 16 + i * 12)); |
|
70 GST_LOG ("%*s media time: %u", depth, "", |
|
71 QT_UINT32 (buffer + 20 + i * 12)); |
|
72 GST_LOG ("%*s media rate: %g", depth, "", |
|
73 QT_FP32 (buffer + 24 + i * 12)); |
|
74 } |
|
75 } |
|
76 |
|
77 void |
|
78 qtdemux_dump_mdhd (GstQTDemux * qtdemux, guint8 * buffer, int depth) |
|
79 { |
|
80 guint32 version; |
|
81 guint64 duration, ctime, mtime; |
|
82 guint32 time_scale; |
|
83 guint16 language, quality; |
|
84 |
|
85 version = QT_UINT32 (buffer + 8); |
|
86 GST_LOG ("%*s version/flags: %08x", depth, "", version); |
|
87 |
|
88 if (version == 0x01000000) { |
|
89 ctime = QT_UINT64 (buffer + 12); |
|
90 mtime = QT_UINT64 (buffer + 20); |
|
91 time_scale = QT_UINT32 (buffer + 28); |
|
92 duration = QT_UINT64 (buffer + 32); |
|
93 language = QT_UINT16 (buffer + 40); |
|
94 quality = QT_UINT16 (buffer + 42); |
|
95 } else { |
|
96 ctime = QT_UINT32 (buffer + 12); |
|
97 mtime = QT_UINT32 (buffer + 16); |
|
98 time_scale = QT_UINT32 (buffer + 20); |
|
99 duration = QT_UINT32 (buffer + 24); |
|
100 language = QT_UINT16 (buffer + 28); |
|
101 quality = QT_UINT16 (buffer + 30); |
|
102 } |
|
103 |
|
104 GST_LOG ("%*s creation time: %" G_GUINT64_FORMAT, depth, "", ctime); |
|
105 GST_LOG ("%*s modify time: %" G_GUINT64_FORMAT, depth, "", mtime); |
|
106 GST_LOG ("%*s time scale: 1/%u sec", depth, "", time_scale); |
|
107 GST_LOG ("%*s duration: %" G_GUINT64_FORMAT, depth, "", duration); |
|
108 GST_LOG ("%*s language: %u", depth, "", language); |
|
109 GST_LOG ("%*s quality: %u", depth, "", quality); |
|
110 } |
|
111 |
|
112 void |
|
113 qtdemux_dump_hdlr (GstQTDemux * qtdemux, guint8 * buffer, int depth) |
|
114 { |
|
115 GST_LOG ("%*s version/flags: %08x", depth, "", QT_UINT32 (buffer + 8)); |
|
116 GST_LOG ("%*s type: %" GST_FOURCC_FORMAT, depth, "", |
|
117 GST_FOURCC_ARGS (QT_FOURCC (buffer + 12))); |
|
118 GST_LOG ("%*s subtype: %" GST_FOURCC_FORMAT, depth, "", |
|
119 GST_FOURCC_ARGS (QT_FOURCC (buffer + 16))); |
|
120 GST_LOG ("%*s manufacturer: %" GST_FOURCC_FORMAT, depth, "", |
|
121 GST_FOURCC_ARGS (QT_FOURCC (buffer + 20))); |
|
122 GST_LOG ("%*s flags: %08x", depth, "", QT_UINT32 (buffer + 24)); |
|
123 GST_LOG ("%*s flags mask: %08x", depth, "", QT_UINT32 (buffer + 28)); |
|
124 GST_LOG ("%*s name: %*s", depth, "", |
|
125 QT_UINT8 (buffer + 32), (char *) (buffer + 33)); |
|
126 |
|
127 } |
|
128 |
|
129 void |
|
130 qtdemux_dump_vmhd (GstQTDemux * qtdemux, guint8 * buffer, int depth) |
|
131 { |
|
132 GST_LOG ("%*s version/flags: %08x", depth, "", QT_UINT32 (buffer + 8)); |
|
133 GST_LOG ("%*s mode/color: %08x", depth, "", QT_UINT32 (buffer + 16)); |
|
134 } |
|
135 |
|
136 void |
|
137 qtdemux_dump_dref (GstQTDemux * qtdemux, guint8 * buffer, int depth) |
|
138 { |
|
139 int n; |
|
140 int i; |
|
141 int offset; |
|
142 |
|
143 GST_LOG ("%*s version/flags: %08x", depth, "", QT_UINT32 (buffer + 8)); |
|
144 GST_LOG ("%*s n entries: %u", depth, "", QT_UINT32 (buffer + 12)); |
|
145 n = QT_UINT32 (buffer + 12); |
|
146 offset = 16; |
|
147 for (i = 0; i < n; i++) { |
|
148 GST_LOG ("%*s size: %u", depth, "", |
|
149 QT_UINT32 (buffer + offset)); |
|
150 GST_LOG ("%*s type: %" GST_FOURCC_FORMAT, depth, "", |
|
151 GST_FOURCC_ARGS (QT_FOURCC (buffer + offset + 4))); |
|
152 offset += QT_UINT32 (buffer + offset); |
|
153 } |
|
154 } |
|
155 |
|
156 void |
|
157 qtdemux_dump_stsd (GstQTDemux * qtdemux, guint8 * buffer, int depth) |
|
158 { |
|
159 int i; |
|
160 int n; |
|
161 int offset; |
|
162 |
|
163 GST_LOG ("%*s version/flags: %08x", depth, "", QT_UINT32 (buffer + 8)); |
|
164 GST_LOG ("%*s n entries: %d", depth, "", QT_UINT32 (buffer + 12)); |
|
165 n = QT_UINT32 (buffer + 12); |
|
166 offset = 16; |
|
167 for (i = 0; i < n; i++) { |
|
168 GST_LOG ("%*s size: %u", depth, "", |
|
169 QT_UINT32 (buffer + offset)); |
|
170 GST_LOG ("%*s type: %" GST_FOURCC_FORMAT, depth, "", |
|
171 GST_FOURCC_ARGS (QT_FOURCC (buffer + offset + 4))); |
|
172 GST_LOG ("%*s data reference:%d", depth, "", |
|
173 QT_UINT16 (buffer + offset + 14)); |
|
174 |
|
175 GST_LOG ("%*s version/rev.: %08x", depth, "", |
|
176 QT_UINT32 (buffer + offset + 16)); |
|
177 GST_LOG ("%*s vendor: %" GST_FOURCC_FORMAT, depth, "", |
|
178 GST_FOURCC_ARGS (QT_FOURCC (buffer + offset + 20))); |
|
179 GST_LOG ("%*s temporal qual: %u", depth, "", |
|
180 QT_UINT32 (buffer + offset + 24)); |
|
181 GST_LOG ("%*s spatial qual: %u", depth, "", |
|
182 QT_UINT32 (buffer + offset + 28)); |
|
183 GST_LOG ("%*s width: %u", depth, "", |
|
184 QT_UINT16 (buffer + offset + 32)); |
|
185 GST_LOG ("%*s height: %u", depth, "", |
|
186 QT_UINT16 (buffer + offset + 34)); |
|
187 GST_LOG ("%*s horiz. resol: %g", depth, "", |
|
188 QT_FP32 (buffer + offset + 36)); |
|
189 GST_LOG ("%*s vert. resol.: %g", depth, "", |
|
190 QT_FP32 (buffer + offset + 40)); |
|
191 GST_LOG ("%*s data size: %u", depth, "", |
|
192 QT_UINT32 (buffer + offset + 44)); |
|
193 GST_LOG ("%*s frame count: %u", depth, "", |
|
194 QT_UINT16 (buffer + offset + 48)); |
|
195 GST_LOG ("%*s compressor: %d %d %d", depth, "", |
|
196 QT_UINT8 (buffer + offset + 49), |
|
197 QT_UINT8 (buffer + offset + 50), QT_UINT8 (buffer + offset + 51)); |
|
198 //(char *) (buffer + offset + 51)); |
|
199 GST_LOG ("%*s depth: %u", depth, "", |
|
200 QT_UINT16 (buffer + offset + 82)); |
|
201 GST_LOG ("%*s color table ID:%u", depth, "", |
|
202 QT_UINT16 (buffer + offset + 84)); |
|
203 |
|
204 offset += QT_UINT32 (buffer + offset); |
|
205 } |
|
206 } |
|
207 |
|
208 void |
|
209 qtdemux_dump_stts (GstQTDemux * qtdemux, guint8 * buffer, int depth) |
|
210 { |
|
211 int i; |
|
212 int n; |
|
213 int offset; |
|
214 |
|
215 GST_LOG ("%*s version/flags: %08x", depth, "", QT_UINT32 (buffer + 8)); |
|
216 GST_LOG ("%*s n entries: %d", depth, "", QT_UINT32 (buffer + 12)); |
|
217 n = QT_UINT32 (buffer + 12); |
|
218 offset = 16; |
|
219 for (i = 0; i < n; i++) { |
|
220 GST_LOG ("%*s count: %u", depth, "", |
|
221 QT_UINT32 (buffer + offset)); |
|
222 GST_LOG ("%*s duration: %u", depth, "", |
|
223 QT_UINT32 (buffer + offset + 4)); |
|
224 |
|
225 offset += 8; |
|
226 } |
|
227 } |
|
228 |
|
229 void |
|
230 qtdemux_dump_stps (GstQTDemux * qtdemux, guint8 * buffer, int depth) |
|
231 { |
|
232 int i; |
|
233 int n; |
|
234 int offset; |
|
235 |
|
236 GST_LOG ("%*s version/flags: %08x", depth, "", QT_UINT32 (buffer + 8)); |
|
237 GST_LOG ("%*s n entries: %d", depth, "", QT_UINT32 (buffer + 12)); |
|
238 n = QT_UINT32 (buffer + 12); |
|
239 offset = 16; |
|
240 for (i = 0; i < n; i++) { |
|
241 GST_LOG ("%*s sample: %u", depth, "", |
|
242 QT_UINT32 (buffer + offset)); |
|
243 |
|
244 offset += 4; |
|
245 } |
|
246 } |
|
247 |
|
248 void |
|
249 qtdemux_dump_stss (GstQTDemux * qtdemux, guint8 * buffer, int depth) |
|
250 { |
|
251 int i; |
|
252 int n; |
|
253 int offset; |
|
254 |
|
255 GST_LOG ("%*s version/flags: %08x", depth, "", QT_UINT32 (buffer + 8)); |
|
256 GST_LOG ("%*s n entries: %d", depth, "", QT_UINT32 (buffer + 12)); |
|
257 n = QT_UINT32 (buffer + 12); |
|
258 offset = 16; |
|
259 for (i = 0; i < n; i++) { |
|
260 GST_LOG ("%*s sample: %u", depth, "", |
|
261 QT_UINT32 (buffer + offset)); |
|
262 |
|
263 offset += 4; |
|
264 } |
|
265 } |
|
266 |
|
267 void |
|
268 qtdemux_dump_stsc (GstQTDemux * qtdemux, guint8 * buffer, int depth) |
|
269 { |
|
270 int i; |
|
271 int n; |
|
272 int offset; |
|
273 |
|
274 GST_LOG ("%*s version/flags: %08x", depth, "", QT_UINT32 (buffer + 8)); |
|
275 GST_LOG ("%*s n entries: %d", depth, "", QT_UINT32 (buffer + 12)); |
|
276 n = QT_UINT32 (buffer + 12); |
|
277 offset = 16; |
|
278 for (i = 0; i < n; i++) { |
|
279 GST_LOG ("%*s first chunk: %u", depth, "", |
|
280 QT_UINT32 (buffer + offset)); |
|
281 GST_LOG ("%*s sample per ch: %u", depth, "", |
|
282 QT_UINT32 (buffer + offset + 4)); |
|
283 GST_LOG ("%*s sample desc id:%08x", depth, "", |
|
284 QT_UINT32 (buffer + offset + 8)); |
|
285 |
|
286 offset += 12; |
|
287 } |
|
288 } |
|
289 |
|
290 void |
|
291 qtdemux_dump_stsz (GstQTDemux * qtdemux, guint8 * buffer, int depth) |
|
292 { |
|
293 //int i; |
|
294 int n; |
|
295 int offset; |
|
296 int sample_size; |
|
297 |
|
298 GST_LOG ("%*s version/flags: %08x", depth, "", QT_UINT32 (buffer + 8)); |
|
299 sample_size = QT_UINT32 (buffer + 12); |
|
300 GST_LOG ("%*s sample size: %d", depth, "", sample_size); |
|
301 if (sample_size == 0) { |
|
302 GST_LOG ("%*s n entries: %d", depth, "", QT_UINT32 (buffer + 16)); |
|
303 n = QT_UINT32 (buffer + 16); |
|
304 offset = 20; |
|
305 #if 0 |
|
306 for (i = 0; i < n; i++) { |
|
307 GST_LOG ("%*s sample size: %u", depth, "", |
|
308 QT_UINT32 (buffer + offset)); |
|
309 |
|
310 offset += 4; |
|
311 } |
|
312 #endif |
|
313 } |
|
314 } |
|
315 |
|
316 void |
|
317 qtdemux_dump_stco (GstQTDemux * qtdemux, guint8 * buffer, int depth) |
|
318 { |
|
319 int i; |
|
320 int n; |
|
321 int offset; |
|
322 |
|
323 GST_LOG ("%*s version/flags: %08x", depth, "", QT_UINT32 (buffer + 8)); |
|
324 n = QT_UINT32 (buffer + 12); |
|
325 GST_LOG ("%*s n entries: %d", depth, "", n); |
|
326 offset = 16; |
|
327 for (i = 0; i < n; i++) { |
|
328 GST_LOG ("%*s chunk offset: %d", depth, "", |
|
329 QT_UINT32 (buffer + offset)); |
|
330 |
|
331 offset += 4; |
|
332 } |
|
333 } |
|
334 |
|
335 void |
|
336 qtdemux_dump_ctts (GstQTDemux * qtdemux, guint8 * buffer, int depth) |
|
337 { |
|
338 int i; |
|
339 int n; |
|
340 int offset; |
|
341 |
|
342 GST_LOG ("%*s version/flags: %08x", depth, "", QT_UINT32 (buffer + 8)); |
|
343 n = QT_UINT32 (buffer + 12); |
|
344 GST_LOG ("%*s n entries: %d", depth, "", n); |
|
345 offset = 16; |
|
346 for (i = 0; i < n; i++) { |
|
347 GST_LOG ("%*s sample count :%8d offset: %8d", |
|
348 depth, "", QT_UINT32 (buffer + offset), |
|
349 QT_UINT32 (buffer + offset + 4)); |
|
350 |
|
351 offset += 8; |
|
352 } |
|
353 } |
|
354 |
|
355 void |
|
356 qtdemux_dump_co64 (GstQTDemux * qtdemux, guint8 * buffer, int depth) |
|
357 { |
|
358 //int i; |
|
359 int n; |
|
360 int offset; |
|
361 |
|
362 GST_LOG ("%*s version/flags: %08x", depth, "", QT_UINT32 (buffer + 8)); |
|
363 GST_LOG ("%*s n entries: %d", depth, "", QT_UINT32 (buffer + 12)); |
|
364 n = QT_UINT32 (buffer + 12); |
|
365 offset = 16; |
|
366 #if 0 |
|
367 for (i = 0; i < n; i++) { |
|
368 GST_LOG ("%*s chunk offset: %" G_GUINT64_FORMAT, depth, "", |
|
369 QTDEMUX_GUINT64_GET (buffer + offset)); |
|
370 |
|
371 offset += 8; |
|
372 } |
|
373 #endif |
|
374 } |
|
375 |
|
376 void |
|
377 qtdemux_dump_dcom (GstQTDemux * qtdemux, guint8 * buffer, int depth) |
|
378 { |
|
379 GST_LOG ("%*s compression type: %" GST_FOURCC_FORMAT, depth, "", |
|
380 GST_FOURCC_ARGS (QT_FOURCC (buffer + 8))); |
|
381 } |
|
382 |
|
383 void |
|
384 qtdemux_dump_cmvd (GstQTDemux * qtdemux, guint8 * buffer, int depth) |
|
385 { |
|
386 GST_LOG ("%*s length: %d", depth, "", QT_UINT32 (buffer + 8)); |
|
387 } |
|
388 |
|
389 void |
|
390 qtdemux_dump_unknown (GstQTDemux * qtdemux, guint8 * buffer, int depth) |
|
391 { |
|
392 int len; |
|
393 |
|
394 GST_LOG ("%*s length: %d", depth, "", QT_UINT32 (buffer + 0)); |
|
395 |
|
396 len = QT_UINT32 (buffer + 0); |
|
397 GST_MEMDUMP_OBJECT (qtdemux, "unknown atom data", buffer, len); |
|
398 } |
|
399 |
|
400 static gboolean |
|
401 qtdemux_node_dump_foreach (GNode * node, gpointer qtdemux) |
|
402 { |
|
403 guint8 *buffer = (guint8 *) node->data; |
|
404 guint32 node_length; |
|
405 guint32 fourcc; |
|
406 const QtNodeType *type; |
|
407 int depth; |
|
408 |
|
409 node_length = GST_READ_UINT32_BE (buffer); |
|
410 fourcc = GST_READ_UINT32_LE (buffer + 4); |
|
411 |
|
412 type = qtdemux_type_get (fourcc); |
|
413 |
|
414 depth = (g_node_depth (node) - 1) * 2; |
|
415 GST_LOG ("%*s'%" GST_FOURCC_FORMAT "', [%d], %s", |
|
416 depth, "", GST_FOURCC_ARGS (fourcc), node_length, type->name); |
|
417 |
|
418 if (type->dump) |
|
419 type->dump (GST_QTDEMUX_CAST (qtdemux), buffer, depth); |
|
420 |
|
421 return FALSE; |
|
422 } |
|
423 |
|
424 void |
|
425 qtdemux_node_dump (GstQTDemux * qtdemux, GNode * node) |
|
426 { |
|
427 if (__gst_debug_min < GST_LEVEL_LOG) |
|
428 return; |
|
429 |
|
430 g_node_traverse (qtdemux->moov_node, G_PRE_ORDER, G_TRAVERSE_ALL, -1, |
|
431 qtdemux_node_dump_foreach, qtdemux); |
|
432 } |
|