GstEvent * event, GstSegment * segment);
static GstFlowReturn gst_base_src_default_create (GstBaseSrc * basesrc,
guint64 offset, guint size, GstBuffer ** buf);
+static GstFlowReturn gst_base_src_default_alloc (GstBaseSrc * basesrc,
+ guint64 offset, guint size, GstBuffer ** buf);
static gboolean gst_base_src_set_flushing (GstBaseSrc * basesrc,
gboolean flushing, gboolean live_play, gboolean unlock, gboolean * playing);
klass->prepare_seek_segment =
GST_DEBUG_FUNCPTR (gst_base_src_default_prepare_seek_segment);
klass->create = GST_DEBUG_FUNCPTR (gst_base_src_default_create);
+ klass->alloc = GST_DEBUG_FUNCPTR (gst_base_src_default_alloc);
/* Registering debug symbols for function pointers */
GST_DEBUG_REGISTER_FUNCPTR (gst_base_src_activate_push);
}
static GstFlowReturn
-gst_base_src_alloc_buffer (GstBaseSrc * src, guint64 offset,
+gst_base_src_default_alloc (GstBaseSrc * src, guint64 offset,
guint size, GstBuffer ** buffer)
{
GstFlowReturn ret;
bclass = GST_BASE_SRC_GET_CLASS (src);
+ if (G_UNLIKELY (!bclass->alloc))
+ goto no_function;
if (G_UNLIKELY (!bclass->fill))
goto no_function;
- ret = gst_base_src_alloc_buffer (src, offset, size, buffer);
+ ret = bclass->alloc (src, offset, size, buffer);
if (G_UNLIKELY (ret != GST_FLOW_OK))
goto alloc_failed;
/* ERRORS */
no_function:
{
- GST_DEBUG_OBJECT (src, "no fill function");
+ GST_DEBUG_OBJECT (src, "no fill or alloc function");
return GST_FLOW_NOT_SUPPORTED;
}
alloc_failed:
gboolean (*event) (GstBaseSrc *src, GstEvent *event);
/* ask the subclass to create a buffer with offset and size, the default
- * implementation will use the negotiated allocator and call fill. */
+ * implementation will call alloc and fill. */
GstFlowReturn (*create) (GstBaseSrc *src, guint64 offset, guint size,
GstBuffer **buf);
+ /* ask the subclass to allocate an output buffer. The default implementation
+ * will use the negotiated allocator. */
+ GstFlowReturn (*alloc) (GstBaseSrc *src, guint64 offset, guint size,
+ GstBuffer **buf);
/* ask the subclass to fill the buffer with data from offset and size */
GstFlowReturn (*fill) (GstBaseSrc *src, guint64 offset, guint size,
GstBuffer *buf);