Commit b99f4be3 authored by Vincent Penquerc'h's avatar Vincent Penquerc'h Committed by Sebastian Dröge
Browse files

textoverlay: forward source events to sinks

Events are passed to the video sink, and to the text sink if it is
This will allow seeking, for instance.
parent 86f9fa78
......@@ -108,6 +108,7 @@ static GstFlowReturn gst_text_overlay_collected (GstCollectPads * pads,
gpointer data);
static void gst_text_overlay_finalize (GObject * object);
static void gst_text_overlay_font_init (GstCairoTextOverlay * overlay);
static gboolean gst_text_overlay_src_event (GstPad * pad, GstEvent * event);
/* These macros are adapted from videotestsrc.c */
#define I420_Y_ROWSTRIDE(width) (GST_ROUND_UP_4(width))
......@@ -248,6 +249,8 @@ gst_text_overlay_init (GstCairoTextOverlay * overlay,
(&cairo_text_overlay_src_template_factory, "src");
gst_pad_set_getcaps_function (overlay->srcpad,
GST_DEBUG_FUNCPTR (gst_text_overlay_getcaps));
gst_pad_set_event_function (overlay->srcpad,
GST_DEBUG_FUNCPTR (gst_text_overlay_src_event));
gst_element_add_pad (GST_ELEMENT (overlay), overlay->srcpad);
......@@ -942,6 +945,24 @@ done:
static gboolean
gst_text_overlay_src_event (GstPad * pad, GstEvent * event)
GstCairoTextOverlay *overlay =
GST_CAIRO_TEXT_OVERLAY (gst_pad_get_parent (pad));
gboolean ret = TRUE;
/* forward events to the video sink, and, if it is linked, the text sink */
if (overlay->text_collect_data) {
gst_event_ref (event);
ret &= gst_pad_push_event (overlay->text_sinkpad, event);
ret &= gst_pad_push_event (overlay->video_sinkpad, event);
gst_object_unref (overlay);
return ret;
static GstStateChangeReturn
gst_text_overlay_change_state (GstElement * element, GstStateChange transition)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment