diff options
author | Jan Schmidt <thaytan@mad.scientist.com> | 2006-01-30 23:13:05 +0000 |
---|---|---|
committer | Jan Schmidt <thaytan@mad.scientist.com> | 2006-01-30 23:13:05 +0000 |
commit | 1e661e8ff3b60f17b3e0b7ffd6e8c99a5e26dab5 (patch) | |
tree | 7ef194dacc32a355f35fb8b311c63f90e92d0939 | |
parent | d258c36a9fe98c0089573122673b50eb5ee8595f (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.
-rw-r--r-- | ChangeLog | 13 | ||||
m--------- | common | 0 | ||||
-rw-r--r-- | gst/id3demux/gstid3demux.c | 32 | ||||
-rw-r--r-- | gst/id3demux/id3tags.c | 2 |
4 files changed, 39 insertions, 8 deletions
@@ -1,3 +1,16 @@ +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> diff --git a/common b/common -Subproject bc4325349e8d0ec90aa5c5e74566880cc2e8252 +Subproject 0b93085188e83fe678ec5ded2823cd7c24dfa84 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; } |