summaryrefslogtreecommitdiffstats
path: root/gst/id3demux
diff options
context:
space:
mode:
authorJan Schmidt <thaytan@mad.scientist.com>2006-03-22 13:00:34 +0000
committerJan Schmidt <thaytan@mad.scientist.com>2006-03-22 13:00:34 +0000
commit3f72e7205c620413fdd89fe21d5c6752b3edc405 (patch)
treeb86d9356e6d0978be66788f3e73947c584fa6ee7 /gst/id3demux
parente7a2d7734de7031d5ea9d24b0bb68603e9325778 (diff)
gst/: Don't attempt typefinding on too-short buffers that have been completely trimmed away.
Original commit message from CVS: * gst/apetag/gsttagdemux.c: (gst_tag_demux_chain): * gst/id3demux/gstid3demux.c: (gst_id3demux_chain): Don't attempt typefinding on too-short buffers that have been completely trimmed away. * gst/id3demux/id3tags.c: (id3demux_read_id3v2_tag): Improve the debug output
Diffstat (limited to 'gst/id3demux')
-rw-r--r--gst/id3demux/gstid3demux.c6
-rw-r--r--gst/id3demux/id3tags.c11
2 files changed, 14 insertions, 3 deletions
diff --git a/gst/id3demux/gstid3demux.c b/gst/id3demux/gstid3demux.c
index 3d7ee5ba..e9f22c94 100644
--- a/gst/id3demux/gstid3demux.c
+++ b/gst/id3demux/gstid3demux.c
@@ -433,7 +433,8 @@ gst_id3demux_chain (GstPad * pad, GstBuffer * buf)
GstBuffer *typefind_buf = NULL;
GstCaps *caps;
- if (GST_BUFFER_SIZE (id3demux->collect) < ID3_TYPE_FIND_MIN_SIZE)
+ if (GST_BUFFER_SIZE (id3demux->collect) <
+ ID3_TYPE_FIND_MIN_SIZE + id3demux->strip_start)
break; /* Go get more data first */
GST_DEBUG_OBJECT (id3demux, "Typefinding with size %d",
@@ -445,6 +446,9 @@ gst_id3demux_chain (GstPad * pad, GstBuffer * buf)
if (!gst_id3demux_trim_buffer (id3demux, &typefind_buf))
return GST_FLOW_ERROR;
+ if (typefind_buf == NULL)
+ break; /* Still need more data */
+
caps = gst_type_find_helper_for_buffer (GST_OBJECT (id3demux),
typefind_buf, &probability);
diff --git a/gst/id3demux/id3tags.c b/gst/id3demux/id3tags.c
index 157d601d..bd370ed5 100644
--- a/gst/id3demux/id3tags.c
+++ b/gst/id3demux/id3tags.c
@@ -167,10 +167,17 @@ id3demux_read_id3v2_tag (GstBuffer * buffer, guint * id3v2_size,
version >> 8, version & 0xff, ID3V2_VERSION >> 8, ID3V2_VERSION & 0xff);
return ID3TAGS_READ_TAG;
}
- GST_DEBUG ("ID3v2 tag with revision 2.%d.%d\n", version >> 8, version & 0xff);
- if (GST_BUFFER_SIZE (buffer) < read_size)
+ if (GST_BUFFER_SIZE (buffer) < read_size) {
+ GST_DEBUG
+ ("Found ID3v2 tag with revision 2.%d.%d - need %u more bytes to read",
+ version >> 8, version & 0xff,
+ (guint) (read_size - GST_BUFFER_SIZE (buffer)));
return ID3TAGS_MORE_DATA; /* Need more data to decode with */
+ }
+
+ GST_DEBUG ("Reading ID3v2 tag with revision 2.%d.%d of size %u", version >> 8,
+ version & 0xff, read_size);
g_return_val_if_fail (tags != NULL, ID3TAGS_READ_TAG);