+2006-01-31 Jan Schmidt <thaytan@mad.scientist.com>
+
+ * 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.
+
2006-01-27 Jan Gerber <j@bootlab.org>
Reviewed by: Andy Wingo <wingo@pobox.com>
}
/* 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;
/* 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:{
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");
/* 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;
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);