summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2015-08-16 14:37:53 +0100
committerTim-Philipp Müller <tim@centricular.com>2015-08-16 16:33:55 +0100
commita042a9815967b0a6c0dfb65f33d78e02ee1ffb43 (patch)
tree9085b2842605492f5b1a5b1c8f1e3de2ae718517 /gst
parente9aa4c74676cf39e982ed78d3d7855d8deeda5b2 (diff)
flacparse: use new baseparse API and fix tag handling
https://bugzilla.gnome.org/show_bug.cgi?id=679768
Diffstat (limited to 'gst')
-rw-r--r--gst/audioparsers/gstflacparse.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/gst/audioparsers/gstflacparse.c b/gst/audioparsers/gstflacparse.c
index c6dc227f5..6db5d59f5 100644
--- a/gst/audioparsers/gstflacparse.c
+++ b/gst/audioparsers/gstflacparse.c
@@ -1141,21 +1141,16 @@ gst_flac_parse_handle_picture (GstFlacParse * flacparse, GstBuffer * buffer)
if (gst_byte_reader_get_pos (&reader) + img_len > map.size)
goto error;
- if (!flacparse->tags)
- flacparse->tags = gst_tag_list_new_empty ();
-
GST_INFO_OBJECT (flacparse, "Got image of %d bytes", img_len);
if (img_len > 0) {
+ if (flacparse->tags == NULL)
+ flacparse->tags = gst_tag_list_new_empty ();
+
gst_tag_list_add_id3_image (flacparse->tags,
map.data + gst_byte_reader_get_pos (&reader), img_len, img_type);
}
- if (gst_tag_list_is_empty (flacparse->tags)) {
- gst_tag_list_unref (flacparse->tags);
- flacparse->tags = NULL;
- }
-
gst_buffer_unmap (buffer, &map);
return TRUE;
@@ -1704,30 +1699,24 @@ gst_flac_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
GstFlacParse *flacparse = GST_FLAC_PARSE (parse);
if (!flacparse->sent_codec_tag) {
- GstTagList *taglist;
GstCaps *caps;
- taglist = gst_tag_list_new_empty ();
+ if (flacparse->tags == NULL)
+ flacparse->tags = gst_tag_list_new_empty ();
/* codec tag */
caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (parse));
- gst_pb_utils_add_codec_description_to_tag_list (taglist,
+ gst_pb_utils_add_codec_description_to_tag_list (flacparse->tags,
GST_TAG_AUDIO_CODEC, caps);
gst_caps_unref (caps);
- gst_pad_push_event (GST_BASE_PARSE_SRC_PAD (flacparse),
- gst_event_new_tag (taglist));
+ /* Announce our pending tags */
+ gst_base_parse_merge_tags (parse, flacparse->tags, GST_TAG_MERGE_REPLACE);
/* also signals the end of first-frame processing */
flacparse->sent_codec_tag = TRUE;
}
- /* Push tags */
- if (flacparse->tags) {
- gst_pad_push_event (GST_BASE_PARSE_SRC_PAD (flacparse),
- gst_event_new_tag (flacparse->tags));
- flacparse->tags = NULL;
- }
/* Push toc */
if (flacparse->toc) {
gst_pad_push_event (GST_BASE_PARSE_SRC_PAD (flacparse),