diff options
-rw-r--r-- | ext/pango/gsttextoverlay.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ext/pango/gsttextoverlay.c b/ext/pango/gsttextoverlay.c index 12428c61e..efa37e569 100644 --- a/ext/pango/gsttextoverlay.c +++ b/ext/pango/gsttextoverlay.c @@ -297,6 +297,8 @@ static gboolean gst_text_overlay_src_query (GstPad * pad, GstQuery * query); static gboolean gst_text_overlay_video_event (GstPad * pad, GstEvent * event); static GstFlowReturn gst_text_overlay_video_chain (GstPad * pad, GstBuffer * buffer); +static GstFlowReturn gst_text_overlay_video_bufferalloc (GstPad * pad, + guint64 offset, guint size, GstCaps * caps, GstBuffer ** buffer); static gboolean gst_text_overlay_text_event (GstPad * pad, GstEvent * event); static GstFlowReturn gst_text_overlay_text_chain (GstPad * pad, @@ -520,6 +522,8 @@ gst_text_overlay_init (GstTextOverlay * overlay, GstTextOverlayClass * klass) GST_DEBUG_FUNCPTR (gst_text_overlay_video_event)); gst_pad_set_chain_function (overlay->video_sinkpad, GST_DEBUG_FUNCPTR (gst_text_overlay_video_chain)); + gst_pad_set_bufferalloc_function (overlay->video_sinkpad, + GST_DEBUG_FUNCPTR (gst_text_overlay_video_bufferalloc)); gst_element_add_pad (GST_ELEMENT (overlay), overlay->video_sinkpad); if (!GST_IS_TIME_OVERLAY_CLASS (klass) && !GST_IS_CLOCK_OVERLAY_CLASS (klass)) { @@ -1843,6 +1847,27 @@ gst_text_overlay_video_event (GstPad * pad, GstEvent * event) return ret; } +static GstFlowReturn +gst_text_overlay_video_bufferalloc (GstPad * pad, guint64 offset, guint size, + GstCaps * caps, GstBuffer ** buffer) +{ + GstTextOverlay *overlay = GST_TEXT_OVERLAY (gst_pad_get_parent (pad)); + GstFlowReturn ret = GST_FLOW_WRONG_STATE; + GstPad *allocpad; + + GST_OBJECT_LOCK (overlay); + allocpad = overlay->srcpad ? gst_object_ref (overlay->srcpad) : NULL; + GST_OBJECT_UNLOCK (overlay); + + if (allocpad) { + ret = gst_pad_alloc_buffer (allocpad, offset, size, caps, buffer); + gst_object_unref (allocpad); + } + + gst_object_unref (overlay); + return ret; +} + /* Called with lock held */ static void gst_text_overlay_pop_text (GstTextOverlay * overlay) |