From bfdc132ad05db01ad476d7cbf16d2fe600a6e510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 6 Oct 2010 18:32:51 +0200 Subject: [PATCH] flacparse: Really post tags only after the initial newsegment event The first newsegment event will be send by the first call to gst_base_parse_push_buffer() if necessary, posting the tags before that is not a good idea. Instead do it from the GstBaseParse::pre_push_buffer vfunc. --- gst/audioparsers/gstflacparse.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/gst/audioparsers/gstflacparse.c b/gst/audioparsers/gstflacparse.c index a56fb41e26..e3411c4afe 100644 --- a/gst/audioparsers/gstflacparse.c +++ b/gst/audioparsers/gstflacparse.c @@ -198,6 +198,8 @@ static GstFlowReturn gst_flac_parse_parse_frame (GstBaseParse * parse, GstBuffer * buffer); static gint gst_flac_parse_get_frame_overhead (GstBaseParse * parse, GstBuffer * buffer); +static GstFlowReturn gst_flac_parse_pre_push_buffer (GstBaseParse * parse, + GstBuffer * buf); GST_BOILERPLATE (GstFlacParse, gst_flac_parse, GstBaseParse, GST_TYPE_BASE_PARSE); @@ -244,6 +246,8 @@ gst_flac_parse_class_init (GstFlacParseClass * klass) baseparse_class->parse_frame = GST_DEBUG_FUNCPTR (gst_flac_parse_parse_frame); baseparse_class->get_frame_overhead = GST_DEBUG_FUNCPTR (gst_flac_parse_get_frame_overhead); + baseparse_class->pre_push_buffer = + GST_DEBUG_FUNCPTR (gst_flac_parse_pre_push_buffer); } static void @@ -1182,11 +1186,6 @@ push_headers: gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (GST_BASE_PARSE (flacparse)), caps); gst_caps_unref (caps); - /* Push tags */ - if (flacparse->tags) - gst_element_found_tags (GST_ELEMENT (flacparse), - gst_tag_list_copy (flacparse->tags)); - /* push header buffers; update caps, so when we push the first buffer the * negotiated caps will change to caps that include the streamheader field */ for (l = flacparse->headers; l != NULL; l = l->next) { @@ -1481,3 +1480,17 @@ gst_flac_parse_get_frame_overhead (GstBaseParse * parse, GstBuffer * buffer) * the second even less, so the total inaccuracy is negligible. */ return 7; } + +static GstFlowReturn +gst_flac_parse_pre_push_buffer (GstBaseParse * parse, GstBuffer * buf) +{ + GstFlacParse *flacparse = GST_FLAC_PARSE (parse); + + /* Push tags */ + if (flacparse->tags) { + gst_element_found_tags (GST_ELEMENT (flacparse), flacparse->tags); + flacparse->tags = NULL; + } + + return GST_FLOW_OK; +}