textoverlay: Proxy buffer allocation on the video sinkpad to the srcpad
This commit is contained in:
parent
bc1302cf8e
commit
d5205bb0fa
@ -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 gboolean gst_text_overlay_video_event (GstPad * pad, GstEvent * event);
|
||||||
static GstFlowReturn gst_text_overlay_video_chain (GstPad * pad,
|
static GstFlowReturn gst_text_overlay_video_chain (GstPad * pad,
|
||||||
GstBuffer * buffer);
|
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 gboolean gst_text_overlay_text_event (GstPad * pad, GstEvent * event);
|
||||||
static GstFlowReturn gst_text_overlay_text_chain (GstPad * pad,
|
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_DEBUG_FUNCPTR (gst_text_overlay_video_event));
|
||||||
gst_pad_set_chain_function (overlay->video_sinkpad,
|
gst_pad_set_chain_function (overlay->video_sinkpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_text_overlay_video_chain));
|
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);
|
gst_element_add_pad (GST_ELEMENT (overlay), overlay->video_sinkpad);
|
||||||
|
|
||||||
if (!GST_IS_TIME_OVERLAY_CLASS (klass) && !GST_IS_CLOCK_OVERLAY_CLASS (klass)) {
|
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;
|
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 */
|
/* Called with lock held */
|
||||||
static void
|
static void
|
||||||
gst_text_overlay_pop_text (GstTextOverlay * overlay)
|
gst_text_overlay_pop_text (GstTextOverlay * overlay)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user