2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3 * Copyright (C) 2009 Tim-Philipp Müller <tim centricular net>
4 * Copyright (C) <2009> STEricsson <benjamin.gaignard@stericsson.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
22 #include "qtdemux_types.h"
23 #include "qtdemux_dump.h"
25 #include "qtatomparser.h"
29 #define GET_UINT8(data) gst_byte_reader_get_uint8_unchecked(data)
30 #define GET_UINT16(data) gst_byte_reader_get_uint16_be_unchecked(data)
31 #define GET_UINT32(data) gst_byte_reader_get_uint32_be_unchecked(data)
32 #define GET_UINT64(data) gst_byte_reader_get_uint64_be_unchecked(data)
33 #define GET_FP32(data) (gst_byte_reader_get_uint32_be_unchecked(data)/65536.0)
34 #define GET_FP16(data) (gst_byte_reader_get_uint16_be_unchecked(data)/256.0)
35 #define GET_FOURCC(data) qt_atom_parser_get_fourcc_unchecked(data)
38 qtdemux_dump_mvhd (GstQTDemux * qtdemux, GstByteReader * data, int depth)
42 if (!qt_atom_parser_has_remaining (data, 100))
45 version = GET_UINT32 (data);
46 GST_LOG ("%*s version/flags: %08x", depth, "", version);
48 version = version >> 24;
50 GST_LOG ("%*s creation time: %u", depth, "", GET_UINT32 (data));
51 GST_LOG ("%*s modify time: %u", depth, "", GET_UINT32 (data));
52 GST_LOG ("%*s time scale: 1/%u sec", depth, "", GET_UINT32 (data));
53 GST_LOG ("%*s duration: %u", depth, "", GET_UINT32 (data));
54 } else if (version == 1) {
55 GST_LOG ("%*s creation time: %" G_GUINT64_FORMAT,
56 depth, "", GET_UINT64 (data));
57 GST_LOG ("%*s modify time: %" G_GUINT64_FORMAT,
58 depth, "", GET_UINT64 (data));
59 GST_LOG ("%*s time scale: 1/%u sec", depth, "", GET_UINT32 (data));
60 GST_LOG ("%*s duration: %" G_GUINT64_FORMAT,
61 depth, "", GET_UINT64 (data));
65 GST_LOG ("%*s pref. rate: %g", depth, "", GET_FP32 (data));
66 GST_LOG ("%*s pref. volume: %g", depth, "", GET_FP16 (data));
67 gst_byte_reader_skip (data, 46);
68 GST_LOG ("%*s preview time: %u", depth, "", GET_UINT32 (data));
69 GST_LOG ("%*s preview dur.: %u", depth, "", GET_UINT32 (data));
70 GST_LOG ("%*s poster time: %u", depth, "", GET_UINT32 (data));
71 GST_LOG ("%*s select time: %u", depth, "", GET_UINT32 (data));
72 GST_LOG ("%*s select dur.: %u", depth, "", GET_UINT32 (data));
73 GST_LOG ("%*s current time: %u", depth, "", GET_UINT32 (data));
74 GST_LOG ("%*s next track ID: %d", depth, "", GET_UINT32 (data));
79 qtdemux_dump_tkhd (GstQTDemux * qtdemux, GstByteReader * data, int depth)
81 guint64 duration, ctime, mtime;
82 guint32 version = 0, track_id = 0, iwidth = 0, iheight = 0;
83 guint16 layer = 0, alt_group = 0, ivol = 0;
86 if (!gst_byte_reader_get_uint32_be (data, &version))
89 GST_LOG ("%*s version/flags: %08x", depth, "", version);
91 value_size = ((version >> 24) == 1) ? sizeof (guint64) : sizeof (guint32);
93 if (qt_atom_parser_get_offset (data, value_size, &ctime) &&
94 qt_atom_parser_get_offset (data, value_size, &mtime) &&
95 gst_byte_reader_get_uint32_be (data, &track_id) &&
96 gst_byte_reader_skip (data, 4) &&
97 qt_atom_parser_get_offset (data, value_size, &duration) &&
98 gst_byte_reader_skip (data, 4) &&
99 gst_byte_reader_get_uint16_be (data, &layer) &&
100 gst_byte_reader_get_uint16_be (data, &alt_group) &&
101 gst_byte_reader_skip (data, 4) &&
102 gst_byte_reader_get_uint16_be (data, &ivol) &&
103 gst_byte_reader_skip (data, 2 + (9 * 4)) &&
104 gst_byte_reader_get_uint32_be (data, &iwidth) &&
105 gst_byte_reader_get_uint32_be (data, &iheight)) {
106 GST_LOG ("%*s creation time: %" G_GUINT64_FORMAT, depth, "", ctime);
107 GST_LOG ("%*s modify time: %" G_GUINT64_FORMAT, depth, "", mtime);
108 GST_LOG ("%*s track ID: %u", depth, "", track_id);
109 GST_LOG ("%*s duration: %" G_GUINT64_FORMAT, depth, "", duration);
110 GST_LOG ("%*s layer: %u", depth, "", layer);
111 GST_LOG ("%*s alt group: %u", depth, "", alt_group);
112 GST_LOG ("%*s volume: %g", depth, "", ivol / 256.0);
113 GST_LOG ("%*s track width: %g", depth, "", iwidth / 65536.0);
114 GST_LOG ("%*s track height: %g", depth, "", iheight / 65536.0);
122 qtdemux_dump_elst (GstQTDemux * qtdemux, GstByteReader * data, int depth)
124 guint32 ver_flags = 0, num_entries = 0, i;
126 if (!gst_byte_reader_get_uint32_be (data, &ver_flags) ||
127 !gst_byte_reader_get_uint32_be (data, &num_entries))
130 GST_LOG ("%*s version/flags: %08x", depth, "", ver_flags);
131 GST_LOG ("%*s n entries: %d", depth, "", num_entries);
133 if (!qt_atom_parser_has_chunks (data, num_entries, 4 + 4 + 4))
136 for (i = 0; i < num_entries; i++) {
137 GST_LOG ("%*s track dur: %u", depth, "", GET_UINT32 (data));
138 GST_LOG ("%*s media time: %u", depth, "", GET_UINT32 (data));
139 GST_LOG ("%*s media rate: %g", depth, "", GET_FP32 (data));
145 qtdemux_dump_mdhd (GstQTDemux * qtdemux, GstByteReader * data, int depth)
148 guint64 duration, ctime, mtime;
149 guint32 time_scale = 0;
150 guint16 language = 0, quality = 0;
153 if (!gst_byte_reader_get_uint32_be (data, &version))
156 GST_LOG ("%*s version/flags: %08x", depth, "", version);
158 value_size = ((version >> 24) == 1) ? sizeof (guint64) : sizeof (guint32);
160 if (qt_atom_parser_get_offset (data, value_size, &ctime) &&
161 qt_atom_parser_get_offset (data, value_size, &mtime) &&
162 gst_byte_reader_get_uint32_be (data, &time_scale) &&
163 qt_atom_parser_get_offset (data, value_size, &duration) &&
164 gst_byte_reader_get_uint16_be (data, &language) &&
165 gst_byte_reader_get_uint16_be (data, &quality)) {
166 GST_LOG ("%*s creation time: %" G_GUINT64_FORMAT, depth, "", ctime);
167 GST_LOG ("%*s modify time: %" G_GUINT64_FORMAT, depth, "", mtime);
168 GST_LOG ("%*s time scale: 1/%u sec", depth, "", time_scale);
169 GST_LOG ("%*s duration: %" G_GUINT64_FORMAT, depth, "", duration);
170 GST_LOG ("%*s language: %u", depth, "", language);
171 GST_LOG ("%*s quality: %u", depth, "", quality);
179 qtdemux_dump_hdlr (GstQTDemux * qtdemux, GstByteReader * data, int depth)
181 guint32 version, type, subtype, manufacturer;
184 if (!qt_atom_parser_has_remaining (data, 4 + 4 + 4 + 4 + 4 + 4 + 1))
187 version = GET_UINT32 (data);
188 type = GET_FOURCC (data);
189 subtype = GET_FOURCC (data);
190 manufacturer = GET_FOURCC (data);
192 GST_LOG ("%*s version/flags: %08x", depth, "", version);
193 GST_LOG ("%*s type: %" GST_FOURCC_FORMAT, depth, "",
194 GST_FOURCC_ARGS (type));
195 GST_LOG ("%*s subtype: %" GST_FOURCC_FORMAT, depth, "",
196 GST_FOURCC_ARGS (subtype));
197 GST_LOG ("%*s manufacturer: %" GST_FOURCC_FORMAT, depth, "",
198 GST_FOURCC_ARGS (manufacturer));
199 GST_LOG ("%*s flags: %08x", depth, "", GET_UINT32 (data));
200 GST_LOG ("%*s flags mask: %08x", depth, "", GET_UINT32 (data));
202 /* quicktime uses pascal string, mp4 zero-terminated string */
203 if (gst_byte_reader_peek_string (data, &name)) {
204 GST_LOG ("%*s name: %s", depth, "", name);
209 len = gst_byte_reader_get_uint8_unchecked (data);
210 if (qt_atom_parser_has_remaining (data, len)) {
211 memcpy (buf, gst_byte_reader_peek_data_unchecked (data), len);
213 GST_LOG ("%*s name: %s", depth, "", buf);
220 qtdemux_dump_vmhd (GstQTDemux * qtdemux, GstByteReader * data, int depth)
222 if (!qt_atom_parser_has_remaining (data, 4 + 4))
225 GST_LOG ("%*s version/flags: %08x", depth, "", GET_UINT32 (data));
226 GST_LOG ("%*s mode/color: %08x", depth, "", GET_UINT32 (data));
231 qtdemux_dump_dref (GstQTDemux * qtdemux, GstByteReader * data, int depth)
233 guint32 ver_flags = 0, num_entries = 0, i;
235 if (!gst_byte_reader_get_uint32_be (data, &ver_flags) ||
236 !gst_byte_reader_get_uint32_be (data, &num_entries))
239 GST_LOG ("%*s version/flags: %08x", depth, "", ver_flags);
240 GST_LOG ("%*s n entries: %u", depth, "", num_entries);
241 for (i = 0; i < num_entries; i++) {
242 guint32 size = 0, fourcc;
244 if (!gst_byte_reader_get_uint32_be (data, &size) ||
245 !qt_atom_parser_get_fourcc (data, &fourcc) || size < 8 ||
246 !gst_byte_reader_skip (data, size - 8))
249 GST_LOG ("%*s size: %u", depth, "", size);
250 GST_LOG ("%*s type: %" GST_FOURCC_FORMAT, depth, "",
251 GST_FOURCC_ARGS (fourcc));
257 qtdemux_dump_stsd (GstQTDemux * qtdemux, GstByteReader * data, int depth)
259 guint32 ver_flags = 0, num_entries = 0, i;
261 if (!gst_byte_reader_get_uint32_be (data, &ver_flags) ||
262 !gst_byte_reader_get_uint32_be (data, &num_entries))
265 GST_LOG ("%*s version/flags: %08x", depth, "", ver_flags);
266 GST_LOG ("%*s n entries: %d", depth, "", num_entries);
268 for (i = 0; i < num_entries; i++) {
270 guint32 size = 0, fourcc;
272 if (!gst_byte_reader_get_uint32_be (data, &size) ||
273 !qt_atom_parser_get_fourcc (data, &fourcc))
276 GST_LOG ("%*s size: %u", depth, "", size);
277 GST_LOG ("%*s type: %" GST_FOURCC_FORMAT, depth, "",
278 GST_FOURCC_ARGS (fourcc));
280 if (size < (6 + 2 + 4 + 4 + 4 + 4 + 2 + 2 + 4 + 4 + 4 + 2 + 1 + 31 + 2 + 2))
283 qt_atom_parser_peek_sub (data, 0, 78, &sub);
284 gst_byte_reader_skip (&sub, 6);
285 GST_LOG ("%*s data reference:%d", depth, "", GET_UINT16 (&sub));
286 GST_LOG ("%*s version/rev.: %08x", depth, "", GET_UINT32 (&sub));
287 fourcc = GET_FOURCC (&sub);
288 GST_LOG ("%*s vendor: %" GST_FOURCC_FORMAT, depth, "",
289 GST_FOURCC_ARGS (fourcc));
290 GST_LOG ("%*s temporal qual: %u", depth, "", GET_UINT32 (&sub));
291 GST_LOG ("%*s spatial qual: %u", depth, "", GET_UINT32 (&sub));
292 GST_LOG ("%*s width: %u", depth, "", GET_UINT16 (&sub));
293 GST_LOG ("%*s height: %u", depth, "", GET_UINT16 (&sub));
294 GST_LOG ("%*s horiz. resol: %g", depth, "", GET_FP32 (&sub));
295 GST_LOG ("%*s vert. resol.: %g", depth, "", GET_FP32 (&sub));
296 GST_LOG ("%*s data size: %u", depth, "", GET_UINT32 (&sub));
297 GST_LOG ("%*s frame count: %u", depth, "", GET_UINT16 (&sub));
298 /* something is not right with this, it's supposed to be a string but it's
299 * not apparently, so just skip this for now */
300 gst_byte_reader_skip (&sub, 1 + 31);
301 GST_LOG ("%*s compressor: (skipped)", depth, "");
302 GST_LOG ("%*s depth: %u", depth, "", GET_UINT16 (&sub));
303 GST_LOG ("%*s color table ID:%u", depth, "", GET_UINT16 (&sub));
304 if (!gst_byte_reader_skip (data, size - (4 + 4)))
311 qtdemux_dump_stts (GstQTDemux * qtdemux, GstByteReader * data, int depth)
313 guint32 ver_flags = 0, num_entries = 0, i;
315 if (!gst_byte_reader_get_uint32_be (data, &ver_flags) ||
316 !gst_byte_reader_get_uint32_be (data, &num_entries))
319 GST_LOG ("%*s version/flags: %08x", depth, "", ver_flags);
320 GST_LOG ("%*s n entries: %d", depth, "", num_entries);
322 if (!qt_atom_parser_has_chunks (data, num_entries, 4 + 4))
325 for (i = 0; i < num_entries; i++) {
326 GST_LOG ("%*s count: %u", depth, "", GET_UINT32 (data));
327 GST_LOG ("%*s duration: %u", depth, "", GET_UINT32 (data));
333 qtdemux_dump_stss (GstQTDemux * qtdemux, GstByteReader * data, int depth)
335 guint32 ver_flags = 0, num_entries = 0, i;
337 if (!gst_byte_reader_get_uint32_be (data, &ver_flags) ||
338 !gst_byte_reader_get_uint32_be (data, &num_entries))
341 GST_LOG ("%*s version/flags: %08x", depth, "", ver_flags);
342 GST_LOG ("%*s n entries: %d", depth, "", num_entries);
344 if (!qt_atom_parser_has_chunks (data, num_entries, 4))
347 for (i = 0; i < num_entries; i++) {
348 GST_LOG ("%*s sample: %u", depth, "", GET_UINT32 (data));
354 qtdemux_dump_stsc (GstQTDemux * qtdemux, GstByteReader * data, int depth)
356 guint32 ver_flags = 0, num_entries = 0, i;
358 if (!gst_byte_reader_get_uint32_be (data, &ver_flags) ||
359 !gst_byte_reader_get_uint32_be (data, &num_entries))
362 GST_LOG ("%*s version/flags: %08x", depth, "", ver_flags);
363 GST_LOG ("%*s n entries: %d", depth, "", num_entries);
365 if (!qt_atom_parser_has_chunks (data, num_entries, 4 + 4 + 4))
368 for (i = 0; i < num_entries; i++) {
369 GST_LOG ("%*s first chunk: %u", depth, "", GET_UINT32 (data));
370 GST_LOG ("%*s sample per ch: %u", depth, "", GET_UINT32 (data));
371 GST_LOG ("%*s sample desc id:%08x", depth, "", GET_UINT32 (data));
377 qtdemux_dump_stsz (GstQTDemux * qtdemux, GstByteReader * data, int depth)
379 guint32 ver_flags = 0, sample_size = 0, num_entries = 0;
381 if (!gst_byte_reader_get_uint32_be (data, &ver_flags) ||
382 !gst_byte_reader_get_uint32_be (data, &sample_size))
385 GST_LOG ("%*s version/flags: %08x", depth, "", ver_flags);
386 GST_LOG ("%*s sample size: %d", depth, "", sample_size);
388 if (sample_size == 0) {
389 if (!gst_byte_reader_get_uint32_be (data, &num_entries))
392 GST_LOG ("%*s n entries: %d", depth, "", num_entries);
394 if (!qt_atom_parser_has_chunks (data, num_entries, 4))
396 for (i = 0; i < num_entries; i++) {
397 GST_LOG ("%*s sample size: %u", depth, "", GET_UINT32 (data));
405 qtdemux_dump_stco (GstQTDemux * qtdemux, GstByteReader * data, int depth)
407 guint32 ver_flags = 0, num_entries = 0, i;
409 if (!gst_byte_reader_get_uint32_be (data, &ver_flags) ||
410 !gst_byte_reader_get_uint32_be (data, &num_entries))
413 GST_LOG ("%*s version/flags: %08x", depth, "", ver_flags);
414 GST_LOG ("%*s n entries: %d", depth, "", num_entries);
416 if (!qt_atom_parser_has_chunks (data, num_entries, 4))
419 for (i = 0; i < num_entries; i++) {
420 GST_LOG ("%*s chunk offset: %u", depth, "", GET_UINT32 (data));
426 qtdemux_dump_ctts (GstQTDemux * qtdemux, GstByteReader * data, int depth)
428 guint32 ver_flags = 0, num_entries = 0, i, count, offset;
430 if (!gst_byte_reader_get_uint32_be (data, &ver_flags) ||
431 !gst_byte_reader_get_uint32_be (data, &num_entries))
434 GST_LOG ("%*s version/flags: %08x", depth, "", ver_flags);
435 GST_LOG ("%*s n entries: %d", depth, "", num_entries);
437 if (!qt_atom_parser_has_chunks (data, num_entries, 4 + 4))
440 for (i = 0; i < num_entries; i++) {
441 count = GET_UINT32 (data);
442 offset = GET_UINT32 (data);
443 GST_LOG ("%*s sample count :%8d offset: %8d", depth, "", count, offset);
449 qtdemux_dump_co64 (GstQTDemux * qtdemux, GstByteReader * data, int depth)
451 guint32 ver_flags = 0, num_entries = 0, i;
453 if (!gst_byte_reader_get_uint32_be (data, &ver_flags) ||
454 !gst_byte_reader_get_uint32_be (data, &num_entries))
457 GST_LOG ("%*s version/flags: %08x", depth, "", ver_flags);
458 GST_LOG ("%*s n entries: %d", depth, "", num_entries);
460 if (!qt_atom_parser_has_chunks (data, num_entries, 8))
463 for (i = 0; i < num_entries; i++) {
464 GST_LOG ("%*s chunk offset: %" G_GUINT64_FORMAT, depth, "",
471 qtdemux_dump_mfro (GstQTDemux * qtdemux, GstByteReader * data, int depth)
473 if (!qt_atom_parser_has_remaining (data, 4))
476 GST_LOG ("%*s size: %d", depth, "", GET_UINT32 (data));
481 qtdemux_dump_tfra (GstQTDemux * qtdemux, GstByteReader * data, int depth)
483 guint64 time = 0, moof_offset = 0;
484 guint32 len = 0, num_entries = 0, ver_flags = 0, track_id = 0, i;
485 guint value_size, traf_size, trun_size, sample_size;
487 if (!gst_byte_reader_get_uint32_be (data, &ver_flags))
490 GST_LOG ("%*s version/flags: %08x", depth, "", ver_flags);
492 if (!gst_byte_reader_get_uint32_be (data, &track_id) ||
493 gst_byte_reader_get_uint32_be (data, &len) ||
494 gst_byte_reader_get_uint32_be (data, &num_entries))
497 GST_LOG ("%*s track ID: %u", depth, "", track_id);
498 GST_LOG ("%*s length: 0x%x", depth, "", len);
499 GST_LOG ("%*s n entries: %u", depth, "", num_entries);
501 value_size = ((ver_flags >> 24) == 1) ? sizeof (guint64) : sizeof (guint32);
502 sample_size = (len & 3) + 1;
503 trun_size = ((len & 12) >> 2) + 1;
504 traf_size = ((len & 48) >> 4) + 1;
506 if (!qt_atom_parser_has_chunks (data, num_entries,
507 value_size + value_size + traf_size + trun_size + sample_size))
510 for (i = 0; i < num_entries; i++) {
511 qt_atom_parser_get_offset (data, value_size, &time);
512 qt_atom_parser_get_offset (data, value_size, &moof_offset);
513 GST_LOG ("%*s time: %" G_GUINT64_FORMAT, depth, "", time);
514 GST_LOG ("%*s moof_offset: %" G_GUINT64_FORMAT,
515 depth, "", moof_offset);
516 GST_LOG ("%*s traf_number: %u", depth, "",
517 qt_atom_parser_get_uint_with_size_unchecked (data, traf_size));
518 GST_LOG ("%*s trun_number: %u", depth, "",
519 qt_atom_parser_get_uint_with_size_unchecked (data, trun_size));
520 GST_LOG ("%*s sample_number: %u", depth, "",
521 qt_atom_parser_get_uint_with_size_unchecked (data, sample_size));
528 qtdemux_dump_tfhd (GstQTDemux * qtdemux, GstByteReader * data, int depth)
530 guint32 flags = 0, n = 0, track_id = 0;
531 guint64 base_data_offset = 0;
533 if (!gst_byte_reader_skip (data, 1) ||
534 !gst_byte_reader_get_uint24_be (data, &flags))
536 GST_LOG ("%*s flags: %08x", depth, "", flags);
538 if (!gst_byte_reader_get_uint32_be (data, &track_id))
540 GST_LOG ("%*s track_id: %u", depth, "", track_id);
542 if (flags & TF_BASE_DATA_OFFSET) {
543 if (!gst_byte_reader_get_uint64_be (data, &base_data_offset))
545 GST_LOG ("%*s base-data-offset: %" G_GUINT64_FORMAT,
546 depth, "", base_data_offset);
549 if (flags & TF_SAMPLE_DESCRIPTION_INDEX) {
550 if (!gst_byte_reader_get_uint32_be (data, &n))
552 GST_LOG ("%*s sample-description-index: %u", depth, "", n);
555 if (flags & TF_DEFAULT_SAMPLE_DURATION) {
556 if (!gst_byte_reader_get_uint32_be (data, &n))
558 GST_LOG ("%*s default-sample-duration: %u", depth, "", n);
561 if (flags & TF_DEFAULT_SAMPLE_SIZE) {
562 if (!gst_byte_reader_get_uint32_be (data, &n))
564 GST_LOG ("%*s default-sample-size: %u", depth, "", n);
567 if (flags & TF_DEFAULT_SAMPLE_FLAGS) {
568 if (!gst_byte_reader_get_uint32_be (data, &n))
570 GST_LOG ("%*s default-sample-flags: %u", depth, "", n);
573 GST_LOG ("%*s duration-is-empty: %s", depth, "",
574 flags & TF_DURATION_IS_EMPTY ? "yes" : "no");
580 qtdemux_dump_trun (GstQTDemux * qtdemux, GstByteReader * data, int depth)
582 guint32 flags = 0, samples_count = 0, data_offset = 0, first_sample_flags = 0;
583 guint32 sample_duration = 0, sample_size = 0, sample_flags =
584 0, composition_time_offsets = 0;
587 if (!gst_byte_reader_skip (data, 1) ||
588 !gst_byte_reader_get_uint24_be (data, &flags))
591 GST_LOG ("%*s flags: %08x", depth, "", flags);
593 if (!gst_byte_reader_get_uint32_be (data, &samples_count))
595 GST_LOG ("%*s samples_count: %u", depth, "", samples_count);
597 if (flags & TR_DATA_OFFSET) {
598 if (!gst_byte_reader_get_uint32_be (data, &data_offset))
600 GST_LOG ("%*s data-offset: %u", depth, "", data_offset);
603 if (flags & TR_FIRST_SAMPLE_FLAGS) {
604 if (!gst_byte_reader_get_uint32_be (data, &first_sample_flags))
606 GST_LOG ("%*s first-sample-flags: %u", depth, "", first_sample_flags);
609 for (i = 0; i < samples_count; i++) {
610 if (flags & TR_SAMPLE_DURATION) {
611 if (!gst_byte_reader_get_uint32_be (data, &sample_duration))
613 GST_LOG ("%*s sample-duration: %u", depth, "", sample_duration);
616 if (flags & TR_SAMPLE_SIZE) {
617 if (!gst_byte_reader_get_uint32_be (data, &sample_size))
619 GST_LOG ("%*s sample-size: %u", depth, "", sample_size);
622 if (flags & TR_SAMPLE_FLAGS) {
623 if (!gst_byte_reader_get_uint32_be (data, &sample_flags))
625 GST_LOG ("%*s sample-flags: %u", depth, "", sample_flags);
628 if (flags & TR_COMPOSITION_TIME_OFFSETS) {
629 if (!gst_byte_reader_get_uint32_be (data, &composition_time_offsets))
631 GST_LOG ("%*s composition_time_offsets: %u", depth, "",
632 composition_time_offsets);
640 qtdemux_dump_trex (GstQTDemux * qtdemux, GstByteReader * data, int depth)
642 if (!qt_atom_parser_has_remaining (data, 4 + 4 + 4 + 4 + 4 + 4))
645 GST_LOG ("%*s version/flags: %08x", depth, "", GET_UINT32 (data));
646 GST_LOG ("%*s track ID: %08x", depth, "", GET_UINT32 (data));
647 GST_LOG ("%*s default sample desc. index: %08x", depth, "",
649 GST_LOG ("%*s default sample duration: %08x", depth, "",
651 GST_LOG ("%*s default sample size: %08x", depth, "",
653 GST_LOG ("%*s default sample flags: %08x", depth, "",
660 qtdemux_dump_mehd (GstQTDemux * qtdemux, GstByteReader * data, int depth)
663 guint64 fragment_duration;
666 if (!gst_byte_reader_get_uint32_be (data, &version))
669 GST_LOG ("%*s version/flags: %08x", depth, "", version);
671 value_size = ((version >> 24) == 1) ? sizeof (guint64) : sizeof (guint32);
672 if (qt_atom_parser_get_offset (data, value_size, &fragment_duration)) {
673 GST_LOG ("%*s fragment duration: %" G_GUINT64_FORMAT,
674 depth, "", fragment_duration);
682 qtdemux_dump_sdtp (GstQTDemux * qtdemux, GstByteReader * data, int depth)
688 version = GET_UINT32 (data);
689 GST_LOG ("%*s version/flags: %08x", depth, "", version);
691 /* the sample_count is specified in the stsz or stz2 box.
692 * the information for a sample is stored in a single byte,
693 * so we read until there are no remaining bytes */
694 while (qt_atom_parser_has_remaining (data, 1)) {
695 val = GET_UINT8 (data);
696 GST_LOG ("%*s sample number: %d", depth, "", i);
697 GST_LOG ("%*s sample_depends_on: %d", depth, "",
698 ((guint16) (val)) & 0x3);
699 GST_LOG ("%*s sample_is_depended_on: %d", depth, "",
700 ((guint16) (val >> 2)) & 0x3);
701 GST_LOG ("%*s sample_has_redundancy: %d", depth, "",
702 ((guint16) (val >> 4)) & 0x3);
709 qtdemux_dump_unknown (GstQTDemux * qtdemux, GstByteReader * data, int depth)
713 len = gst_byte_reader_get_remaining (data);
714 GST_LOG ("%*s length: %d", depth, "", len);
716 GST_MEMDUMP_OBJECT (qtdemux, "unknown atom data",
717 gst_byte_reader_peek_data_unchecked (data), len);
722 qtdemux_node_dump_foreach (GNode * node, gpointer qtdemux)
724 GstByteReader parser;
725 guint8 *buffer = (guint8 *) node->data; /* FIXME: move to byte reader */
728 const QtNodeType *type;
731 node_length = GST_READ_UINT32_BE (buffer);
732 fourcc = GST_READ_UINT32_LE (buffer + 4);
734 g_warn_if_fail (node_length >= 8);
736 gst_byte_reader_init (&parser, buffer + 8, node_length - 8);
738 type = qtdemux_type_get (fourcc);
740 depth = (g_node_depth (node) - 1) * 2;
741 GST_LOG ("%*s'%" GST_FOURCC_FORMAT "', [%d], %s",
742 depth, "", GST_FOURCC_ARGS (fourcc), node_length, type->name);
747 ret = type->dump (GST_QTDEMUX_CAST (qtdemux), &parser, depth);
750 GST_WARNING ("%*s not enough data parsing atom %" GST_FOURCC_FORMAT,
751 depth, "", GST_FOURCC_ARGS (fourcc));
759 qtdemux_node_dump (GstQTDemux * qtdemux, GNode * node)
761 if (__gst_debug_min < GST_LEVEL_LOG)
764 g_node_traverse (node, G_PRE_ORDER, G_TRAVERSE_ALL, -1,
765 qtdemux_node_dump_foreach, qtdemux);