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.
This commit is contained in:
Sebastian Dröge 2010-10-06 18:32:51 +02:00 committed by Tim-Philipp Müller
parent 6b71b65289
commit bfdc132ad0

View file

@ -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;
}