appsrc: add send_event handler for flushing

Adds a send_event handling for allowing appsrc to flush its internal
data, allowing users to flush the pipeline without setting it to null.

https://bugzilla.gnome.org/show_bug.cgi?id=724231
This commit is contained in:
Thiago Santos 2014-06-10 12:59:53 -03:00
parent 3202938369
commit bbf226d9d6

View file

@ -214,6 +214,8 @@ static void gst_app_src_set_property (GObject * object, guint prop_id,
static void gst_app_src_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static gboolean gst_app_src_send_event (GstElement * element, GstEvent * event);
static void gst_app_src_set_latencies (GstAppSrc * appsrc,
gboolean do_min, guint64 min, gboolean do_max, guint64 max);
@ -479,6 +481,8 @@ gst_app_src_class_init (GstAppSrcClass * klass)
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_app_src_template));
element_class->send_event = gst_app_src_send_event;
basesrc_class->negotiate = gst_app_src_negotiate;
basesrc_class->get_caps = gst_app_src_internal_get_caps;
basesrc_class->create = gst_app_src_create;
@ -700,6 +704,23 @@ gst_app_src_get_property (GObject * object, guint prop_id, GValue * value,
}
}
static gboolean
gst_app_src_send_event (GstElement * element, GstEvent * event)
{
GstAppSrc *appsrc = GST_APP_SRC_CAST (element);
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_FLUSH_STOP:
gst_app_src_flush_queued (appsrc);
break;
default:
break;
}
return GST_CALL_PARENT_WITH_DEFAULT (GST_ELEMENT_CLASS, send_event, (element,
event), FALSE);
}
static gboolean
gst_app_src_unlock (GstBaseSrc * bsrc)
{