Commit 4760e190 authored by Wim Taymans's avatar Wim Taymans
Browse files

pushsrc: make alloc method a vmethod

parent 41bb4161
......@@ -72,6 +72,8 @@ G_DEFINE_TYPE_WITH_CODE (GstPushSrc, gst_push_src, GST_TYPE_BASE_SRC, _do_init);
static gboolean gst_push_src_query (GstBaseSrc * src, GstQuery * query);
static GstFlowReturn gst_push_src_create (GstBaseSrc * bsrc, guint64 offset,
guint length, GstBuffer ** ret);
static GstFlowReturn gst_push_src_alloc (GstBaseSrc * bsrc, guint64 offset,
guint length, GstBuffer ** ret);
static GstFlowReturn gst_push_src_fill (GstBaseSrc * bsrc, guint64 offset,
guint length, GstBuffer * ret);
......@@ -81,6 +83,7 @@ gst_push_src_class_init (GstPushSrcClass * klass)
GstBaseSrcClass *gstbasesrc_class = (GstBaseSrcClass *) klass;
gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_push_src_create);
gstbasesrc_class->alloc = GST_DEBUG_FUNCPTR (gst_push_src_alloc);
gstbasesrc_class->fill = GST_DEBUG_FUNCPTR (gst_push_src_fill);
gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_push_src_query);
}
......@@ -132,6 +135,24 @@ gst_push_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
return fret;
}
static GstFlowReturn
gst_push_src_alloc (GstBaseSrc * bsrc, guint64 offset, guint length,
GstBuffer ** ret)
{
GstFlowReturn fret;
GstPushSrc *src;
GstPushSrcClass *pclass;
src = GST_PUSH_SRC (bsrc);
pclass = GST_PUSH_SRC_GET_CLASS (src);
if (pclass->alloc)
fret = pclass->alloc (src, ret);
else
fret = GST_BASE_SRC_CLASS (parent_class)->alloc (bsrc, offset, length, ret);
return fret;
}
static GstFlowReturn
gst_push_src_fill (GstBaseSrc * bsrc, guint64 offset, guint length,
GstBuffer * ret)
......
......@@ -54,11 +54,13 @@ struct _GstPushSrc {
struct _GstPushSrcClass {
GstBaseSrcClass parent_class;
/* ask the subclass to create a buffer */
/* ask the subclass to create a buffer, the default implementation
* uses alloc and fill */
GstFlowReturn (*create) (GstPushSrc *src, GstBuffer **buf);
/* allocate memory for a buffer */
GstFlowReturn (*alloc) (GstPushSrc *src, GstBuffer **buf);
/* ask the subclass to fill a buffer */
GstFlowReturn (*fill) (GstPushSrc *src, GstBuffer *buf);
GstFlowReturn (*fill) (GstPushSrc *src, GstBuffer *buf);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment