subparse/ssaparse: Fix event handling and order

This commit is contained in:
Sebastian Dröge 2013-05-10 12:21:31 +02:00
parent 027654e71e
commit b19d64d785
2 changed files with 13 additions and 11 deletions

View file

@ -83,8 +83,6 @@ gst_ssa_parse_init (GstSsaParse * parse)
GST_DEBUG_FUNCPTR (gst_ssa_parse_src_event));
gst_element_add_pad (GST_ELEMENT (parse), parse->srcpad);
gst_pad_use_fixed_caps (parse->srcpad);
gst_pad_set_caps (parse->srcpad,
gst_static_pad_template_get_caps (&src_templ));
parse->ini = NULL;
parse->framed = FALSE;

View file

@ -1443,6 +1443,7 @@ handle_buffer (GstSubParse * self, GstBuffer * buf)
GstFlowReturn ret = GST_FLOW_OK;
GstCaps *caps = NULL;
gchar *line, *subtitle;
gboolean need_tags = FALSE;
if (self->first_buffer) {
GstMapInfo map;
@ -1467,7 +1468,19 @@ handle_buffer (GstSubParse * self, GstBuffer * buf)
return GST_FLOW_EOS;
}
gst_caps_unref (caps);
need_tags = TRUE;
}
/* Push newsegment if needed */
if (self->need_segment) {
GST_LOG_OBJECT (self, "pushing newsegment event with %" GST_SEGMENT_FORMAT,
&self->segment);
gst_pad_push_event (self->srcpad, gst_event_new_segment (&self->segment));
self->need_segment = FALSE;
}
if (need_tags) {
/* push tags */
if (self->subtitle_codec != NULL) {
GstTagList *tags;
@ -1544,15 +1557,6 @@ gst_sub_parse_chain (GstPad * sinkpad, GstObject * parent, GstBuffer * buf)
self = GST_SUBPARSE (parent);
/* Push newsegment if needed */
if (self->need_segment) {
GST_LOG_OBJECT (self, "pushing newsegment event with %" GST_SEGMENT_FORMAT,
&self->segment);
gst_pad_push_event (self->srcpad, gst_event_new_segment (&self->segment));
self->need_segment = FALSE;
}
ret = handle_buffer (self, buf);
return ret;