mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 21:51:09 +00:00
gst-libs/gst/riff/riff-read.c: Fix bug in debug message and add some more debug messages.
Original commit message from CVS: * gst-libs/gst/riff/riff-read.c: (gst_riff_read_chunk), (gst_riff_parse_chunk): Fix bug in debug message and add some more debug messages.
This commit is contained in:
parent
b060089ac9
commit
822e77203a
2 changed files with 22 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2005-08-09 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_chunk),
|
||||||
|
(gst_riff_parse_chunk):
|
||||||
|
Fix bug in debug message and add some more debug messages.
|
||||||
|
|
||||||
2005-08-08 Edward Hervey <edward@fluendo.com>
|
2005-08-08 Edward Hervey <edward@fluendo.com>
|
||||||
|
|
||||||
* gst-libs/gst/riff/riff-media.c:
|
* gst-libs/gst/riff/riff-media.c:
|
||||||
|
|
|
@ -52,6 +52,7 @@ gst_riff_read_chunk (GstElement * element,
|
||||||
GstFlowReturn res;
|
GstFlowReturn res;
|
||||||
guint size;
|
guint size;
|
||||||
guint64 offset = *_offset;
|
guint64 offset = *_offset;
|
||||||
|
gchar dbg[5] = { 0, };
|
||||||
|
|
||||||
if ((res = gst_pad_pull_range (pad, offset, 8, &buf)) != GST_FLOW_OK)
|
if ((res = gst_pad_pull_range (pad, offset, 8, &buf)) != GST_FLOW_OK)
|
||||||
return res;
|
return res;
|
||||||
|
@ -65,9 +66,14 @@ gst_riff_read_chunk (GstElement * element,
|
||||||
size = GST_READ_UINT32_LE (GST_BUFFER_DATA (buf) + 4);
|
size = GST_READ_UINT32_LE (GST_BUFFER_DATA (buf) + 4);
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
|
|
||||||
|
memcpy (dbg, tag, 4);
|
||||||
|
GST_DEBUG_OBJECT (element, "tag=%s, size=%u", dbg, size);
|
||||||
|
|
||||||
if ((res = gst_pad_pull_range (pad, offset + 8, size, &buf)) != GST_FLOW_OK)
|
if ((res = gst_pad_pull_range (pad, offset + 8, size, &buf)) != GST_FLOW_OK)
|
||||||
return res;
|
return res;
|
||||||
else if (!buf || GST_BUFFER_SIZE (buf) < size) {
|
else if (!buf || GST_BUFFER_SIZE (buf) < size) {
|
||||||
|
GST_DEBUG_OBJECT (element, "not enough data (available=%u, needed=%u)",
|
||||||
|
(buf) ? GST_BUFFER_SIZE (buf) : 0, size);
|
||||||
if (buf)
|
if (buf)
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
|
@ -101,15 +107,21 @@ gst_riff_parse_chunk (GstElement * element, GstBuffer * buf,
|
||||||
guint size;
|
guint size;
|
||||||
guint32 fourcc;
|
guint32 fourcc;
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
|
gchar dbg[5] = { 0, };
|
||||||
guint offset = *_offset;
|
guint offset = *_offset;
|
||||||
|
|
||||||
*chunk_data = NULL;
|
*chunk_data = NULL;
|
||||||
*_fourcc = 0;
|
*_fourcc = 0;
|
||||||
|
|
||||||
|
if (buf && GST_BUFFER_SIZE (buf) == offset) {
|
||||||
|
GST_DEBUG_OBJECT (element, "End of chunk (offset %d)", offset);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (!buf || GST_BUFFER_SIZE (buf) < offset + 8) {
|
if (!buf || GST_BUFFER_SIZE (buf) < offset + 8) {
|
||||||
GST_DEBUG_OBJECT (element,
|
GST_DEBUG_OBJECT (element,
|
||||||
"Failed to parse chunk header (offset %d, %d available, %d needed)",
|
"Failed to parse chunk header (offset %d, %d available, %d needed)",
|
||||||
offset, buf ? GST_BUFFER_DATA (buf) : 0, 8);
|
offset, (buf) ? GST_BUFFER_SIZE (buf) : 0, 8);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,6 +130,9 @@ gst_riff_parse_chunk (GstElement * element, GstBuffer * buf,
|
||||||
fourcc = GST_READ_UINT32_LE (data);
|
fourcc = GST_READ_UINT32_LE (data);
|
||||||
size = GST_READ_UINT32_LE (data + 4);
|
size = GST_READ_UINT32_LE (data + 4);
|
||||||
|
|
||||||
|
memcpy (dbg, data, 4);
|
||||||
|
GST_DEBUG_OBJECT (element, "fourcc=%s, size=%u", dbg, size);
|
||||||
|
|
||||||
if (GST_BUFFER_SIZE (buf) < size + 8 + offset) {
|
if (GST_BUFFER_SIZE (buf) < size + 8 + offset) {
|
||||||
GST_DEBUG_OBJECT (element,
|
GST_DEBUG_OBJECT (element,
|
||||||
"Needed chunk data (%d) is more than available (%d), shortcutting",
|
"Needed chunk data (%d) is more than available (%d), shortcutting",
|
||||||
|
|
Loading…
Reference in a new issue