Commit 57b8d0d6 authored by David Schleef's avatar David Schleef

gst/qtdemux/qtdemux.c: Change all g_print()s to debugging. Add a bunch of consistency checks.

Original commit message from CVS:
* gst/qtdemux/qtdemux.c: (gst_qtdemux_loop_header),
(gst_qtdemux_add_stream), (qtdemux_parse), (qtdemux_parse_tree),
(qtdemux_parse_udta), (qtdemux_tag_add), (gst_qtdemux_handle_esds):
Change all g_print()s to debugging.  Add a bunch of consistency
checks.
parent e12e8b02
2004-11-02 David Schleef <ds@schleef.org>
* gst/qtdemux/qtdemux.c: (gst_qtdemux_loop_header),
(gst_qtdemux_add_stream), (qtdemux_parse), (qtdemux_parse_tree),
(qtdemux_parse_udta), (qtdemux_tag_add), (gst_qtdemux_handle_esds):
Change all g_print()s to debugging. Add a bunch of consistency
checks.
2004-11-02 Wim Taymans <wim@fluendo.com> 2004-11-02 Wim Taymans <wim@fluendo.com>
* gst/playback/gstdecodebin.c: (gst_decode_bin_class_init), * gst/playback/gstdecodebin.c: (gst_decode_bin_class_init),
......
...@@ -31,7 +31,6 @@ GST_DEBUG_CATEGORY_EXTERN (qtdemux_debug); ...@@ -31,7 +31,6 @@ GST_DEBUG_CATEGORY_EXTERN (qtdemux_debug);
#define GST_CAT_DEFAULT qtdemux_debug #define GST_CAT_DEFAULT qtdemux_debug
/* temporary hack */ /* temporary hack */
#define g_print(...) /* */
#define gst_util_dump_mem(a,b) /* */ #define gst_util_dump_mem(a,b) /* */
#define QTDEMUX_GUINT32_GET(a) (GST_READ_UINT32_BE(a)) #define QTDEMUX_GUINT32_GET(a) (GST_READ_UINT32_BE(a))
...@@ -773,7 +772,7 @@ gst_qtdemux_loop_header (GstElement * element) ...@@ -773,7 +772,7 @@ gst_qtdemux_loop_header (GstElement * element)
} }
gst_event_unref (event); gst_event_unref (event);
} }
g_print ("Pushing buf with time=%" GST_TIME_FORMAT "\n", GST_DEBUG ("Pushing buf with time=%" GST_TIME_FORMAT "\n",
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf))); GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
gst_pad_push (stream->pad, GST_DATA (buf)); gst_pad_push (stream->pad, GST_DATA (buf));
...@@ -836,7 +835,7 @@ gst_qtdemux_add_stream (GstQTDemux * qtdemux, QtDemuxStream * stream) ...@@ -836,7 +835,7 @@ gst_qtdemux_add_stream (GstQTDemux * qtdemux, QtDemuxStream * stream)
gst_pad_set_formats_function (stream->pad, gst_qtdemux_get_src_formats); gst_pad_set_formats_function (stream->pad, gst_qtdemux_get_src_formats);
gst_pad_set_convert_function (stream->pad, gst_qtdemux_src_convert); gst_pad_set_convert_function (stream->pad, gst_qtdemux_src_convert);
g_print ("setting caps %s\n", gst_caps_to_string (stream->caps)); GST_DEBUG ("setting caps %s\n", gst_caps_to_string (stream->caps));
gst_pad_set_explicit_caps (stream->pad, stream->caps); gst_pad_set_explicit_caps (stream->pad, stream->caps);
GST_DEBUG ("adding pad %s %p to qtdemux %p", GST_DEBUG ("adding pad %s %p to qtdemux %p",
...@@ -1138,7 +1137,11 @@ qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer, int length) ...@@ -1138,7 +1137,11 @@ qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer, int length)
} }
len = QTDEMUX_GUINT32_GET (buf); len = QTDEMUX_GUINT32_GET (buf);
if (len < 8) { if (len < 8) {
GST_LOG ("bad length"); GST_ERROR ("atom length too short (%d < 8)", len);
break;
}
if (len > (end - buf)) {
GST_ERROR ("atom length too long (%d > %d)", len, end - buf);
break; break;
} }
...@@ -1165,6 +1168,14 @@ qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer, int length) ...@@ -1165,6 +1168,14 @@ qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer, int length)
GST_LOG ("buffer overrun"); GST_LOG ("buffer overrun");
} }
len = QTDEMUX_GUINT32_GET (buf); len = QTDEMUX_GUINT32_GET (buf);
if (len < 8) {
GST_ERROR ("length too short (%d < 8)");
break;
}
if (len > (end - buf)) {
GST_ERROR ("length too long (%d > %d)", len, end - buf);
break;
}
child = g_node_new (buf); child = g_node_new (buf);
g_node_append (node, child); g_node_append (node, child);
...@@ -1189,6 +1200,14 @@ qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer, int length) ...@@ -1189,6 +1200,14 @@ qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer, int length)
GST_LOG ("buffer overrun"); GST_LOG ("buffer overrun");
} }
len = QTDEMUX_GUINT32_GET (buf); len = QTDEMUX_GUINT32_GET (buf);
if (len < 8) {
GST_ERROR ("length too short (%d < 8)");
break;
}
if (len > (end - buf)) {
GST_ERROR ("length too long (%d > %d)", len, end - buf);
break;
}
child = g_node_new (buf); child = g_node_new (buf);
g_node_append (node, child); g_node_append (node, child);
...@@ -1203,9 +1222,9 @@ qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer, int length) ...@@ -1203,9 +1222,9 @@ qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer, int length)
guint32 version; guint32 version;
int tlen; int tlen;
g_print ("parsing in mp4v\n"); GST_DEBUG ("parsing in mp4v\n");
version = QTDEMUX_GUINT32_GET (buffer + 16); version = QTDEMUX_GUINT32_GET (buffer + 16);
g_print ("version %08x\n", version); GST_DEBUG ("version %08x\n", version);
if (1 || version == 0x00000000) { if (1 || version == 0x00000000) {
buf = buffer + 0x32; buf = buffer + 0x32;
...@@ -1215,9 +1234,9 @@ qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer, int length) ...@@ -1215,9 +1234,9 @@ qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer, int length)
* the iso format uses C strings. Check the file * the iso format uses C strings. Check the file
* type before attempting to parse the string here. */ * type before attempting to parse the string here. */
tlen = QTDEMUX_GUINT8_GET (buf); tlen = QTDEMUX_GUINT8_GET (buf);
g_print ("tlen = %d\n", tlen); GST_DEBUG ("tlen = %d\n", tlen);
buf++; buf++;
g_print ("string = %.*s\n", tlen, (char *) buf); GST_DEBUG ("string = %.*s\n", tlen, (char *) buf);
/* the string has a reserved space of 32 bytes so skip /* the string has a reserved space of 32 bytes so skip
* the remaining 31 */ * the remaining 31 */
buf += 31; buf += 31;
...@@ -1234,6 +1253,14 @@ qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer, int length) ...@@ -1234,6 +1253,14 @@ qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer, int length)
len = QTDEMUX_GUINT32_GET (buf); len = QTDEMUX_GUINT32_GET (buf);
if (len == 0) if (len == 0)
break; break;
if (len < 8) {
GST_ERROR ("length too short (%d < 8)");
break;
}
if (len > (end - buf)) {
GST_ERROR ("length too long (%d > %d)", len, end - buf);
break;
}
child = g_node_new (buf); child = g_node_new (buf);
g_node_append (node, child); g_node_append (node, child);
...@@ -1257,7 +1284,11 @@ qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer, int length) ...@@ -1257,7 +1284,11 @@ qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer, int length)
} }
len = QTDEMUX_GUINT32_GET (buf); len = QTDEMUX_GUINT32_GET (buf);
if (len < 8) { if (len < 8) {
GST_LOG ("bad length"); GST_ERROR ("length too short (%d < 8)");
break;
}
if (len > (end - buf)) {
GST_ERROR ("length too long (%d > %d)", len, end - buf);
break; break;
} }
...@@ -1277,16 +1308,16 @@ qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer, int length) ...@@ -1277,16 +1308,16 @@ qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer, int length)
buf = buffer + 12; buf = buffer + 12;
end = buffer + length; end = buffer + length;
version = QTDEMUX_GUINT32_GET (buffer + 16); version = QTDEMUX_GUINT32_GET (buffer + 16);
g_print ("version %08x\n", version); GST_DEBUG ("version %08x\n", version);
if (1 || version == 0x00000000) { if (1 || version == 0x00000000) {
buf = buffer + 0x32; buf = buffer + 0x32;
end = buffer + length; end = buffer + length;
tlen = QTDEMUX_GUINT8_GET (buf); tlen = QTDEMUX_GUINT8_GET (buf);
g_print ("tlen = %d\n", tlen); GST_DEBUG ("tlen = %d\n", tlen);
buf++; buf++;
g_print ("string = %.*s\n", tlen, (char *) buf); GST_DEBUG ("string = %.*s\n", tlen, (char *) buf);
buf += tlen; buf += tlen;
buf += 23; buf += 23;
...@@ -1301,6 +1332,14 @@ qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer, int length) ...@@ -1301,6 +1332,14 @@ qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer, int length)
len = QTDEMUX_GUINT32_GET (buf); len = QTDEMUX_GUINT32_GET (buf);
if (len == 0) if (len == 0)
break; break;
if (len < 8) {
GST_ERROR ("length too short (%d < 8)");
break;
}
if (len > (end - buf)) {
GST_ERROR ("length too long (%d > %d)", len, end - buf);
break;
}
child = g_node_new (buf); child = g_node_new (buf);
g_node_append (node, child); g_node_append (node, child);
...@@ -1816,7 +1855,7 @@ qtdemux_parse_tree (GstQTDemux * qtdemux) ...@@ -1816,7 +1855,7 @@ qtdemux_parse_tree (GstQTDemux * qtdemux)
qtdemux_parse_udta (qtdemux, udta); qtdemux_parse_udta (qtdemux, udta);
if (qtdemux->tag_list) { if (qtdemux->tag_list) {
g_print ("calling gst_element_found_tags with %s\n", GST_DEBUG ("calling gst_element_found_tags with %s\n",
gst_structure_to_string (qtdemux->tag_list)); gst_structure_to_string (qtdemux->tag_list));
gst_element_found_tags (GST_ELEMENT (qtdemux), qtdemux->tag_list); gst_element_found_tags (GST_ELEMENT (qtdemux), qtdemux->tag_list);
} }
...@@ -2258,7 +2297,7 @@ qtdemux_parse_udta (GstQTDemux * qtdemux, GNode * udta) ...@@ -2258,7 +2297,7 @@ qtdemux_parse_udta (GstQTDemux * qtdemux, GNode * udta)
return; return;
} }
g_print ("new tag list\n"); GST_DEBUG ("new tag list\n");
qtdemux->tag_list = gst_tag_list_new (); qtdemux->tag_list = gst_tag_list_new ();
node = qtdemux_tree_get_child_by_type (ilst, FOURCC__nam); node = qtdemux_tree_get_child_by_type (ilst, FOURCC__nam);
...@@ -2293,7 +2332,7 @@ qtdemux_tag_add (GstQTDemux * qtdemux, const char *tag, GNode * node) ...@@ -2293,7 +2332,7 @@ qtdemux_tag_add (GstQTDemux * qtdemux, const char *tag, GNode * node)
type = QTDEMUX_GUINT32_GET (data->data + 8); type = QTDEMUX_GUINT32_GET (data->data + 8);
if (type == 0x00000001) { if (type == 0x00000001) {
s = g_strndup ((char *) data->data + 16, len - 16); s = g_strndup ((char *) data->data + 16, len - 16);
g_print ("adding tag %s\n", s); GST_DEBUG ("adding tag %s\n", s);
gst_tag_list_add (qtdemux->tag_list, GST_TAG_MERGE_REPLACE, tag, s, NULL); gst_tag_list_add (qtdemux->tag_list, GST_TAG_MERGE_REPLACE, tag, s, NULL);
g_free (s); g_free (s);
} }
...@@ -2333,42 +2372,42 @@ gst_qtdemux_handle_esds (GstQTDemux * qtdemux, QtDemuxStream * stream, ...@@ -2333,42 +2372,42 @@ gst_qtdemux_handle_esds (GstQTDemux * qtdemux, QtDemuxStream * stream,
gst_util_dump_mem (ptr, len); gst_util_dump_mem (ptr, len);
ptr += 8; ptr += 8;
g_print ("version/flags = %08x\n", QTDEMUX_GUINT32_GET (ptr)); GST_DEBUG ("version/flags = %08x\n", QTDEMUX_GUINT32_GET (ptr));
ptr += 4; ptr += 4;
while (ptr < end) { while (ptr < end) {
tag = QTDEMUX_GUINT8_GET (ptr); tag = QTDEMUX_GUINT8_GET (ptr);
g_print ("tag = %02x\n", tag); GST_DEBUG ("tag = %02x\n", tag);
ptr++; ptr++;
len = get_size (ptr, &ptr); len = get_size (ptr, &ptr);
g_print ("len = %d\n", len); GST_DEBUG ("len = %d\n", len);
switch (tag) { switch (tag) {
case 0x03: case 0x03:
g_print ("ID %04x\n", QTDEMUX_GUINT16_GET (ptr)); GST_DEBUG ("ID %04x\n", QTDEMUX_GUINT16_GET (ptr));
g_print ("priority %04x\n", QTDEMUX_GUINT8_GET (ptr + 2)); GST_DEBUG ("priority %04x\n", QTDEMUX_GUINT8_GET (ptr + 2));
ptr += 3; ptr += 3;
break; break;
case 0x04: case 0x04:
g_print ("object_type_id %02x\n", QTDEMUX_GUINT8_GET (ptr)); GST_DEBUG ("object_type_id %02x\n", QTDEMUX_GUINT8_GET (ptr));
g_print ("stream_type %02x\n", QTDEMUX_GUINT8_GET (ptr + 1)); GST_DEBUG ("stream_type %02x\n", QTDEMUX_GUINT8_GET (ptr + 1));
g_print ("buffer_size_db %02x\n", QTDEMUX_GUINT24_GET (ptr + 2)); GST_DEBUG ("buffer_size_db %02x\n", QTDEMUX_GUINT24_GET (ptr + 2));
g_print ("max bitrate %d\n", QTDEMUX_GUINT32_GET (ptr + 5)); GST_DEBUG ("max bitrate %d\n", QTDEMUX_GUINT32_GET (ptr + 5));
g_print ("avg bitrate %d\n", QTDEMUX_GUINT32_GET (ptr + 9)); GST_DEBUG ("avg bitrate %d\n", QTDEMUX_GUINT32_GET (ptr + 9));
ptr += 13; ptr += 13;
break; break;
case 0x05: case 0x05:
g_print ("data:\n"); GST_DEBUG ("data:\n");
gst_util_dump_mem (ptr, len); gst_util_dump_mem (ptr, len);
data_ptr = ptr; data_ptr = ptr;
data_len = len; data_len = len;
ptr += len; ptr += len;
break; break;
case 0x06: case 0x06:
g_print ("data %02x\n", QTDEMUX_GUINT8_GET (ptr)); GST_DEBUG ("data %02x\n", QTDEMUX_GUINT8_GET (ptr));
ptr += 1; ptr += 1;
break; break;
default: default:
g_print ("parse error\n"); GST_ERROR ("parse error\n");
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment