mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
gst-libs/gst/riff/riff-read.c: On second thought, just skip JUNK chunks automatically, so the caller doesn't have to ...
Original commit message from CVS: * gst-libs/gst/riff/riff-read.c: (gst_riff_read_chunk): On second thought, just skip JUNK chunks automatically, so the caller doesn't have to handle this. Fixes #342345. Also, return GST_FLOW_UNEXPECTED if we get a short read, not GST_FLOW_ERROR.
This commit is contained in:
parent
3ef484fe2b
commit
25d29c4f09
2 changed files with 29 additions and 14 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2006-05-19 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_chunk):
|
||||||
|
On second thought, just skip JUNK chunks automatically, so
|
||||||
|
the caller doesn't have to handle this. Fixes #342345.
|
||||||
|
Also, return GST_FLOW_UNEXPECTED if we get a short read,
|
||||||
|
not GST_FLOW_ERROR.
|
||||||
|
|
||||||
2006-05-19 Tim-Philipp Müller <tim at centricular dot net>
|
2006-05-19 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_chunk):
|
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_chunk):
|
||||||
|
|
|
@ -39,7 +39,8 @@ GST_DEBUG_CATEGORY_EXTERN (riff_debug);
|
||||||
* @tag: fourcc of the chunk (returned by this function).
|
* @tag: fourcc of the chunk (returned by this function).
|
||||||
* @chunk_data: buffer (returned by this function).
|
* @chunk_data: buffer (returned by this function).
|
||||||
*
|
*
|
||||||
* Reads a single chunk of data.
|
* Reads a single chunk of data. Since 0.10.8 'JUNK' chunks
|
||||||
|
* are skipped automatically.
|
||||||
*
|
*
|
||||||
* Returns: flow status.
|
* Returns: flow status.
|
||||||
*/
|
*/
|
||||||
|
@ -54,6 +55,8 @@ gst_riff_read_chunk (GstElement * element,
|
||||||
guint64 offset = *_offset;
|
guint64 offset = *_offset;
|
||||||
gchar dbg[5] = { 0, };
|
gchar dbg[5] = { 0, };
|
||||||
|
|
||||||
|
skip_junk:
|
||||||
|
|
||||||
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;
|
||||||
else if (!buf || GST_BUFFER_SIZE (buf) < 8) {
|
else if (!buf || GST_BUFFER_SIZE (buf) < 8) {
|
||||||
|
@ -69,18 +72,22 @@ gst_riff_read_chunk (GstElement * element,
|
||||||
memcpy (dbg, tag, 4);
|
memcpy (dbg, tag, 4);
|
||||||
GST_DEBUG_OBJECT (element, "tag=%s, size=%u", dbg, size);
|
GST_DEBUG_OBJECT (element, "tag=%s, size=%u", dbg, size);
|
||||||
|
|
||||||
if (*tag == GST_RIFF_TAG_JUNK && size == 0) {
|
/* skip 'JUNK' chunks */
|
||||||
buf = gst_buffer_new ();
|
if (*tag == GST_RIFF_TAG_JUNK) {
|
||||||
} else {
|
*_offset += 8 + GST_ROUND_UP_2 (size);
|
||||||
if ((res = gst_pad_pull_range (pad, offset + 8, size, &buf)) != GST_FLOW_OK)
|
offset += 8 + GST_ROUND_UP_2 (size);
|
||||||
return res;
|
GST_DEBUG_OBJECT (element, "skipping JUNK chunk");
|
||||||
if (!buf || GST_BUFFER_SIZE (buf) < size) {
|
goto skip_junk;
|
||||||
GST_DEBUG_OBJECT (element, "not enough data (available=%u, needed=%u)",
|
}
|
||||||
(buf) ? GST_BUFFER_SIZE (buf) : 0, size);
|
|
||||||
if (buf)
|
if ((res = gst_pad_pull_range (pad, offset + 8, size, &buf)) != GST_FLOW_OK)
|
||||||
gst_buffer_unref (buf);
|
return res;
|
||||||
return GST_FLOW_ERROR;
|
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)
|
||||||
|
gst_buffer_unref (buf);
|
||||||
|
return GST_FLOW_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
*_chunk_data = buf;
|
*_chunk_data = buf;
|
||||||
|
@ -101,7 +108,7 @@ gst_riff_read_chunk (GstElement * element,
|
||||||
*
|
*
|
||||||
* Reads a single chunk.
|
* Reads a single chunk.
|
||||||
*
|
*
|
||||||
* Returns: the fourcc tag of this chunk, or 0 on error.
|
* Returns: the fourcc tag of this chunk, or FALSE on error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
|
Loading…
Reference in a new issue