summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2009-12-09 08:55:32 (GMT)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-12-09 09:00:04 (GMT)
commit876cfb3d26b32cd53ba1b55f0f9e5869171f34fe (patch)
tree3a4d6bdacf2e3c4475d7c3a4c5b3d51b94625677
parent44aba00375f0a3b8cd8d698d305b480d3dc33ca4 (diff)
downloadgst-plugins-bad-876cfb3d26b32cd53ba1b55f0f9e5869171f34fe.tar.gz
gst-plugins-bad-876cfb3d26b32cd53ba1b55f0f9e5869171f34fe.tar.xz
assrender: Proxy buffer allocation on video sinkpad to the srcpad
...and add getcaps function to the video sinkpad.
-rw-r--r--ext/assrender/gstassrender.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/ext/assrender/gstassrender.c b/ext/assrender/gstassrender.c
index 69b90e7..0ea48e7 100644
--- a/ext/assrender/gstassrender.c
+++ b/ext/assrender/gstassrender.c
@@ -107,6 +107,9 @@ static gboolean gst_ass_render_event_video (GstPad * pad, GstEvent * event);
static gboolean gst_ass_render_event_text (GstPad * pad, GstEvent * event);
static gboolean gst_ass_render_event_src (GstPad * pad, GstEvent * event);
+static GstFlowReturn gst_ass_render_bufferalloc_video (GstPad * pad,
+ guint64 offset, guint size, GstCaps * caps, GstBuffer ** buffer);
+
static void
gst_ass_render_base_init (gpointer gclass)
{
@@ -190,6 +193,8 @@ gst_ass_render_init (GstAssRender * render, GstAssRenderClass * gclass)
gst_pad_set_getcaps_function (render->srcpad,
GST_DEBUG_FUNCPTR (gst_ass_render_getcaps));
+ gst_pad_set_getcaps_function (render->video_sinkpad,
+ GST_DEBUG_FUNCPTR (gst_ass_render_getcaps));
gst_pad_set_chain_function (render->video_sinkpad,
GST_DEBUG_FUNCPTR (gst_ass_render_chain_video));
@@ -203,6 +208,9 @@ gst_ass_render_init (GstAssRender * render, GstAssRenderClass * gclass)
gst_pad_set_event_function (render->srcpad,
GST_DEBUG_FUNCPTR (gst_ass_render_event_src));
+ gst_pad_set_bufferalloc_function (render->video_sinkpad,
+ GST_DEBUG_FUNCPTR (gst_ass_render_bufferalloc_video));
+
gst_element_add_pad (GST_ELEMENT (render), render->srcpad);
gst_element_add_pad (GST_ELEMENT (render), render->video_sinkpad);
gst_element_add_pad (GST_ELEMENT (render), render->text_sinkpad);
@@ -859,6 +867,28 @@ gst_ass_render_process_text (GstAssRender * render, GstBuffer * buffer,
}
static GstFlowReturn
+gst_ass_render_bufferalloc_video (GstPad * pad, guint64 offset, guint size,
+ GstCaps * caps, GstBuffer ** buffer)
+{
+ GstAssRender *render = GST_ASS_RENDER (gst_pad_get_parent (pad));
+ GstFlowReturn ret = GST_FLOW_WRONG_STATE;
+ GstPad *allocpad;
+
+ GST_OBJECT_LOCK (render);
+ allocpad = render->srcpad ? gst_object_ref (render->srcpad) : NULL;
+ GST_OBJECT_UNLOCK (render);
+
+ if (allocpad) {
+ ret = gst_pad_alloc_buffer (allocpad, offset, size, caps, buffer);
+ gst_object_unref (allocpad);
+ }
+
+ gst_object_unref (render);
+
+ return ret;
+}
+
+static GstFlowReturn
gst_ass_render_chain_video (GstPad * pad, GstBuffer * buffer)
{
GstAssRender *render = GST_ASS_RENDER (GST_PAD_PARENT (pad));