id3demux: ensure a taglist before adding the container tag

In the case of id3v1 also don't return NULL on empty tags, but also create a new
taglist and add the container tag for consistency.
This commit is contained in:
Stefan Kost 2011-02-08 10:07:43 +02:00
parent 6f6b2a7efc
commit a86bab6689

View file

@ -183,6 +183,8 @@ gst_id3demux_parse_tag (GstTagDemux * demux, GstBuffer * buffer,
res = id3demux_read_id3v2_tag (buffer, tag_size, tags); res = id3demux_read_id3v2_tag (buffer, tag_size, tags);
if (G_LIKELY (res == ID3TAGS_READ_TAG)) { if (G_LIKELY (res == ID3TAGS_READ_TAG)) {
if (*tags == NULL)
*tags = gst_tag_list_new ();
gst_id3demux_add_container_format (*tags); gst_id3demux_add_container_format (*tags);
return GST_TAG_DEMUX_RESULT_OK; return GST_TAG_DEMUX_RESULT_OK;
} else { } else {
@ -191,9 +193,8 @@ gst_id3demux_parse_tag (GstTagDemux * demux, GstBuffer * buffer,
} else { } else {
*tags = gst_tag_list_new_from_id3v1 (GST_BUFFER_DATA (buffer)); *tags = gst_tag_list_new_from_id3v1 (GST_BUFFER_DATA (buffer));
if (G_UNLIKELY (*tags == NULL)) if (*tags == NULL)
return GST_TAG_DEMUX_RESULT_BROKEN_TAG; *tags = gst_tag_list_new ();
gst_id3demux_add_container_format (*tags); gst_id3demux_add_container_format (*tags);
*tag_size = ID3V1_TAG_SIZE; *tag_size = ID3V1_TAG_SIZE;
return GST_TAG_DEMUX_RESULT_OK; return GST_TAG_DEMUX_RESULT_OK;