From b99f4be3dbb6f80427f199ac76f5610d477b3eca Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Mon, 24 Jan 2011 11:11:48 +0000 Subject: textoverlay: forward source events to sinks Events are passed to the video sink, and to the text sink if it is linked. This will allow seeking, for instance. https://bugzilla.gnome.org/show_bug.cgi?id=586450 --- ext/cairo/gsttextoverlay.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'ext/cairo') diff --git a/ext/cairo/gsttextoverlay.c b/ext/cairo/gsttextoverlay.c index 364b8bae9..d9e6f7fdd 100644 --- a/ext/cairo/gsttextoverlay.c +++ b/ext/cairo/gsttextoverlay.c @@ -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); overlay->halign = GST_CAIRO_TEXT_OVERLAY_HALIGN_CENTER; @@ -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) { -- cgit v1.2.3