summaryrefslogtreecommitdiff
path: root/ext/cairo
diff options
context:
space:
mode:
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2011-01-24 11:11:48 +0000
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2011-05-26 11:33:10 +0200
commitb99f4be3dbb6f80427f199ac76f5610d477b3eca (patch)
tree72aeae6b952e881c5c525a08603e78d6c64174bc /ext/cairo
parent86f9fa785a7878ba3c85e37cc4d31ac1dd69a03f (diff)
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
Diffstat (limited to 'ext/cairo')
-rw-r--r--ext/cairo/gsttextoverlay.c21
1 files changed, 21 insertions, 0 deletions
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)
{