From: Sebastian Dröge Date: Wed, 9 Dec 2009 08:55:32 +0000 (+0100) Subject: assrender: Proxy buffer allocation on video sinkpad to the srcpad X-Git-Tag: 1.19.3~507^2~17649 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=876cfb3d26b32cd53ba1b55f0f9e5869171f34fe;p=platform%2Fupstream%2Fgstreamer.git assrender: Proxy buffer allocation on video sinkpad to the srcpad ...and add getcaps function to the video sinkpad. --- 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));