summaryrefslogtreecommitdiffstats
path: root/gst/id3demux
diff options
context:
space:
mode:
authorJan Schmidt <thaytan@mad.scientist.com>2006-01-30 23:13:05 +0000
committerJan Schmidt <thaytan@mad.scientist.com>2006-01-30 23:13:05 +0000
commit1e661e8ff3b60f17b3e0b7ffd6e8c99a5e26dab5 (patch)
tree7ef194dacc32a355f35fb8b311c63f90e92d0939 /gst/id3demux
parentd258c36a9fe98c0089573122673b50eb5ee8595f (diff)
gst/id3demux/: Someone should kick my butt. Remove ID3v1 tags from the end of the file.
Original commit message from CVS: * gst/id3demux/gstid3demux.c: (gst_id3demux_chain), (gst_id3demux_read_id3v1), (gst_id3demux_sink_activate), (gst_id3demux_send_tag_event): * gst/id3demux/id3tags.c: (id3demux_read_id3v1_tag): Someone should kick my butt. Remove ID3v1 tags from the end of the file. Improve error messages. Send the TAG message as soon as we complete typefinding, instead of waiting until we send the first buffer. Downstream tag event is still sent before the first buffer.
Diffstat (limited to 'gst/id3demux')
-rw-r--r--gst/id3demux/gstid3demux.c32
-rw-r--r--gst/id3demux/id3tags.c2
2 files changed, 26 insertions, 8 deletions
diff --git a/gst/id3demux/gstid3demux.c b/gst/id3demux/gstid3demux.c
index 10dfcf29..8b37ff86 100644
--- a/gst/id3demux/gstid3demux.c
+++ b/gst/id3demux/gstid3demux.c
@@ -453,7 +453,9 @@ gst_id3demux_chain (GstPad * pad, GstBuffer * buf)
}
/* We failed typefind */
- GST_ELEMENT_ERROR (id3demux, CORE, CAPS, (NULL), ("no caps found"));
+ GST_ELEMENT_ERROR (id3demux, CORE, CAPS,
+ ("Could not determine the mime type of the file"),
+ ("No caps found for contents within an ID3 tag"));
gst_buffer_unref (typefind_buf);
gst_buffer_unref (id3demux->collect);
id3demux->collect = NULL;
@@ -471,6 +473,14 @@ gst_id3demux_chain (GstPad * pad, GstBuffer * buf)
/* Move onto streaming and fall-through to push out existing
* data */
id3demux->state = GST_ID3DEMUX_STREAMING;
+
+ /* Now that typefinding is complete, post the
+ * tags message */
+ if (id3demux->parsed_tags != NULL) {
+ gst_element_post_message (GST_ELEMENT (id3demux),
+ gst_message_new_tag (GST_OBJECT (id3demux),
+ gst_tag_list_copy (id3demux->parsed_tags)));
+ }
/* fall-through */
}
case GST_ID3DEMUX_STREAMING:{
@@ -675,7 +685,9 @@ gst_id3demux_read_id3v1 (GstID3Demux * id3demux, GstTagList ** tags)
tag_res = id3demux_read_id3v1_tag (buffer, &id3demux->strip_end, tags);
if (tag_res == ID3TAGS_READ_TAG) {
- GST_DEBUG_OBJECT (id3demux, "Read ID3v1 tag");
+ GST_DEBUG_OBJECT (id3demux,
+ "Read ID3v1 tag - trimming %d bytes from end of file",
+ id3demux->strip_end);
res = TRUE;
} else if (tag_res == ID3TAGS_BROKEN_TAG) {
GST_WARNING_OBJECT (id3demux, "Ignoring broken ID3v1 tag");
@@ -828,10 +840,19 @@ gst_id3demux_sink_activate (GstPad * sinkpad)
/* 5 - If we didn't find the caps, fail */
if (caps == NULL) {
- GST_DEBUG_OBJECT (id3demux, "Could not detect type of contents");
+ GST_ELEMENT_ERROR (id3demux, CORE, CAPS,
+ ("Could not determine the mime type of the file"),
+ ("No caps found for contents within an ID3 tag"));
goto done_activate;
}
+ /* Now that we've finished typefinding, post tag message on bus */
+ if (id3demux->parsed_tags != NULL) {
+ gst_element_post_message (GST_ELEMENT (id3demux),
+ gst_message_new_tag (GST_OBJECT (id3demux),
+ gst_tag_list_copy (id3demux->parsed_tags)));
+ }
+
/* tag reading and typefinding were already done, don't do them again in
the chain function if we end up in push mode */
id3demux->state = GST_ID3DEMUX_STREAMING;
@@ -1079,11 +1100,6 @@ gst_id3demux_send_tag_event (GstID3Demux * id3demux)
GstTagList *merged = gst_tag_list_merge (id3demux->event_tags,
id3demux->parsed_tags, GST_TAG_MERGE_KEEP);
- if (id3demux->parsed_tags)
- gst_element_post_message (GST_ELEMENT (id3demux),
- gst_message_new_tag (GST_OBJECT (id3demux),
- gst_tag_list_copy (id3demux->parsed_tags)));
-
if (merged) {
GstEvent *event = gst_event_new_tag (merged);
diff --git a/gst/id3demux/id3tags.c b/gst/id3demux/id3tags.c
index 12765e61..a14eccef 100644
--- a/gst/id3demux/id3tags.c
+++ b/gst/id3demux/id3tags.c
@@ -101,6 +101,8 @@ id3demux_read_id3v1_tag (GstBuffer * buffer, guint * id3v1_size,
} else
*tags = new_tags;
+ if (id3v1_size)
+ *id3v1_size = ID3V1_TAG_SIZE;
return ID3TAGS_READ_TAG;
}