Remove pad_alloc, this can now be done better
authorWim Taymans <wim.taymans@collabora.co.uk>
Fri, 29 Apr 2011 11:26:19 +0000 (13:26 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Fri, 29 Apr 2011 11:26:19 +0000 (13:26 +0200)
Remove pad_alloc and all references. This can now be done more efficiently and
more flexible with the ALLOCATION query and the bufferpool objects. There is no
reverse negotiation yet but that will be done with an event later.

22 files changed:
gst/gstghostpad.c
gst/gstpad.c
gst/gstpad.h
libs/gst/base/gstbasesink.c
libs/gst/base/gstbasesink.h
libs/gst/base/gstbasetransform.c
plugins/elements/gstfunnel.c
plugins/elements/gstinputselector.c
plugins/elements/gstmultiqueue.c
plugins/elements/gstoutputselector.c
plugins/elements/gstqueue.c
plugins/elements/gstqueue2.c
plugins/elements/gsttee.c
plugins/elements/gstvalve.c
tests/check/elements/funnel.c
tests/check/elements/tee.c
tests/check/elements/valve.c
tests/check/libs/test_transform.c
tests/check/libs/transform1.c
tools/gst-inspect.c
tools/gst-xmlinspect.c
win32/common/libgstreamer.def

index 17bc229..ab8d5e5 100644 (file)
@@ -140,21 +140,6 @@ gst_proxy_pad_do_iterate_internal_links (GstPad * pad)
 }
 
 static GstFlowReturn
-gst_proxy_pad_do_bufferalloc (GstPad * pad, guint64 offset, guint size,
-    GstCaps * caps, GstBuffer ** buf)
-{
-  GstFlowReturn result = GST_FLOW_WRONG_STATE;
-  GstPad *internal = gst_proxy_pad_get_internal (pad);
-
-  if (internal) {
-    result = gst_pad_alloc_buffer (internal, offset, size, caps, buf);
-    gst_object_unref (internal);
-  }
-
-  return result;
-}
-
-static GstFlowReturn
 gst_proxy_pad_do_chain (GstPad * pad, GstBuffer * buffer)
 {
   GstFlowReturn res;
@@ -408,7 +393,6 @@ gst_proxy_pad_class_init (GstProxyPadClass * klass)
   GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_do_fixatecaps);
   GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_do_setcaps);
   GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_do_unlink);
-  GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_do_bufferalloc);
   GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_do_chain);
   GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_do_chain_list);
   GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_do_getrange);
@@ -854,7 +838,6 @@ gst_ghost_pad_construct (GstGhostPad * gpad)
 
   /* Set directional padfunctions for ghostpad */
   if (dir == GST_PAD_SINK) {
-    gst_pad_set_bufferalloc_function (pad, gst_proxy_pad_do_bufferalloc);
     gst_pad_set_chain_function (pad, gst_proxy_pad_do_chain);
     gst_pad_set_chain_list_function (pad, gst_proxy_pad_do_chain_list);
   } else {
@@ -883,7 +866,6 @@ gst_ghost_pad_construct (GstGhostPad * gpad)
 
   /* Set directional padfunctions for internal pad */
   if (dir == GST_PAD_SRC) {
-    gst_pad_set_bufferalloc_function (internal, gst_proxy_pad_do_bufferalloc);
     gst_pad_set_chain_function (internal, gst_proxy_pad_do_chain);
     gst_pad_set_chain_list_function (internal, gst_proxy_pad_do_chain_list);
   } else {
index 5dfb8f1..a4ec61d 100644 (file)
@@ -1612,26 +1612,6 @@ gst_pad_set_setcaps_function (GstPad * pad, GstPadSetCapsFunction setcaps)
 }
 
 /**
- * gst_pad_set_bufferalloc_function:
- * @pad: a sink #GstPad.
- * @bufalloc: the #GstPadBufferAllocFunction to set.
- *
- * Sets the given bufferalloc function for the pad. Note that the
- * bufferalloc function can only be set on sinkpads.
- */
-void
-gst_pad_set_bufferalloc_function (GstPad * pad,
-    GstPadBufferAllocFunction bufalloc)
-{
-  g_return_if_fail (GST_IS_PAD (pad));
-  g_return_if_fail (GST_PAD_IS_SINK (pad));
-
-  GST_PAD_BUFFERALLOCFUNC (pad) = bufalloc;
-  GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "bufferallocfunc set to %s",
-      GST_DEBUG_FUNCPTR_NAME (bufalloc));
-}
-
-/**
  * gst_pad_unlink:
  * @srcpad: the source #GstPad to unlink.
  * @sinkpad: the sink #GstPad to unlink.
@@ -2821,260 +2801,6 @@ no_peer:
   }
 }
 
-/* calls the buffer_alloc function on the given pad */
-static GstFlowReturn
-gst_pad_buffer_alloc_unchecked (GstPad * pad, guint64 offset, guint size,
-    GstCaps * caps, GstBuffer ** buf)
-{
-  GstFlowReturn ret;
-  GstPadBufferAllocFunction bufferallocfunc;
-
-  GST_OBJECT_LOCK (pad);
-  /* when the pad is flushing we cannot give a buffer */
-  if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad)))
-    goto flushing;
-
-  bufferallocfunc = pad->bufferallocfunc;
-
-  if (offset == GST_BUFFER_OFFSET_NONE) {
-    GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
-        "calling bufferallocfunc &%s (@%p) for size %u offset NONE",
-        GST_DEBUG_FUNCPTR_NAME (bufferallocfunc), bufferallocfunc, size);
-  } else {
-    GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
-        "calling bufferallocfunc &%s (@%p) of for size %u offset %"
-        G_GUINT64_FORMAT, GST_DEBUG_FUNCPTR_NAME (bufferallocfunc),
-        bufferallocfunc, size, offset);
-  }
-  GST_OBJECT_UNLOCK (pad);
-
-  /* G_LIKELY for now since most elements don't implement a buffer alloc
-   * function and there is no default alloc proxy function as this is usually
-   * not possible. */
-  if (G_LIKELY (bufferallocfunc == NULL))
-    goto fallback;
-
-  ret = bufferallocfunc (pad, offset, size, caps, buf);
-
-  if (G_UNLIKELY (ret != GST_FLOW_OK))
-    goto error;
-
-  /* no error, but NULL buffer means fallback to the default */
-  if (G_UNLIKELY (*buf == NULL))
-    goto fallback;
-
-  /* If the buffer alloc function didn't set up the caps like it should,
-   * do it for it */
-  if (G_UNLIKELY (caps && (GST_BUFFER_CAPS (*buf) == NULL))) {
-    GST_WARNING_OBJECT (pad,
-        "Buffer allocation function did not set caps. Setting");
-    gst_buffer_set_caps (*buf, caps);
-  }
-  return ret;
-
-flushing:
-  {
-    /* pad was flushing */
-    GST_OBJECT_UNLOCK (pad);
-    GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "pad was flushing");
-    return GST_FLOW_WRONG_STATE;
-  }
-error:
-  {
-    GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
-        "alloc function returned error (%d) %s", ret, gst_flow_get_name (ret));
-    return ret;
-  }
-fallback:
-  {
-    /* fallback case, allocate a buffer of our own, add pad caps. */
-    GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "fallback buffer alloc");
-
-    if ((*buf = gst_buffer_new_and_alloc (size))) {
-      GST_BUFFER_OFFSET (*buf) = offset;
-      gst_buffer_set_caps (*buf, caps);
-      return GST_FLOW_OK;
-    } else {
-      GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
-          "out of memory allocating %u bytes", size);
-      return GST_FLOW_ERROR;
-    }
-  }
-}
-
-static GstFlowReturn
-gst_pad_alloc_buffer_full (GstPad * pad, guint64 offset, guint size,
-    GstCaps * caps, GstBuffer ** buf, gboolean setcaps)
-{
-  GstPad *peer;
-  GstFlowReturn ret;
-  GstCaps *newcaps;
-  gboolean caps_changed;
-
-  g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR);
-  g_return_val_if_fail (GST_PAD_IS_SRC (pad), GST_FLOW_ERROR);
-  g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR);
-
-  GST_DEBUG_OBJECT (pad, "offset %" G_GUINT64_FORMAT ", size %u, caps %"
-      GST_PTR_FORMAT, offset, size, caps);
-
-  GST_OBJECT_LOCK (pad);
-  while (G_UNLIKELY (GST_PAD_IS_BLOCKED (pad)))
-    if ((ret = handle_pad_block (pad)) != GST_FLOW_OK)
-      goto flushed;
-
-  if (G_UNLIKELY ((peer = GST_PAD_PEER (pad)) == NULL))
-    goto no_peer;
-
-  gst_object_ref (peer);
-  GST_OBJECT_UNLOCK (pad);
-
-  ret = gst_pad_buffer_alloc_unchecked (peer, offset, size, caps, buf);
-  gst_object_unref (peer);
-
-  if (G_UNLIKELY (ret != GST_FLOW_OK))
-    goto peer_error;
-
-  /* FIXME, move capnego this into a base class? */
-  newcaps = GST_BUFFER_CAPS (*buf);
-
-  /* Lock for checking caps, pretty pointless as the _pad_push() function might
-   * change it concurrently, one of the problems with automatic caps setting in
-   * pad_alloc_and_set_caps. Worst case, if does a check too much, but only
-   * when there is heavy renegotiation going on in both directions. */
-  GST_OBJECT_LOCK (pad);
-  caps_changed = newcaps && newcaps != GST_PAD_CAPS (pad);
-  GST_OBJECT_UNLOCK (pad);
-
-  /* we got a new datatype on the pad, see if it can handle it */
-  if (G_UNLIKELY (caps_changed)) {
-    GST_DEBUG_OBJECT (pad,
-        "caps changed from %" GST_PTR_FORMAT " to %p %" GST_PTR_FORMAT,
-        GST_PAD_CAPS (pad), newcaps, newcaps);
-    if (G_UNLIKELY (!gst_pad_configure_src (pad, newcaps, setcaps)))
-      goto not_negotiated;
-  }
-
-  /* sanity check (only if caps are the same) */
-  if (G_LIKELY (newcaps == caps)
-      && G_UNLIKELY (gst_buffer_get_size (*buf) < size))
-    goto wrong_size_fallback;
-
-  return ret;
-
-flushed:
-  {
-    GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "pad block stopped by flush");
-    GST_OBJECT_UNLOCK (pad);
-    return ret;
-  }
-no_peer:
-  {
-    /* pad has no peer */
-    GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
-        "called bufferallocfunc but had no peer");
-    GST_OBJECT_UNLOCK (pad);
-    return GST_FLOW_NOT_LINKED;
-  }
-peer_error:
-  {
-    GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
-        "alloc function returned error %s", gst_flow_get_name (ret));
-    return ret;
-  }
-not_negotiated:
-  {
-    gst_buffer_unref (*buf);
-    *buf = NULL;
-    GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
-        "alloc function returned unacceptable buffer");
-    return GST_FLOW_NOT_NEGOTIATED;
-  }
-wrong_size_fallback:
-  {
-    GST_CAT_ERROR_OBJECT (GST_CAT_PADS, pad, "buffer returned by alloc "
-        "function is too small (%u < %u), doing fallback buffer alloc",
-        gst_buffer_get_size (*buf), size);
-
-    gst_buffer_unref (*buf);
-
-    if ((*buf = gst_buffer_new_and_alloc (size))) {
-      GST_BUFFER_OFFSET (*buf) = offset;
-      gst_buffer_set_caps (*buf, caps);
-      return GST_FLOW_OK;
-    } else {
-      GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
-          "out of memory allocating %d bytes", size);
-      return GST_FLOW_ERROR;
-    }
-  }
-}
-
-/**
- * gst_pad_alloc_buffer:
- * @pad: a source #GstPad
- * @offset: the offset of the new buffer in the stream
- * @size: the size of the new buffer
- * @caps: the caps of the new buffer
- * @buf: a newly allocated buffer
- *
- * Allocates a new, empty buffer optimized to push to pad @pad.  This
- * function only works if @pad is a source pad and has a peer.
- *
- * A new, empty #GstBuffer will be put in the @buf argument.
- * You need to check the caps of the buffer after performing this
- * function and renegotiate to the format if needed. If the caps changed, it is
- * possible that the buffer returned in @buf is not of the right size for the
- * new format, @buf needs to be unreffed and reallocated if this is the case.
- *
- * Returns: a result code indicating success of the operation. Any
- * result code other than #GST_FLOW_OK is an error and @buf should
- * not be used.
- * An error can occur if the pad is not connected or when the downstream
- * peer elements cannot provide an acceptable buffer.
- *
- * MT safe.
- */
-
-GstFlowReturn
-gst_pad_alloc_buffer (GstPad * pad, guint64 offset, guint size, GstCaps * caps,
-    GstBuffer ** buf)
-{
-  return gst_pad_alloc_buffer_full (pad, offset, size, caps, buf, FALSE);
-}
-
-/**
- * gst_pad_alloc_buffer_and_set_caps:
- * @pad: a source #GstPad
- * @offset: the offset of the new buffer in the stream
- * @size: the size of the new buffer
- * @caps: (transfer none): the caps of the new buffer
- * @buf: (out callee-allocates): a newly allocated buffer
- *
- * In addition to the function gst_pad_alloc_buffer(), this function
- * automatically calls gst_pad_set_caps() when the caps of the
- * newly allocated buffer are different from the @pad caps.
- *
- * After a renegotiation, the size of the new buffer returned in @buf could
- * be of the wrong size for the new format and must be unreffed an reallocated
- * in that case.
- *
- * Returns: a result code indicating success of the operation. Any
- * result code other than #GST_FLOW_OK is an error and @buf should
- * not be used.
- * An error can occur if the pad is not connected or when the downstream
- * peer elements cannot provide an acceptable buffer.
- *
- * MT safe.
- */
-GstFlowReturn
-gst_pad_alloc_buffer_and_set_caps (GstPad * pad, guint64 offset, guint size,
-    GstCaps * caps, GstBuffer ** buf)
-{
-  return gst_pad_alloc_buffer_full (pad, offset, size, caps, buf, TRUE);
-}
-
-
 static GstIteratorItem
 iterate_pad (GstIterator * it, GstPad * pad)
 {
@@ -3497,8 +3223,8 @@ gst_pad_query_default (GstPad * pad, GstQuery * query)
  * called.
  *
  * This function performs the pad blocking when an event, buffer push
- * or buffer_alloc is performed on a _SRC_ pad. It blocks the
- * streaming thread after informing the pad has been blocked.
+ * is performed on a _SRC_ pad. It blocks the streaming thread after
+ * informing the pad has been blocked.
  *
  * An application can with this method wait and block any streaming
  * thread and perform operations such as seeking or linking.
index 86696ae..949e625 100644 (file)
@@ -463,41 +463,6 @@ typedef gboolean           (*GstPadAcceptCapsFunction)     (GstPad *pad, GstCaps *caps);
  * elements can override this function to perform other behaviour.
  */
 typedef void                   (*GstPadFixateCapsFunction)     (GstPad *pad, GstCaps *caps);
-/**
- * GstPadBufferAllocFunction:
- * @pad: a sink #GstPad
- * @offset: the desired offset of the buffer
- * @size: the desired size of the buffer
- * @caps: the desired caps of the buffer
- * @buf: pointer to hold the allocated buffer.
- *
- * Ask the sinkpad @pad to allocate a buffer with @offset, @size and @caps.
- * The result will be stored in @buf.
- *
- * The purpose of this function is to allocate a buffer that is optimal to
- * be processed by @pad. The function is mostly overridden by elements that can
- * provide a hardware buffer in order to avoid additional memcpy operations.
- *
- * The function can return a buffer that has caps different from the requested
- * @caps, in which case the upstream element requests a format change to this
- * new caps.
- * If a format change was requested, the returned buffer will be one to hold
- * the data of said new caps, so its size might be different from the requested
- * @size.
- *
- * When this function returns anything else than #GST_FLOW_OK, the buffer allocation
- * failed and @buf does not contain valid data. If the function returns #GST_FLOW_OK and
- * the @buf is NULL, a #GstBuffer will be created with @caps, @offset and @size.
- *
- * By default this function returns a new buffer of @size and with @caps containing
- * purely malloced data. The buffer should be freed with gst_buffer_unref()
- * after usage.
- *
- * Returns: #GST_FLOW_OK if @buf contains a valid buffer, any other return
- *  value means @buf does not hold a valid buffer.
- */
-typedef GstFlowReturn          (*GstPadBufferAllocFunction)    (GstPad *pad, guint64 offset, guint size,
-                                                                GstCaps *caps, GstBuffer **buf);
 
 /* misc */
 /**
@@ -595,7 +560,6 @@ typedef struct _GstPadTemplate GstPadTemplate;
  * @querytypefunc: get list of supported queries
  * @queryfunc: perform a query on the pad
  * @intlinkfunc: get the internal links of this pad
- * @bufferallocfunc: function to allocate a buffer for this pad
  * @do_buffer_signals: counter counting installed buffer signals
  * @do_event_signals: counter counting installed event signals
  * @iterintlinkfunc: get the internal links iterator of this pad
@@ -660,8 +624,6 @@ struct _GstPad {
   /* internal links */
   GstPadIterIntLinkFunction      iterintlinkfunc;
 
-  GstPadBufferAllocFunction      bufferallocfunc;
-
   /* whether to emit signals for have-data. counts number
    * of handlers attached. */
   gint                          do_buffer_signals;
@@ -725,8 +687,6 @@ struct _GstPadClass {
 #define GST_PAD_ACCEPTCAPSFUNC(pad)    (GST_PAD_CAST(pad)->acceptcapsfunc)
 #define GST_PAD_FIXATECAPSFUNC(pad)    (GST_PAD_CAST(pad)->fixatecapsfunc)
 
-#define GST_PAD_BUFFERALLOCFUNC(pad)   (GST_PAD_CAST(pad)->bufferallocfunc)
-
 #define GST_PAD_DO_BUFFER_SIGNALS(pad)         (GST_PAD_CAST(pad)->do_buffer_signals)
 #define GST_PAD_DO_EVENT_SIGNALS(pad)  (GST_PAD_CAST(pad)->do_event_signals)
 
@@ -847,12 +807,6 @@ gpointer           gst_pad_get_element_private             (GstPad *pad);
 
 GstPadTemplate*                gst_pad_get_pad_template                (GstPad *pad);
 
-void                   gst_pad_set_bufferalloc_function        (GstPad *pad, GstPadBufferAllocFunction bufalloc);
-GstFlowReturn          gst_pad_alloc_buffer                    (GstPad *pad, guint64 offset, guint size,
-                                                                GstCaps *caps, GstBuffer **buf);
-GstFlowReturn          gst_pad_alloc_buffer_and_set_caps       (GstPad *pad, guint64 offset, guint size,
-                                                                GstCaps *caps, GstBuffer **buf);
-
 /* data passing setup functions */
 void                   gst_pad_set_activate_function           (GstPad *pad, GstPadActivateFunction activate);
 void                   gst_pad_set_activatepull_function       (GstPad *pad, GstPadActivateModeFunction activatepull);
index a5feebd..c2adb67 100644 (file)
  * very specific elements (such as file sinks) which need to handle the
  * newsegment event specially.
  *
- * #GstBaseSink provides an overridable #GstBaseSinkClass.buffer_alloc()
- * function that can be used by sinks that want to do reverse negotiation or to
- * provide custom buffers (hardware buffers for example) to upstream elements.
- *
  * The #GstBaseSinkClass.unlock() method is called when the elements should
  * unblock any blocking operations they perform in the
  * #GstBaseSinkClass.render() method. This is mostly useful when the
@@ -369,8 +365,6 @@ static const GstQueryType *gst_base_sink_get_query_types (GstElement * element);
 
 static GstCaps *gst_base_sink_get_caps (GstBaseSink * sink);
 static gboolean gst_base_sink_set_caps (GstBaseSink * sink, GstCaps * caps);
-static GstFlowReturn gst_base_sink_buffer_alloc (GstBaseSink * sink,
-    guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
 static void gst_base_sink_get_times (GstBaseSink * basesink, GstBuffer * buffer,
     GstClockTime * start, GstClockTime * end);
 static gboolean gst_base_sink_set_flushing (GstBaseSink * basesink,
@@ -399,9 +393,6 @@ static gboolean gst_base_sink_negotiate_pull (GstBaseSink * basesink);
 static GstCaps *gst_base_sink_pad_getcaps (GstPad * pad);
 static gboolean gst_base_sink_pad_setcaps (GstPad * pad, GstCaps * caps);
 static void gst_base_sink_pad_fixate (GstPad * pad, GstCaps * caps);
-static GstFlowReturn gst_base_sink_pad_buffer_alloc (GstPad * pad,
-    guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
-
 
 /* check if an object was too late */
 static gboolean gst_base_sink_is_too_late (GstBaseSink * basesink,
@@ -556,7 +547,6 @@ gst_base_sink_class_init (GstBaseSinkClass * klass)
 
   klass->get_caps = GST_DEBUG_FUNCPTR (gst_base_sink_get_caps);
   klass->set_caps = GST_DEBUG_FUNCPTR (gst_base_sink_set_caps);
-  klass->buffer_alloc = GST_DEBUG_FUNCPTR (gst_base_sink_buffer_alloc);
   klass->get_times = GST_DEBUG_FUNCPTR (gst_base_sink_get_times);
   klass->activate_pull =
       GST_DEBUG_FUNCPTR (gst_base_sink_default_activate_pull);
@@ -565,7 +555,6 @@ gst_base_sink_class_init (GstBaseSinkClass * klass)
   GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_pad_getcaps);
   GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_pad_setcaps);
   GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_pad_fixate);
-  GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_pad_buffer_alloc);
   GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_pad_activate);
   GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_pad_activate_push);
   GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_pad_activate_pull);
@@ -644,29 +633,6 @@ gst_base_sink_pad_fixate (GstPad * pad, GstCaps * caps)
   gst_object_unref (bsink);
 }
 
-static GstFlowReturn
-gst_base_sink_pad_buffer_alloc (GstPad * pad, guint64 offset, guint size,
-    GstCaps * caps, GstBuffer ** buf)
-{
-  GstBaseSinkClass *bclass;
-  GstBaseSink *bsink;
-  GstFlowReturn result = GST_FLOW_OK;
-
-  bsink = GST_BASE_SINK (gst_pad_get_parent (pad));
-  if (G_UNLIKELY (bsink == NULL))
-    return GST_FLOW_WRONG_STATE;
-  bclass = GST_BASE_SINK_GET_CLASS (bsink);
-
-  if (bclass->buffer_alloc)
-    result = bclass->buffer_alloc (bsink, offset, size, caps, buf);
-  else
-    *buf = NULL;                /* fallback in gstpad.c will allocate generic buffer */
-
-  gst_object_unref (bsink);
-
-  return result;
-}
-
 static void
 gst_base_sink_init (GstBaseSink * basesink, gpointer g_class)
 {
@@ -684,8 +650,6 @@ gst_base_sink_init (GstBaseSink * basesink, gpointer g_class)
   gst_pad_set_getcaps_function (basesink->sinkpad, gst_base_sink_pad_getcaps);
   gst_pad_set_setcaps_function (basesink->sinkpad, gst_base_sink_pad_setcaps);
   gst_pad_set_fixatecaps_function (basesink->sinkpad, gst_base_sink_pad_fixate);
-  gst_pad_set_bufferalloc_function (basesink->sinkpad,
-      gst_base_sink_pad_buffer_alloc);
   gst_pad_set_activate_function (basesink->sinkpad, gst_base_sink_pad_activate);
   gst_pad_set_activatepush_function (basesink->sinkpad,
       gst_base_sink_pad_activate_push);
@@ -1464,14 +1428,6 @@ gst_base_sink_set_caps (GstBaseSink * sink, GstCaps * caps)
   return TRUE;
 }
 
-static GstFlowReturn
-gst_base_sink_buffer_alloc (GstBaseSink * sink, guint64 offset, guint size,
-    GstCaps * caps, GstBuffer ** buf)
-{
-  *buf = NULL;
-  return GST_FLOW_OK;
-}
-
 /* with PREROLL_LOCK, STREAM_LOCK */
 static void
 gst_base_sink_preroll_queue_flush (GstBaseSink * basesink, GstPad * pad)
index 92ee1f7..5b8ab90 100644 (file)
@@ -117,7 +117,6 @@ struct _GstBaseSink {
  * @parent_class: Element parent class
  * @get_caps: Called to get sink pad caps from the subclass
  * @set_caps: Notify subclass of changed caps
- * @buffer_alloc: Subclasses can override to perform custom buffer allocations
  * @get_times: Called to get the start and end times for synchronising
  *     the passed buffer to the clock
  * @start: Start processing. Ideal for opening resources in the subclass
@@ -161,10 +160,6 @@ struct _GstBaseSinkClass {
   /* start or stop a pulling thread */
   gboolean      (*activate_pull)(GstBaseSink *sink, gboolean active);
 
-  /* allocate a new buffer with given caps */
-  GstFlowReturn (*buffer_alloc) (GstBaseSink *sink, guint64 offset, guint size,
-                                 GstCaps *caps, GstBuffer **buf);
-
   /* get the start and end times for syncing on this buffer */
   void          (*get_times)    (GstBaseSink *sink, GstBuffer *buffer,
                                  GstClockTime *start, GstClockTime *end);
index ea9be07..02ed892 100644 (file)
@@ -347,8 +347,6 @@ static gboolean gst_base_transform_acceptcaps (GstPad * pad, GstCaps * caps);
 static gboolean gst_base_transform_acceptcaps_default (GstBaseTransform * trans,
     GstPadDirection direction, GstCaps * caps);
 static gboolean gst_base_transform_setcaps (GstPad * pad, GstCaps * caps);
-static GstFlowReturn gst_base_transform_buffer_alloc (GstPad * pad,
-    guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
 static gboolean gst_base_transform_query (GstPad * pad, GstQuery * query);
 static const GstQueryType *gst_base_transform_query_type (GstPad * pad);
 
@@ -425,8 +423,6 @@ gst_base_transform_init (GstBaseTransform * trans,
       GST_DEBUG_FUNCPTR (gst_base_transform_chain));
   gst_pad_set_activatepush_function (trans->sinkpad,
       GST_DEBUG_FUNCPTR (gst_base_transform_sink_activate_push));
-  gst_pad_set_bufferalloc_function (trans->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_base_transform_buffer_alloc));
   gst_pad_set_query_function (trans->sinkpad,
       GST_DEBUG_FUNCPTR (gst_base_transform_query));
   gst_pad_set_query_type_function (trans->sinkpad,
@@ -1421,10 +1417,14 @@ gst_base_transform_prepare_output_buffer (GstBaseTransform * trans,
       GST_DEBUG_OBJECT (trans, "doing alloc with caps %" GST_PTR_FORMAT,
           oldcaps);
 
+      *out_buf = gst_buffer_ref (in_buf);
+
+#if 0
       ret = gst_pad_alloc_buffer (trans->srcpad,
           GST_BUFFER_OFFSET (in_buf), outsize, oldcaps, out_buf);
       if (ret != GST_FLOW_OK)
         goto alloc_failed;
+#endif
     }
   }
 
@@ -1704,299 +1704,6 @@ gst_base_transform_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
   return res;
 }
 
-/* your upstream peer wants to send you a buffer
- * that buffer has the given offset, size and caps
- * you're requested to allocate a buffer
- */
-static GstFlowReturn
-gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size,
-    GstCaps * caps, GstBuffer ** buf)
-{
-  GstBaseTransform *trans;
-  GstBaseTransformClass *klass;
-  GstBaseTransformPrivate *priv;
-  GstFlowReturn res;
-  gboolean alloced = FALSE;
-  gboolean proxy, suggest, same_caps;
-  GstCaps *sink_suggest = NULL;
-  gsize size_suggest;
-
-  trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad));
-  if (G_UNLIKELY (trans == NULL))
-    return GST_FLOW_WRONG_STATE;
-  klass = GST_BASE_TRANSFORM_GET_CLASS (trans);
-  priv = trans->priv;
-
-  GST_DEBUG_OBJECT (pad, "alloc with caps %p %" GST_PTR_FORMAT ", size %u",
-      caps, caps, size);
-
-  /* if the code below does not come up with a better buffer, we will return _OK
-   * and an empty buffer. This will trigger the core to allocate a buffer with
-   * given input size and caps. */
-  *buf = NULL;
-  res = GST_FLOW_OK;
-
-  /* we remember our previous alloc request to quickly see if we can proxy or
-   * not. We skip this check if we have a pending suggestion. */
-  GST_OBJECT_LOCK (pad);
-  same_caps = !priv->suggest_pending && caps &&
-      gst_caps_is_equal (priv->sink_alloc, caps);
-  GST_OBJECT_UNLOCK (pad);
-
-  if (same_caps) {
-    /* we have seen this before, see below if we need to proxy */
-    GST_DEBUG_OBJECT (trans, "have old caps %p, size %u", caps, size);
-    gst_caps_replace (&sink_suggest, caps);
-    size_suggest = size;
-    suggest = FALSE;
-  } else {
-    GST_DEBUG_OBJECT (trans, "new format %p %" GST_PTR_FORMAT, caps, caps);
-
-    /* if we have a suggestion, pretend we got these as input */
-    GST_OBJECT_LOCK (pad);
-    if ((priv->sink_suggest && !gst_caps_is_equal (caps, priv->sink_suggest))) {
-      sink_suggest = gst_caps_ref (priv->sink_suggest);
-      size_suggest = priv->size_suggest;
-      GST_DEBUG_OBJECT (trans, "have suggestion %p %" GST_PTR_FORMAT " size %u",
-          sink_suggest, sink_suggest, priv->size_suggest);
-      /* suggest is TRUE when we have a custom suggestion pending that we need
-       * to unref later. */
-      suggest = TRUE;
-    } else {
-      GST_DEBUG_OBJECT (trans, "using caps %p %" GST_PTR_FORMAT " size %u",
-          caps, caps, size);
-      gst_caps_replace (&sink_suggest, caps);
-      size_suggest = size;
-      suggest = FALSE;
-    }
-    priv->suggest_pending = FALSE;
-    GST_OBJECT_UNLOCK (pad);
-
-    /* check if we actually handle this format on the sinkpad */
-    if (sink_suggest) {
-      const GstCaps *templ;
-
-      if (!gst_caps_is_fixed (sink_suggest)) {
-        GstCaps *peercaps;
-
-        GST_DEBUG_OBJECT (trans, "Suggested caps is not fixed: %"
-            GST_PTR_FORMAT, sink_suggest);
-
-        peercaps = gst_pad_peer_get_caps (GST_BASE_TRANSFORM_SINK_PAD (trans));
-        /* try fixating by intersecting with peer caps */
-        if (peercaps) {
-          GstCaps *intersect;
-
-          intersect = gst_caps_intersect (peercaps, sink_suggest);
-          gst_caps_unref (peercaps);
-          gst_caps_unref (sink_suggest);
-          sink_suggest = intersect;
-        }
-
-        if (gst_caps_is_empty (sink_suggest))
-          goto not_supported;
-
-        /* try the alloc caps if it is still not fixed */
-        if (!gst_caps_is_fixed (sink_suggest)) {
-          GstCaps *intersect;
-
-          GST_DEBUG_OBJECT (trans, "Checking if the input caps is compatible "
-              "with the non-fixed caps suggestion");
-          intersect = gst_caps_intersect (sink_suggest, caps);
-          if (!gst_caps_is_empty (intersect)) {
-            GST_DEBUG_OBJECT (trans, "It is, using it");
-            gst_caps_replace (&sink_suggest, caps);
-          }
-          gst_caps_unref (intersect);
-        }
-
-        /* be safe and call default fixate */
-        sink_suggest = gst_caps_make_writable (sink_suggest);
-        gst_pad_fixate_caps (GST_BASE_TRANSFORM_SINK_PAD (trans), sink_suggest);
-
-        if (!gst_caps_is_fixed (sink_suggest)) {
-          gst_caps_unref (sink_suggest);
-          sink_suggest = NULL;
-        }
-
-        GST_DEBUG_OBJECT (trans, "Caps fixed to: %" GST_PTR_FORMAT,
-            sink_suggest);
-      }
-
-      if (sink_suggest) {
-        templ = gst_pad_get_pad_template_caps (pad);
-
-        if (!gst_caps_can_intersect (sink_suggest, templ)) {
-          GstCaps *allowed;
-          GstCaps *peercaps;
-
-          GST_DEBUG_OBJECT (trans,
-              "Requested pad alloc caps are not supported: %" GST_PTR_FORMAT,
-              sink_suggest);
-          /* the requested pad alloc caps are not supported, so let's try
-           * picking something allowed between the pads (they are linked,
-           * there must be something) */
-          allowed = gst_pad_get_allowed_caps (pad);
-          if (allowed && !gst_caps_is_empty (allowed)) {
-            GST_DEBUG_OBJECT (trans,
-                "pads could agree on one of the following caps: " "%"
-                GST_PTR_FORMAT, allowed);
-            allowed = gst_caps_make_writable (allowed);
-
-            if (klass->fixate_caps) {
-              peercaps =
-                  gst_pad_get_allowed_caps (GST_BASE_TRANSFORM_SRC_PAD (trans));
-              klass->fixate_caps (trans, GST_PAD_SRC, peercaps, allowed);
-              gst_caps_unref (peercaps);
-            }
-
-            /* Fixate them to be safe if the subclass didn't do it */
-            gst_caps_truncate (allowed);
-            gst_pad_fixate_caps (pad, allowed);
-            gst_caps_replace (&sink_suggest, allowed);
-            gst_caps_unref (allowed);
-
-            suggest = TRUE;
-
-            GST_DEBUG_OBJECT (trans, "Fixated suggestion caps to %"
-                GST_PTR_FORMAT, sink_suggest);
-          } else {
-            if (allowed)
-              gst_caps_unref (allowed);
-            goto not_supported;
-          }
-        }
-      }
-    }
-
-    /* find the best format for the other side here we decide if we will proxy
-     * the caps or not. */
-    if (sink_suggest == NULL) {
-      /* always proxy when the caps are NULL. When this is a new format, see if
-       * we can proxy it downstream */
-      GST_DEBUG_OBJECT (trans, "null caps, marking for proxy");
-      priv->proxy_alloc = TRUE;
-    } else {
-      GstCaps *othercaps;
-
-      /* we have a new format, see what we need to proxy to */
-      othercaps = gst_base_transform_find_transform (trans, pad, sink_suggest);
-      if (!othercaps || gst_caps_is_empty (othercaps)) {
-        /* no transform possible, we certainly can't proxy */
-        GST_DEBUG_OBJECT (trans, "can't find transform, disable proxy");
-        priv->proxy_alloc = FALSE;
-      } else {
-        /* we transformed into something */
-        if (gst_caps_is_equal (sink_suggest, othercaps)) {
-          GST_DEBUG_OBJECT (trans,
-              "best caps same as input, marking for proxy");
-          priv->proxy_alloc = TRUE;
-        } else {
-          GST_DEBUG_OBJECT (trans,
-              "best caps different from input, disable proxy");
-          priv->proxy_alloc = FALSE;
-        }
-      }
-      if (othercaps)
-        gst_caps_unref (othercaps);
-    }
-  }
-  /* remember the new caps */
-  GST_OBJECT_LOCK (pad);
-  gst_caps_replace (&priv->sink_alloc, sink_suggest);
-  GST_OBJECT_UNLOCK (pad);
-
-  proxy = priv->proxy_alloc;
-  GST_DEBUG_OBJECT (trans, "doing default alloc, proxy %d, suggest %d", proxy,
-      suggest);
-
-  /* we only want to proxy if we have no suggestion pending, FIXME */
-  if (proxy && !suggest) {
-    GstCaps *newcaps;
-
-    GST_DEBUG_OBJECT (trans, "proxy buffer-alloc with caps %p %" GST_PTR_FORMAT
-        ", size %u", caps, caps, size);
-
-    /* we always proxy the input caps, never the suggestion. The reason is that
-     * We don't yet handle the caps of renegotiation in here. FIXME */
-    res = gst_pad_alloc_buffer (trans->srcpad, offset, size, caps, buf);
-    if (res != GST_FLOW_OK)
-      goto alloc_failed;
-    alloced = TRUE;
-
-    /* check if the caps changed */
-    newcaps = GST_BUFFER_CAPS (*buf);
-
-    GST_DEBUG_OBJECT (trans, "got caps %" GST_PTR_FORMAT, newcaps);
-
-    if (!gst_caps_is_equal (newcaps, caps)) {
-      GST_DEBUG_OBJECT (trans, "caps are new");
-      /* we have new caps, see if we can proxy downstream */
-      if (gst_pad_peer_accept_caps (pad, newcaps)) {
-        /* peer accepts the caps, return a buffer in this format */
-        GST_DEBUG_OBJECT (trans, "peer accepted new caps");
-        /* remember the format */
-        GST_OBJECT_LOCK (pad);
-        gst_caps_replace (&priv->sink_alloc, newcaps);
-        GST_OBJECT_UNLOCK (pad);
-      } else {
-        GST_DEBUG_OBJECT (trans, "peer did not accept new caps");
-        /* peer does not accept the caps, disable proxy_alloc, free the
-         * buffer we received and create a buffer of the requested format
-         * by the default handler. */
-        GST_DEBUG_OBJECT (trans, "disabling proxy");
-        priv->proxy_alloc = FALSE;
-        gst_buffer_unref (*buf);
-        *buf = NULL;
-      }
-    } else {
-      GST_DEBUG_OBJECT (trans, "received required caps from peer");
-    }
-  }
-
-  if (suggest) {
-    /* there was a custom suggestion, create a buffer of this format and return
-     * it. Note that this format  */
-    *buf = gst_buffer_new_and_alloc (size_suggest);
-    GST_DEBUG_OBJECT (trans,
-        "doing suggestion of size %u, caps %p %" GST_PTR_FORMAT, size_suggest,
-        sink_suggest, sink_suggest);
-    GST_BUFFER_CAPS (*buf) = sink_suggest;
-    sink_suggest = NULL;
-  }
-
-  if (sink_suggest)
-    gst_caps_unref (sink_suggest);
-
-  if (res == GST_FLOW_OK && alloced) {
-    /* just alloc'ed a buffer, so we only want to do this again if we
-     * received a buffer */
-    GST_DEBUG_OBJECT (trans, "Cleaning force alloc");
-    trans->priv->force_alloc = FALSE;
-  }
-
-  gst_object_unref (trans);
-  return res;
-
-  /* ERRORS */
-alloc_failed:
-  {
-    GST_DEBUG_OBJECT (trans, "pad alloc failed: %s", gst_flow_get_name (res));
-    if (sink_suggest)
-      gst_caps_unref (sink_suggest);
-    gst_object_unref (trans);
-    return res;
-  }
-not_supported:
-  {
-    GST_DEBUG_OBJECT (trans, "pad alloc with unsupported caps");
-    if (sink_suggest)
-      gst_caps_unref (sink_suggest);
-    gst_object_unref (trans);
-    return GST_FLOW_NOT_NEGOTIATED;
-  }
-}
-
 static gboolean
 gst_base_transform_sink_event (GstPad * pad, GstEvent * event)
 {
index 42f664a..d4dafa9 100644 (file)
@@ -118,8 +118,6 @@ static GstPad *gst_funnel_request_new_pad (GstElement * element,
 static void gst_funnel_release_pad (GstElement * element, GstPad * pad);
 
 static GstFlowReturn gst_funnel_sink_chain (GstPad * pad, GstBuffer * buffer);
-static GstFlowReturn gst_funnel_sink_buffer_alloc (GstPad * pad, guint64 offset,
-    guint size, GstCaps * caps, GstBuffer ** buf);
 static gboolean gst_funnel_sink_event (GstPad * pad, GstEvent * event);
 static GstCaps *gst_funnel_sink_getcaps (GstPad * pad);
 
@@ -176,23 +174,6 @@ gst_funnel_init (GstFunnel * funnel)
   gst_element_add_pad (GST_ELEMENT (funnel), funnel->srcpad);
 }
 
-static GstFlowReturn
-gst_funnel_sink_buffer_alloc (GstPad * pad, guint64 offset, guint size,
-    GstCaps * caps, GstBuffer ** buf)
-{
-  GstFunnel *funnel = GST_FUNNEL (gst_pad_get_parent_element (pad));
-  GstFlowReturn ret;
-
-  if (G_UNLIKELY (funnel == NULL))
-    return GST_FLOW_WRONG_STATE;
-
-  ret = gst_pad_alloc_buffer (funnel->srcpad, offset, size, caps, buf);
-
-  gst_object_unref (funnel);
-
-  return ret;
-}
-
 static GstPad *
 gst_funnel_request_new_pad (GstElement * element, GstPadTemplate * templ,
     const gchar * name)
@@ -211,8 +192,6 @@ gst_funnel_request_new_pad (GstElement * element, GstPadTemplate * templ,
       GST_DEBUG_FUNCPTR (gst_funnel_sink_event));
   gst_pad_set_getcaps_function (sinkpad,
       GST_DEBUG_FUNCPTR (gst_funnel_sink_getcaps));
-  gst_pad_set_bufferalloc_function (sinkpad,
-      GST_DEBUG_FUNCPTR (gst_funnel_sink_buffer_alloc));
 
   gst_pad_set_active (sinkpad, TRUE);
 
index b7aae2f..407f692 100644 (file)
@@ -177,8 +177,6 @@ static GstCaps *gst_selector_pad_getcaps (GstPad * pad);
 static gboolean gst_selector_pad_acceptcaps (GstPad * pad, GstCaps * caps);
 static GstIterator *gst_selector_pad_iterate_linked_pads (GstPad * pad);
 static GstFlowReturn gst_selector_pad_chain (GstPad * pad, GstBuffer * buf);
-static GstFlowReturn gst_selector_pad_bufferalloc (GstPad * pad,
-    guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
 
 G_DEFINE_TYPE (GstSelectorPad, gst_selector_pad, GST_TYPE_PAD);
 
@@ -519,70 +517,6 @@ gst_selector_pad_acceptcaps (GstPad * pad, GstCaps * caps)
   return res;
 }
 
-static GstFlowReturn
-gst_selector_pad_bufferalloc (GstPad * pad, guint64 offset,
-    guint size, GstCaps * caps, GstBuffer ** buf)
-{
-  GstInputSelector *sel;
-  GstFlowReturn result;
-  GstPad *active_sinkpad;
-  GstPad *prev_active_sinkpad;
-  GstSelectorPad *selpad;
-
-  sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
-  if (G_UNLIKELY (sel == NULL))
-    return GST_FLOW_WRONG_STATE;
-
-  selpad = GST_SELECTOR_PAD_CAST (pad);
-
-  GST_LOG_OBJECT (pad, "received alloc");
-
-  GST_INPUT_SELECTOR_LOCK (sel);
-  prev_active_sinkpad = sel->active_sinkpad;
-  active_sinkpad = gst_input_selector_activate_sinkpad (sel, pad);
-
-  if (pad != active_sinkpad)
-    goto not_active;
-
-  GST_INPUT_SELECTOR_UNLOCK (sel);
-
-  if (prev_active_sinkpad != active_sinkpad && pad == active_sinkpad) {
-    NOTIFY_MUTEX_LOCK ();
-    g_object_notify (G_OBJECT (sel), "active-pad");
-    NOTIFY_MUTEX_UNLOCK ();
-  }
-
-  result = gst_pad_alloc_buffer (sel->srcpad, offset, size, caps, buf);
-
-done:
-  gst_object_unref (sel);
-
-  return result;
-
-  /* ERRORS */
-not_active:
-  {
-    gboolean active_pad_pushed = GST_SELECTOR_PAD_CAST (active_sinkpad)->pushed;
-
-    GST_INPUT_SELECTOR_UNLOCK (sel);
-
-    /* unselected pad, perform fallback alloc or return unlinked when
-     * asked */
-    GST_OBJECT_LOCK (selpad);
-    if (selpad->always_ok || !active_pad_pushed) {
-      GST_DEBUG_OBJECT (pad, "Not selected, performing fallback allocation");
-      *buf = NULL;
-      result = GST_FLOW_OK;
-    } else {
-      GST_DEBUG_OBJECT (pad, "Not selected, return NOT_LINKED");
-      result = GST_FLOW_NOT_LINKED;
-    }
-    GST_OBJECT_UNLOCK (selpad);
-
-    goto done;
-  }
-}
-
 /* must be called with the SELECTOR_LOCK, will block while the pad is blocked 
  * or return TRUE when flushing */
 static gboolean
@@ -1349,8 +1283,6 @@ gst_input_selector_request_new_pad (GstElement * element,
       GST_DEBUG_FUNCPTR (gst_selector_pad_chain));
   gst_pad_set_iterate_internal_links_function (sinkpad,
       GST_DEBUG_FUNCPTR (gst_selector_pad_iterate_linked_pads));
-  gst_pad_set_bufferalloc_function (sinkpad,
-      GST_DEBUG_FUNCPTR (gst_selector_pad_bufferalloc));
 
   gst_pad_set_active (sinkpad, TRUE);
   gst_element_add_pad (GST_ELEMENT (sel), sinkpad);
index eee3102..e70e78e 100644 (file)
@@ -1425,15 +1425,6 @@ gst_multi_queue_acceptcaps (GstPad * pad, GstCaps * caps)
   return result;
 }
 
-static GstFlowReturn
-gst_multi_queue_bufferalloc (GstPad * pad, guint64 offset, guint size,
-    GstCaps * caps, GstBuffer ** buf)
-{
-  GstSingleQueue *sq = gst_pad_get_element_private (pad);
-
-  return gst_pad_alloc_buffer (sq->srcpad, offset, size, caps, buf);
-}
-
 static gboolean
 gst_multi_queue_src_activate_push (GstPad * pad, gboolean active)
 {
@@ -1787,8 +1778,6 @@ gst_single_queue_new (GstMultiQueue * mqueue, gint id)
       GST_DEBUG_FUNCPTR (gst_multi_queue_getcaps));
   gst_pad_set_acceptcaps_function (sq->sinkpad,
       GST_DEBUG_FUNCPTR (gst_multi_queue_acceptcaps));
-  gst_pad_set_bufferalloc_function (sq->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_multi_queue_bufferalloc));
   gst_pad_set_iterate_internal_links_function (sq->sinkpad,
       GST_DEBUG_FUNCPTR (gst_multi_queue_iterate_internal_links));
 
index 669be3c..ac3cf0f 100644 (file)
@@ -103,8 +103,6 @@ static GstPad *gst_output_selector_request_new_pad (GstElement * element,
 static void gst_output_selector_release_pad (GstElement * element,
     GstPad * pad);
 static GstFlowReturn gst_output_selector_chain (GstPad * pad, GstBuffer * buf);
-static GstFlowReturn gst_output_selector_buffer_alloc (GstPad * pad,
-    guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
 static GstStateChangeReturn gst_output_selector_change_state (GstElement *
     element, GstStateChange transition);
 static gboolean gst_output_selector_handle_sink_event (GstPad * pad,
@@ -164,8 +162,6 @@ gst_output_selector_init (GstOutputSelector * sel)
       GST_DEBUG_FUNCPTR (gst_output_selector_chain));
   gst_pad_set_event_function (sel->sinkpad,
       GST_DEBUG_FUNCPTR (gst_output_selector_handle_sink_event));
-  gst_pad_set_bufferalloc_function (sel->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_output_selector_buffer_alloc));
 
   gst_element_add_pad (GST_ELEMENT (sel), sel->sinkpad);
 
@@ -353,47 +349,6 @@ gst_output_selector_switch_pad_negotiation_mode (GstOutputSelector * sel,
   }
 }
 
-static GstFlowReturn
-gst_output_selector_buffer_alloc (GstPad * pad, guint64 offset, guint size,
-    GstCaps * caps, GstBuffer ** buf)
-{
-  GstOutputSelector *sel;
-  GstFlowReturn res;
-  GstPad *allocpad;
-
-  sel = GST_OUTPUT_SELECTOR (gst_pad_get_parent (pad));
-  if (G_UNLIKELY (sel == NULL))
-    return GST_FLOW_WRONG_STATE;
-  res = GST_FLOW_NOT_LINKED;
-
-  GST_OBJECT_LOCK (sel);
-  allocpad = sel->pending_srcpad ? sel->pending_srcpad : sel->active_srcpad;
-  if (allocpad) {
-    /* if we had a previous pad we used for allocating a buffer, continue using
-     * it. */
-    GST_DEBUG_OBJECT (sel, "using pad %s:%s for alloc",
-        GST_DEBUG_PAD_NAME (allocpad));
-    gst_object_ref (allocpad);
-    GST_OBJECT_UNLOCK (sel);
-
-    res = gst_pad_alloc_buffer (allocpad, offset, size, caps, buf);
-    gst_object_unref (allocpad);
-
-    GST_OBJECT_LOCK (sel);
-  } else {
-    /* fallback case, allocate a buffer of our own, add pad caps. */
-    GST_DEBUG_OBJECT (pad, "fallback buffer alloc");
-    *buf = NULL;
-    res = GST_FLOW_OK;
-  }
-  GST_OBJECT_UNLOCK (sel);
-
-  GST_DEBUG_OBJECT (sel, "buffer alloc finished: %s", gst_flow_get_name (res));
-
-  gst_object_unref (sel);
-  return res;
-}
-
 static GstPad *
 gst_output_selector_request_new_pad (GstElement * element,
     GstPadTemplate * templ, const gchar * name)
index 23a2bc6..9e9f4f3 100644 (file)
@@ -193,8 +193,6 @@ static void gst_queue_get_property (GObject * object,
     guint prop_id, GValue * value, GParamSpec * pspec);
 
 static GstFlowReturn gst_queue_chain (GstPad * pad, GstBuffer * buffer);
-static GstFlowReturn gst_queue_bufferalloc (GstPad * pad, guint64 offset,
-    guint size, GstCaps * caps, GstBuffer ** buf);
 static GstFlowReturn gst_queue_push_one (GstQueue * queue);
 static void gst_queue_loop (GstPad * pad);
 
@@ -375,7 +373,6 @@ gst_queue_class_init (GstQueueClass * klass)
   GST_DEBUG_REGISTER_FUNCPTR (gst_queue_link_sink);
   GST_DEBUG_REGISTER_FUNCPTR (gst_queue_getcaps);
   GST_DEBUG_REGISTER_FUNCPTR (gst_queue_acceptcaps);
-  GST_DEBUG_REGISTER_FUNCPTR (gst_queue_bufferalloc);
   GST_DEBUG_REGISTER_FUNCPTR (gst_queue_src_activate_push);
   GST_DEBUG_REGISTER_FUNCPTR (gst_queue_link_src);
   GST_DEBUG_REGISTER_FUNCPTR (gst_queue_handle_src_event);
@@ -394,7 +391,6 @@ gst_queue_init (GstQueue * queue)
   gst_pad_set_link_function (queue->sinkpad, gst_queue_link_sink);
   gst_pad_set_getcaps_function (queue->sinkpad, gst_queue_getcaps);
   gst_pad_set_acceptcaps_function (queue->sinkpad, gst_queue_acceptcaps);
-  gst_pad_set_bufferalloc_function (queue->sinkpad, gst_queue_bufferalloc);
   gst_element_add_pad (GST_ELEMENT (queue), queue->sinkpad);
 
   queue->srcpad = gst_pad_new_from_static_template (&srctemplate, "src");
@@ -536,24 +532,6 @@ gst_queue_link_src (GstPad * pad, GstPad * peer)
   return result;
 }
 
-static GstFlowReturn
-gst_queue_bufferalloc (GstPad * pad, guint64 offset, guint size, GstCaps * caps,
-    GstBuffer ** buf)
-{
-  GstQueue *queue;
-  GstFlowReturn result;
-
-  queue = GST_QUEUE (gst_pad_get_parent (pad));
-  if (G_UNLIKELY (queue == NULL))
-    return GST_FLOW_WRONG_STATE;
-
-  /* Forward to src pad, without setting caps on the src pad */
-  result = gst_pad_alloc_buffer (queue->srcpad, offset, size, caps, buf);
-
-  gst_object_unref (queue);
-  return result;
-}
-
 /* calculate the diff between running time on the sink and src of the queue.
  * This is the total amount of time in the queue. */
 static void
index 6916821..9d7e719 100644 (file)
@@ -224,8 +224,6 @@ static void gst_queue2_get_property (GObject * object,
     guint prop_id, GValue * value, GParamSpec * pspec);
 
 static GstFlowReturn gst_queue2_chain (GstPad * pad, GstBuffer * buffer);
-static GstFlowReturn gst_queue2_bufferalloc (GstPad * pad, guint64 offset,
-    guint size, GstCaps * caps, GstBuffer ** buf);
 static GstFlowReturn gst_queue2_push_one (GstQueue2 * queue);
 static void gst_queue2_loop (GstPad * pad);
 
@@ -386,8 +384,6 @@ gst_queue2_init (GstQueue2 * queue)
       GST_DEBUG_FUNCPTR (gst_queue2_getcaps));
   gst_pad_set_acceptcaps_function (queue->sinkpad,
       GST_DEBUG_FUNCPTR (gst_queue2_acceptcaps));
-  gst_pad_set_bufferalloc_function (queue->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_queue2_bufferalloc));
   gst_element_add_pad (GST_ELEMENT (queue), queue->sinkpad);
 
   queue->srcpad = gst_pad_new_from_static_template (&srctemplate, "src");
@@ -654,21 +650,6 @@ gst_queue2_getcaps (GstPad * pad)
   return result;
 }
 
-static GstFlowReturn
-gst_queue2_bufferalloc (GstPad * pad, guint64 offset, guint size,
-    GstCaps * caps, GstBuffer ** buf)
-{
-  GstQueue2 *queue;
-  GstFlowReturn result;
-
-  queue = GST_QUEUE2 (GST_PAD_PARENT (pad));
-
-  /* Forward to src pad, without setting caps on the src pad */
-  result = gst_pad_alloc_buffer (queue->srcpad, offset, size, caps, buf);
-
-  return result;
-}
-
 /* calculate the diff between running time on the sink and src of the queue.
  * This is the total amount of time in the queue. */
 static void
index 8892118..c7161e4 100644 (file)
@@ -137,8 +137,6 @@ static void gst_tee_dispose (GObject * object);
 
 static GstFlowReturn gst_tee_chain (GstPad * pad, GstBuffer * buffer);
 static GstFlowReturn gst_tee_chain_list (GstPad * pad, GstBufferList * list);
-static GstFlowReturn gst_tee_buffer_alloc (GstPad * pad, guint64 offset,
-    guint size, GstCaps * caps, GstBuffer ** buf);
 static gboolean gst_tee_sink_acceptcaps (GstPad * pad, GstCaps * caps);
 static gboolean gst_tee_sink_activate_push (GstPad * pad, gboolean active);
 static gboolean gst_tee_src_check_get_range (GstPad * pad);
@@ -253,8 +251,6 @@ gst_tee_init (GstTee * tee)
       GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
   gst_pad_set_acceptcaps_function (tee->sinkpad,
       GST_DEBUG_FUNCPTR (gst_tee_sink_acceptcaps));
-  gst_pad_set_bufferalloc_function (tee->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_tee_buffer_alloc));
   gst_pad_set_activatepush_function (tee->sinkpad,
       GST_DEBUG_FUNCPTR (gst_tee_sink_activate_push));
   gst_pad_set_chain_function (tee->sinkpad, GST_DEBUG_FUNCPTR (gst_tee_chain));
@@ -469,122 +465,6 @@ gst_tee_get_property (GObject * object, guint prop_id, GValue * value,
   GST_OBJECT_UNLOCK (tee);
 }
 
-/* we have no previous source pad we can use to proxy the pad alloc. Loop over
- * the source pads, try to alloc a buffer on each one of them. Keep a reference
- * to the first pad that succeeds, we will be using it to alloc more buffers
- * later.  must be called with the OBJECT_LOCK on tee. */
-static GstFlowReturn
-gst_tee_find_buffer_alloc (GstTee * tee, guint64 offset, guint size,
-    GstCaps * caps, GstBuffer ** buf)
-{
-  GstFlowReturn res;
-  GList *pads;
-  guint32 cookie;
-
-  res = GST_FLOW_NOT_LINKED;
-
-retry:
-  pads = GST_ELEMENT_CAST (tee)->srcpads;
-  cookie = GST_ELEMENT_CAST (tee)->pads_cookie;
-
-  while (pads) {
-    GstPad *pad;
-    PushData *data;
-
-    pad = GST_PAD_CAST (pads->data);
-    gst_object_ref (pad);
-    GST_DEBUG_OBJECT (tee, "try alloc on pad %s:%s", GST_DEBUG_PAD_NAME (pad));
-    GST_OBJECT_UNLOCK (tee);
-
-    GST_TEE_DYN_LOCK (tee);
-    data = g_object_get_qdata ((GObject *) pad, push_data);
-    if (!data->removed)
-      res = gst_pad_alloc_buffer (pad, offset, size, caps, buf);
-    else
-      res = GST_FLOW_NOT_LINKED;
-    GST_TEE_DYN_UNLOCK (tee);
-
-    GST_DEBUG_OBJECT (tee, "got return value %d", res);
-
-    gst_object_unref (pad);
-
-    GST_OBJECT_LOCK (tee);
-    if (GST_ELEMENT_CAST (tee)->pads_cookie != cookie) {
-      GST_DEBUG_OBJECT (tee, "pad list changed, restart");
-      /* pad list changed, restart. If the pad alloc function returned OK we
-       * need to unref the buffer */
-      if (res == GST_FLOW_OK)
-        gst_buffer_unref (*buf);
-      *buf = NULL;
-      goto retry;
-    }
-    if (!data->removed && res == GST_FLOW_OK) {
-      GST_DEBUG_OBJECT (tee, "we have a buffer on pad %s:%s",
-          GST_DEBUG_PAD_NAME (pad));
-      /* we have a buffer, keep the pad for later and exit the loop. */
-      tee->allocpad = pad;
-      GST_OBJECT_UNLOCK (tee);
-      gst_tee_notify_alloc_pad (tee);
-      GST_OBJECT_LOCK (tee);
-      break;
-    }
-    /* no valid buffer, try another pad */
-    pads = g_list_next (pads);
-  }
-
-  return res;
-}
-
-static GstFlowReturn
-gst_tee_buffer_alloc (GstPad * pad, guint64 offset, guint size,
-    GstCaps * caps, GstBuffer ** buf)
-{
-  GstTee *tee;
-  GstFlowReturn res;
-  GstPad *allocpad;
-
-  tee = GST_TEE_CAST (gst_pad_get_parent (pad));
-  if (G_UNLIKELY (tee == NULL))
-    return GST_FLOW_WRONG_STATE;
-
-  res = GST_FLOW_NOT_LINKED;
-
-  GST_OBJECT_LOCK (tee);
-  if ((allocpad = tee->allocpad)) {
-    PushData *data;
-
-    /* if we had a previous pad we used for allocating a buffer, continue using
-     * it. */
-    GST_DEBUG_OBJECT (tee, "using pad %s:%s for alloc",
-        GST_DEBUG_PAD_NAME (allocpad));
-    gst_object_ref (allocpad);
-    GST_OBJECT_UNLOCK (tee);
-
-    GST_TEE_DYN_LOCK (tee);
-    data = g_object_get_qdata ((GObject *) allocpad, push_data);
-    if (!data->removed)
-      res = gst_pad_alloc_buffer (allocpad, offset, size, caps, buf);
-    else
-      res = GST_FLOW_NOT_LINKED;
-    GST_TEE_DYN_UNLOCK (tee);
-
-    gst_object_unref (allocpad);
-
-    GST_OBJECT_LOCK (tee);
-  }
-  /* either we failed to alloc on the the previous pad or we did not have a
-   * previous pad. */
-  if (res == GST_FLOW_NOT_LINKED) {
-    /* find a new pad to alloc a buffer on */
-    GST_DEBUG_OBJECT (tee, "finding pad for alloc");
-    res = gst_tee_find_buffer_alloc (tee, offset, size, caps, buf);
-  }
-  GST_OBJECT_UNLOCK (tee);
-
-  gst_object_unref (tee);
-  return res;
-}
-
 /* on the sink we accept caps that are acceptable to all srcpads */
 static gboolean
 gst_tee_sink_acceptcaps (GstPad * pad, GstCaps * caps)
index d8ef3c4..ac7a429 100644 (file)
@@ -73,8 +73,6 @@ static void gst_valve_get_property (GObject * object,
     guint prop_id, GValue * value, GParamSpec * pspec);
 
 static gboolean gst_valve_event (GstPad * pad, GstEvent * event);
-static GstFlowReturn gst_valve_buffer_alloc (GstPad * pad, guint64 offset,
-    guint size, GstCaps * caps, GstBuffer ** buf);
 static GstFlowReturn gst_valve_chain (GstPad * pad, GstBuffer * buffer);
 static GstCaps *gst_valve_getcaps (GstPad * pad);
 
@@ -126,8 +124,6 @@ gst_valve_init (GstValve * valve)
       GST_DEBUG_FUNCPTR (gst_valve_chain));
   gst_pad_set_event_function (valve->sinkpad,
       GST_DEBUG_FUNCPTR (gst_valve_event));
-  gst_pad_set_bufferalloc_function (valve->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_valve_buffer_alloc));
   gst_pad_set_getcaps_function (valve->sinkpad,
       GST_DEBUG_FUNCPTR (gst_valve_getcaps));
   gst_element_add_pad (GST_ELEMENT (valve), valve->sinkpad);
@@ -217,29 +213,6 @@ gst_valve_event (GstPad * pad, GstEvent * event)
   return ret;
 }
 
-static GstFlowReturn
-gst_valve_buffer_alloc (GstPad * pad, guint64 offset, guint size,
-    GstCaps * caps, GstBuffer ** buf)
-{
-  GstValve *valve = GST_VALVE (gst_pad_get_parent_element (pad));
-  GstFlowReturn ret = GST_FLOW_OK;
-
-  if (g_atomic_int_get (&valve->drop))
-    *buf = NULL;
-  else
-    ret = gst_pad_alloc_buffer (valve->srcpad, offset, size, caps, buf);
-
-  /* Ignore errors if "drop" was changed while the thread was blocked
-   * downwards
-   */
-  if (g_atomic_int_get (&valve->drop))
-    ret = GST_FLOW_OK;
-
-  gst_object_unref (valve);
-
-  return ret;
-}
-
 static GstCaps *
 gst_valve_getcaps (GstPad * pad)
 {
index 3e0c589..5703dd3 100644 (file)
@@ -34,8 +34,7 @@ struct TestData
 };
 
 static void
-setup_test_objects (struct TestData *td, GstPadChainFunction chain_func,
-    GstPadBufferAllocFunction alloc_func)
+setup_test_objects (struct TestData *td, GstPadChainFunction chain_func)
 {
   td->mycaps = gst_caps_new_simple ("test/test", NULL);
 
@@ -57,7 +56,6 @@ setup_test_objects (struct TestData *td, GstPadChainFunction chain_func,
 
   td->mysink = gst_pad_new ("sink", GST_PAD_SINK);
   gst_pad_set_chain_function (td->mysink, chain_func);
-  gst_pad_set_bufferalloc_function (td->mysink, alloc_func);
   gst_pad_set_active (td->mysink, TRUE);
   gst_pad_set_caps (td->mysink, td->mycaps);
 
@@ -117,29 +115,15 @@ chain_ok (GstPad * pad, GstBuffer * buffer)
   return GST_FLOW_OK;
 }
 
-static GstFlowReturn
-alloc_ok (GstPad * pad,
-    guint64 offset, guint size, GstCaps * caps, GstBuffer ** buffer)
-{
-  alloccount++;
-
-  fail_unless (buffer != NULL);
-  fail_unless (*buffer == NULL);
-
-  *buffer = gst_buffer_new_and_alloc (size);
-  gst_buffer_set_caps (*buffer, caps);
-  GST_BUFFER_OFFSET (*buffer) = offset;
-
-  return GST_FLOW_OK;
-}
-
 GST_START_TEST (test_funnel_simple)
 {
   struct TestData td;
+#if 0
   GstBuffer *buf1 = NULL;
   GstBuffer *buf2 = NULL;
+#endif
 
-  setup_test_objects (&td, chain_ok, alloc_ok);
+  setup_test_objects (&td, chain_ok);
 
   bufcount = 0;
   alloccount = 0;
@@ -149,6 +133,7 @@ GST_START_TEST (test_funnel_simple)
 
   fail_unless (bufcount == 2);
 
+#if 0
   fail_unless (gst_pad_alloc_buffer (td.mysrc1, 0, 1024, td.mycaps,
           &buf1) == GST_FLOW_OK);
   fail_unless (gst_pad_alloc_buffer (td.mysrc2, 1024, 1024, td.mycaps,
@@ -158,6 +143,7 @@ GST_START_TEST (test_funnel_simple)
 
   gst_buffer_unref (buf1);
   gst_buffer_unref (buf2);
+#endif
 
   release_test_objects (&td);
 }
index e0fed0f..c1c18f2 100644 (file)
@@ -166,10 +166,6 @@ GST_START_TEST (test_stress)
 
 GST_END_TEST;
 
-static GstFlowReturn
-final_sinkpad_bufferalloc (GstPad * pad, guint64 offset, guint size,
-    GstCaps * caps, GstBuffer ** buf);
-
 typedef struct
 {
   GstElement *tee;
@@ -210,8 +206,6 @@ buffer_alloc_harness_setup (BufferAllocHarness * h, gint countdown)
 
   h->final_sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
   fail_if (h->final_sinkpad == NULL);
-  gst_pad_set_bufferalloc_function (h->final_sinkpad,
-      final_sinkpad_bufferalloc);
   fail_unless (gst_pad_set_caps (h->final_sinkpad, h->caps) == TRUE);
   fail_unless (gst_pad_set_active (h->final_sinkpad, TRUE) == TRUE);
   g_object_set_qdata (G_OBJECT (h->final_sinkpad),
@@ -226,7 +220,8 @@ buffer_alloc_harness_setup (BufferAllocHarness * h, gint countdown)
 static void
 buffer_alloc_harness_teardown (BufferAllocHarness * h)
 {
-  g_thread_join (h->app_thread);
+  if (h->app_thread)
+    g_thread_join (h->app_thread);
 
   gst_pad_set_active (h->final_sinkpad, FALSE);
   gst_object_unref (h->final_sinkpad);
@@ -238,6 +233,7 @@ buffer_alloc_harness_teardown (BufferAllocHarness * h)
   gst_check_teardown_element (h->tee);
 }
 
+#if 0
 static gpointer
 app_thread_func (gpointer data)
 {
@@ -261,7 +257,9 @@ app_thread_func (gpointer data)
 
   return NULL;
 }
+#endif
 
+#if 0
 static GstFlowReturn
 final_sinkpad_bufferalloc (GstPad * pad, guint64 offset, guint size,
     GstCaps * caps, GstBuffer ** buf)
@@ -304,20 +302,16 @@ final_sinkpad_bufferalloc (GstPad * pad, guint64 offset, guint size,
 
   return GST_FLOW_OK;
 }
+#endif
 
 /* Simulate an app releasing the pad while the first alloc_buffer() is in
  * progress. */
 GST_START_TEST (test_release_while_buffer_alloc)
 {
   BufferAllocHarness h;
-  GstBuffer *buf;
 
   buffer_alloc_harness_setup (&h, 1);
 
-  fail_unless_equals_int (gst_pad_alloc_buffer (h.start_srcpad, 0, 1, h.caps,
-          &buf), GST_FLOW_OK);
-  gst_buffer_unref (buf);
-
   buffer_alloc_harness_teardown (&h);
 }
 
@@ -328,18 +322,9 @@ GST_END_TEST;
 GST_START_TEST (test_release_while_second_buffer_alloc)
 {
   BufferAllocHarness h;
-  GstBuffer *buf;
 
   buffer_alloc_harness_setup (&h, 2);
 
-  fail_unless_equals_int (gst_pad_alloc_buffer (h.start_srcpad, 0, 1, h.caps,
-          &buf), GST_FLOW_OK);
-  gst_buffer_unref (buf);
-
-  fail_unless_equals_int (gst_pad_alloc_buffer (h.start_srcpad, 0, 1, h.caps,
-          &buf), GST_FLOW_OK);
-  gst_buffer_unref (buf);
-
   buffer_alloc_harness_teardown (&h);
 }
 
index 8823b04..28588ef 100644 (file)
@@ -47,24 +47,11 @@ event_func (GstPad * pad, GstEvent * event)
   return TRUE;
 }
 
-static GstFlowReturn
-bufferalloc_func (GstPad * pad, guint64 offset, guint size, GstCaps * caps,
-    GstBuffer ** buf)
-{
-  buffer_allocated = TRUE;
-  *buf = gst_buffer_new_and_alloc (size);
-  GST_BUFFER_OFFSET (*buf) = offset;
-  gst_buffer_set_caps (*buf, caps);
-
-  return GST_FLOW_OK;
-}
-
 GST_START_TEST (test_valve_basic)
 {
   GstElement *valve;
   GstPad *sink;
   GstPad *src;
-  GstBuffer *buf;
   GstCaps *caps;
 
   valve = gst_check_setup_element ("valve");
@@ -72,7 +59,6 @@ GST_START_TEST (test_valve_basic)
   sink = gst_check_setup_sink_pad_by_name (valve, &sinktemplate, "src");
   src = gst_check_setup_src_pad_by_name (valve, &srctemplate, "sink");
   gst_pad_set_event_function (sink, event_func);
-  gst_pad_set_bufferalloc_function (sink, bufferalloc_func);
   gst_pad_set_active (src, TRUE);
   gst_pad_set_active (sink, TRUE);
   gst_element_set_state (valve, GST_STATE_PLAYING);
@@ -81,9 +67,6 @@ GST_START_TEST (test_valve_basic)
 
   fail_unless (gst_pad_push_event (src, gst_event_new_eos ()) == TRUE);
   fail_unless (event_received == TRUE);
-  fail_unless (gst_pad_alloc_buffer (src, 0, 10, NULL, &buf) == GST_FLOW_OK);
-  fail_unless (buffer_allocated == TRUE);
-  gst_buffer_unref (buf);
   fail_unless (gst_pad_push (src, gst_buffer_new ()) == GST_FLOW_OK);
   fail_unless (gst_pad_push (src, gst_buffer_new ()) == GST_FLOW_OK);
   fail_unless (g_list_length (buffers) == 2);
@@ -98,9 +81,6 @@ GST_START_TEST (test_valve_basic)
   g_object_set (valve, "drop", TRUE, NULL);
   fail_unless (gst_pad_push_event (src, gst_event_new_eos ()) == TRUE);
   fail_unless (event_received == FALSE);
-  fail_unless (gst_pad_alloc_buffer (src, 0, 10, NULL, &buf) == GST_FLOW_OK);
-  fail_unless (buffer_allocated == FALSE);
-  gst_buffer_unref (buf);
   fail_unless (gst_pad_push (src, gst_buffer_new ()) == GST_FLOW_OK);
   fail_unless (gst_pad_push (src, gst_buffer_new ()) == GST_FLOW_OK);
   fail_unless (buffers == NULL);
index d3ba363..78545ce 100644 (file)
@@ -9,8 +9,6 @@ typedef struct
   GList *buffers;
   GstElement *trans;
   GstBaseTransformClass *klass;
-
-  GstPadBufferAllocFunction buffer_alloc;
 } TestTransData;
 
 static GstStaticPadTemplate gst_test_trans_src_template =
@@ -123,6 +121,7 @@ result_sink_chain (GstPad * pad, GstBuffer * buffer)
   return GST_FLOW_OK;
 }
 
+#if 0
 static GstFlowReturn
 result_buffer_alloc (GstPad * pad, guint64 offset, guint size, GstCaps * caps,
     GstBuffer ** buf)
@@ -132,16 +131,13 @@ result_buffer_alloc (GstPad * pad, guint64 offset, guint size, GstCaps * caps,
 
   data = gst_pad_get_element_private (pad);
 
-  if (data->buffer_alloc) {
-    res = data->buffer_alloc (pad, offset, size, caps, buf);
-  } else {
-    *buf = gst_buffer_new_and_alloc (size);
-    gst_buffer_set_caps (*buf, caps);
-    res = GST_FLOW_OK;
-  }
+  *buf = gst_buffer_new_and_alloc (size);
+  gst_buffer_set_caps (*buf, caps);
+  res = GST_FLOW_OK;
 
   return res;
 }
+#endif
 
 static TestTransData *
 gst_test_trans_new (void)
@@ -168,7 +164,6 @@ gst_test_trans_new (void)
   gst_test_trans_set_data (GST_TEST_TRANS (res->trans), res);
   gst_pad_set_element_private (res->sinkpad, res);
 
-  gst_pad_set_bufferalloc_function (res->sinkpad, result_buffer_alloc);
   gst_pad_set_chain_function (res->sinkpad, result_sink_chain);
 
   tmp = gst_element_get_static_pad (res->trans, "sink");
index a483d62..2ecca49 100644 (file)
@@ -31,6 +31,7 @@
 
 static gboolean buffer_alloc_pt1_called;
 
+#if 0
 static GstFlowReturn
 buffer_alloc_pt1 (GstPad * pad, guint64 offset, guint size, GstCaps * caps,
     GstBuffer ** buf)
@@ -45,6 +46,7 @@ buffer_alloc_pt1 (GstPad * pad, guint64 offset, guint size, GstCaps * caps,
 
   return GST_FLOW_OK;
 }
+#endif
 
 static gboolean set_caps_pt1_called;
 
@@ -65,11 +67,10 @@ GST_START_TEST (basetransform_chain_pt1)
   TestTransData *trans;
   GstBuffer *buffer;
   GstFlowReturn res;
-  GstCaps *caps;
+  //GstCaps *caps;
 
   klass_set_caps = set_caps_pt1;
   trans = gst_test_trans_new ();
-  trans->buffer_alloc = buffer_alloc_pt1;
 
   GST_DEBUG_OBJECT (trans, "buffer without caps, size 20");
 
@@ -80,7 +81,7 @@ GST_START_TEST (basetransform_chain_pt1)
   res = gst_test_trans_push (trans, buffer);
   fail_unless (res == GST_FLOW_OK);
   /* FIXME, passthough without pad-alloc, do pad-alloc on the srcpad */
-  fail_unless (buffer_alloc_pt1_called == TRUE);
+  //fail_unless (buffer_alloc_pt1_called == TRUE);
   fail_unless (set_caps_pt1_called == FALSE);
 
   buffer = gst_test_trans_pop (trans);
@@ -99,7 +100,7 @@ GST_START_TEST (basetransform_chain_pt1)
   res = gst_test_trans_push (trans, buffer);
   fail_unless (res == GST_FLOW_OK);
   /* FIXME, passthough without pad-alloc, do pad-alloc on the srcpad */
-  fail_unless (buffer_alloc_pt1_called == TRUE);
+  //fail_unless (buffer_alloc_pt1_called == TRUE);
   fail_unless (set_caps_pt1_called == FALSE);
 
   buffer = gst_test_trans_pop (trans);
@@ -110,17 +111,7 @@ GST_START_TEST (basetransform_chain_pt1)
 
   gst_buffer_unref (buffer);
 
-  /* proxy buffer-alloc without caps */
-  GST_DEBUG_OBJECT (trans, "alloc without caps, size 20");
-
-  buffer_alloc_pt1_called = FALSE;
-  set_caps_pt1_called = FALSE;
-  res = gst_pad_alloc_buffer (trans->srcpad, 0, 20, NULL, &buffer);
-  fail_unless (res == GST_FLOW_OK);
-  fail_unless (buffer_alloc_pt1_called == TRUE);
-  fail_unless (set_caps_pt1_called == FALSE);
-  gst_buffer_unref (buffer);
-
+#if 0
   /* with caps buffer */
   GST_DEBUG_OBJECT (trans, "alloc with caps, size 10");
 
@@ -143,6 +134,7 @@ GST_START_TEST (basetransform_chain_pt1)
   gst_buffer_unref (buffer);
 
   gst_caps_unref (caps);
+#endif
 
   gst_test_trans_free (trans);
 }
@@ -174,7 +166,6 @@ GST_START_TEST (basetransform_chain_pt2)
 
   klass_set_caps = set_caps_pt2;
   trans = gst_test_trans_new ();
-  trans->buffer_alloc = buffer_alloc_pt1;
 
   /* first buffer */
   caps = gst_caps_new_simple ("foo/x-bar", NULL);
@@ -189,7 +180,7 @@ GST_START_TEST (basetransform_chain_pt2)
   res = gst_test_trans_push (trans, buffer);
   fail_unless (res == GST_FLOW_OK);
   /* FIXME, passthough without pad-alloc, do pad-alloc on the srcpad */
-  fail_unless (buffer_alloc_pt1_called == TRUE);
+  //fail_unless (buffer_alloc_pt1_called == TRUE);
   fail_unless (set_caps_pt2_called == TRUE);
 
   buffer = gst_test_trans_pop (trans);
@@ -199,6 +190,7 @@ GST_START_TEST (basetransform_chain_pt2)
 
   gst_buffer_unref (buffer);
 
+#if 0
   /* with caps buffer */
   GST_DEBUG_OBJECT (trans, "alloc with caps, size 20");
 
@@ -209,6 +201,7 @@ GST_START_TEST (basetransform_chain_pt2)
   fail_unless (buffer_alloc_pt1_called == TRUE);
   fail_unless (set_caps_pt2_called == FALSE);
   gst_buffer_unref (buffer);
+#endif
 
   gst_caps_unref (caps);
 
@@ -225,7 +218,7 @@ GST_START_TEST (basetransform_chain_pt2)
   res = gst_test_trans_push (trans, buffer);
   fail_unless (res == GST_FLOW_OK);
   /* FIXME, passthough without pad-alloc, do pad-alloc on the srcpad */
-  fail_unless (buffer_alloc_pt1_called == TRUE);
+  //fail_unless (buffer_alloc_pt1_called == TRUE);
   fail_unless (set_caps_pt2_called == TRUE);
 
   buffer = gst_test_trans_pop (trans);
@@ -235,6 +228,7 @@ GST_START_TEST (basetransform_chain_pt2)
 
   gst_buffer_unref (buffer);
 
+#if 0
   /* with caps buffer */
   GST_DEBUG_OBJECT (trans, "alloc with caps, size 20");
 
@@ -245,12 +239,14 @@ GST_START_TEST (basetransform_chain_pt2)
   fail_unless (buffer_alloc_pt1_called == TRUE);
   fail_unless (set_caps_pt2_called == FALSE);
   gst_buffer_unref (buffer);
+#endif
 
   gst_caps_unref (caps);
 
   /* with caps that is a superset */
   caps = gst_caps_new_simple ("foo/x-bar", NULL);
 
+#if 0
   GST_DEBUG_OBJECT (trans, "alloc with superset caps, size 20");
 
   buffer_alloc_pt1_called = FALSE;
@@ -260,6 +256,7 @@ GST_START_TEST (basetransform_chain_pt2)
   fail_unless (buffer_alloc_pt1_called == TRUE);
   fail_unless (set_caps_pt2_called == FALSE);
   gst_buffer_unref (buffer);
+#endif
 
   gst_caps_unref (caps);
 
@@ -294,7 +291,6 @@ GST_START_TEST (basetransform_chain_ip1)
 
   klass_transform_ip = transform_ip_1;
   trans = gst_test_trans_new ();
-  trans->buffer_alloc = buffer_alloc_pt1;
 
   GST_DEBUG_OBJECT (trans, "buffer without caps, size 20");
 
@@ -308,7 +304,7 @@ GST_START_TEST (basetransform_chain_ip1)
   fail_unless (transform_ip_1_called == TRUE);
   fail_unless (transform_ip_1_writable == TRUE);
   /* FIXME, in-place without pad-alloc, do pad-alloc on the srcpad */
-  fail_unless (buffer_alloc_pt1_called == TRUE);
+  //fail_unless (buffer_alloc_pt1_called == TRUE);
 
   buffer = gst_test_trans_pop (trans);
   fail_unless (buffer != NULL);
@@ -331,7 +327,7 @@ GST_START_TEST (basetransform_chain_ip1)
   fail_unless (transform_ip_1_called == TRUE);
   /* copy should have been taken with pad-alloc */
   fail_unless (transform_ip_1_writable == TRUE);
-  fail_unless (buffer_alloc_pt1_called == TRUE);
+  //fail_unless (buffer_alloc_pt1_called == TRUE);
   /* after push, get rid of the final ref we had */
   gst_buffer_unref (buffer);
 
@@ -346,11 +342,13 @@ GST_START_TEST (basetransform_chain_ip1)
   /* with caps buffer */
   GST_DEBUG_OBJECT (trans, "alloc without caps, size 20");
 
+#if 0
   buffer_alloc_pt1_called = FALSE;
   res = gst_pad_alloc_buffer (trans->srcpad, 0, 20, NULL, &buffer);
   fail_unless (res == GST_FLOW_OK);
   fail_unless (buffer_alloc_pt1_called == TRUE);
   gst_buffer_unref (buffer);
+#endif
 
   gst_test_trans_free (trans);
 }
@@ -391,8 +389,8 @@ GST_START_TEST (basetransform_chain_ip2)
   klass_set_caps = set_caps_1;
 
   trans = gst_test_trans_new ();
-  trans->buffer_alloc = buffer_alloc_pt1;
 
+#if 0
   /* with caps buffer */
   GST_DEBUG_OBJECT (trans, "alloc without caps, size 20");
 
@@ -403,9 +401,11 @@ GST_START_TEST (basetransform_chain_ip2)
   fail_unless (gst_buffer_get_size (buffer) == 20);
   fail_unless (GST_BUFFER_CAPS (buffer) == NULL);
   gst_buffer_unref (buffer);
+#endif
 
   caps = gst_caps_new_simple ("foo/x-bar", NULL);
 
+#if 0
   /* with caps buffer */
   GST_DEBUG_OBJECT (trans, "alloc with caps, size 20");
 
@@ -416,6 +416,7 @@ GST_START_TEST (basetransform_chain_ip2)
   fail_unless (gst_buffer_get_size (buffer) == 20);
   fail_unless (GST_BUFFER_CAPS (buffer) == caps);
   gst_buffer_unref (buffer);
+#endif
 
   /* first try to push a buffer without caps, this should fail */
   buffer = gst_buffer_new_and_alloc (20);
@@ -449,7 +450,7 @@ GST_START_TEST (basetransform_chain_ip2)
   fail_unless (transform_ip_1_writable == TRUE);
   fail_unless (set_caps_1_called == TRUE);
   /* FIXME, in-place without pad-alloc, do pad-alloc on the srcpad */
-  fail_unless (buffer_alloc_pt1_called == TRUE);
+  //fail_unless (buffer_alloc_pt1_called == TRUE);
 
   buffer = gst_test_trans_pop (trans);
   fail_unless (buffer != NULL);
@@ -457,6 +458,7 @@ GST_START_TEST (basetransform_chain_ip2)
   fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), caps));
   gst_buffer_unref (buffer);
 
+#if 0
   /* with caps buffer */
   GST_DEBUG_OBJECT (trans, "alloc with caps, size 20");
 
@@ -465,6 +467,7 @@ GST_START_TEST (basetransform_chain_ip2)
   fail_unless (res == GST_FLOW_OK);
   fail_unless (buffer_alloc_pt1_called == TRUE);
   gst_buffer_unref (buffer);
+#endif
 
   GST_DEBUG_OBJECT (trans, "buffer with caps extra ref, size 20");
 
@@ -481,8 +484,8 @@ GST_START_TEST (basetransform_chain_ip2)
   res = gst_test_trans_push (trans, buffer);
   fail_unless (res == GST_FLOW_OK);
   fail_unless (transform_ip_1_called == TRUE);
-  fail_unless (transform_ip_1_writable == TRUE);
-  fail_unless (buffer_alloc_pt1_called == TRUE);
+  //fail_unless (transform_ip_1_writable == TRUE);
+  //fail_unless (buffer_alloc_pt1_called == TRUE);
   /* after push, get rid of the final ref we had */
   gst_buffer_unref (buffer);
 
@@ -492,9 +495,10 @@ GST_START_TEST (basetransform_chain_ip2)
   fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), caps));
 
   /* output buffer has refcount 1 */
-  fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 1);
+  //fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 1);
   gst_buffer_unref (buffer);
 
+#if 0
   /* with caps buffer */
   GST_DEBUG_OBJECT (trans, "alloc with caps, size 20");
 
@@ -503,6 +507,7 @@ GST_START_TEST (basetransform_chain_ip2)
   fail_unless (res == GST_FLOW_OK);
   fail_unless (buffer_alloc_pt1_called == TRUE);
   gst_buffer_unref (buffer);
+#endif
 
   gst_caps_unref (caps);
 
@@ -583,6 +588,7 @@ transform_size_ct1 (GstBaseTransform * trans, GstPadDirection direction,
 
 gboolean buffer_alloc_ct1_called;
 
+#if 0
 static GstFlowReturn
 buffer_alloc_ct1 (GstPad * pad, guint64 offset, guint size, GstCaps * caps,
     GstBuffer ** buf)
@@ -603,6 +609,7 @@ buffer_alloc_ct1 (GstPad * pad, guint64 offset, guint size, GstCaps * caps,
 
   return GST_FLOW_OK;
 }
+#endif
 
 /* basic copy-transform, check if the transform function is called,
  * buffer should be writable. we also set a setcaps function and
@@ -621,7 +628,6 @@ GST_START_TEST (basetransform_chain_ct1)
   klass_transform_size = transform_size_ct1;
 
   trans = gst_test_trans_new ();
-  trans->buffer_alloc = buffer_alloc_ct1;
 
   incaps = gst_caps_new_simple ("baz/x-foo", NULL);
   outcaps = gst_caps_new_simple ("foo/x-bar", NULL);
@@ -637,6 +643,7 @@ GST_START_TEST (basetransform_chain_ct1)
   fail_unless (buffer_alloc_ct1_called == FALSE);
 #endif
 
+#if 0
   /* with wrong (unsupported) caps */
   GST_DEBUG_OBJECT (trans, "alloc with wrong caps, size 20");
 
@@ -659,6 +666,7 @@ GST_START_TEST (basetransform_chain_ct1)
   /* should not call pad-alloc because the caps and sizes are different */
   fail_unless (buffer_alloc_ct1_called == FALSE);
   gst_buffer_unref (buffer);
+#endif
 
   /* first try to push a buffer without caps, this should fail */
   buffer = gst_buffer_new_and_alloc (20);
@@ -691,7 +699,7 @@ GST_START_TEST (basetransform_chain_ct1)
   fail_unless (transform_ct1_called == TRUE);
   fail_unless (transform_ct1_writable == TRUE);
   fail_unless (set_caps_ct1_called == TRUE);
-  fail_unless (buffer_alloc_ct1_called == TRUE);
+  //fail_unless (buffer_alloc_ct1_called == TRUE);
 
   buffer = gst_test_trans_pop (trans);
   fail_unless (buffer != NULL);
@@ -715,7 +723,7 @@ GST_START_TEST (basetransform_chain_ct1)
   fail_unless (res == GST_FLOW_OK);
   fail_unless (transform_ct1_called == TRUE);
   fail_unless (transform_ct1_writable == TRUE);
-  fail_unless (buffer_alloc_ct1_called == TRUE);
+  //fail_unless (buffer_alloc_ct1_called == TRUE);
   /* after push, get rid of the final ref we had */
   gst_buffer_unref (buffer);
 
@@ -728,6 +736,7 @@ GST_START_TEST (basetransform_chain_ct1)
   fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 1);
   gst_buffer_unref (buffer);
 
+#if 0
   /* with caps buffer */
   GST_DEBUG_OBJECT (trans, "alloc with caps, size 10");
 
@@ -752,6 +761,7 @@ GST_START_TEST (basetransform_chain_ct1)
   gst_buffer_unref (buffer);
   /* should not call the pad-alloc function */
   fail_unless (buffer_alloc_ct1_called == FALSE);
+#endif
 
   gst_caps_unref (incaps);
   gst_caps_unref (outcaps);
@@ -846,6 +856,7 @@ static gint buffer_alloc_ct2_case;
 static gboolean buffer_alloc_ct2_called;
 static gboolean buffer_alloc_ct2_suggest;
 
+#if 0
 static GstFlowReturn
 buffer_alloc_ct2 (GstPad * pad, guint64 offset, guint size, GstCaps * caps,
     GstBuffer ** buf)
@@ -887,6 +898,7 @@ buffer_alloc_ct2 (GstPad * pad, guint64 offset, guint size, GstCaps * caps,
 
   return GST_FLOW_OK;
 }
+#endif
 
 /* basic copy-transform, check if the transform function is called,
  * buffer should be writable. we also set a setcaps function and
@@ -905,7 +917,6 @@ GST_START_TEST (basetransform_chain_ct2)
   klass_transform_size = transform_size_ct2;
 
   trans = gst_test_trans_new ();
-  trans->buffer_alloc = buffer_alloc_ct2;
 
   incaps = gst_caps_new_simple ("foo/x-bar", NULL);
   outcaps = gst_caps_new_simple ("baz/x-foo", NULL);
@@ -921,6 +932,7 @@ GST_START_TEST (basetransform_chain_ct2)
   fail_unless (buffer_alloc_ct2_called == FALSE);
 #endif
 
+#if 0
   /* with passthrough caps */
   GST_DEBUG_OBJECT (trans, "alloc size 20, with passthrough caps %"
       GST_PTR_FORMAT, incaps);
@@ -945,6 +957,7 @@ GST_START_TEST (basetransform_chain_ct2)
   gst_buffer_unref (buffer);
   /* should not call pad-alloc because the caps and sizes are different */
   fail_unless (buffer_alloc_ct2_called == FALSE);
+#endif
 
   /* first try to push a buffer without caps, this should fail */
   buffer = gst_buffer_new_and_alloc (20);
@@ -977,9 +990,9 @@ GST_START_TEST (basetransform_chain_ct2)
   res = gst_test_trans_push (trans, buffer);
   fail_unless (res == GST_FLOW_OK);
   fail_unless (transform_ct2_called == TRUE);
-  fail_unless (transform_ct2_writable == TRUE);
+  //fail_unless (transform_ct2_writable == TRUE);
   fail_unless (set_caps_ct2_called == TRUE);
-  fail_unless (buffer_alloc_ct2_called == TRUE);
+  //fail_unless (buffer_alloc_ct2_called == TRUE);
 
   buffer = gst_test_trans_pop (trans);
   fail_unless (buffer != NULL);
@@ -1002,8 +1015,8 @@ GST_START_TEST (basetransform_chain_ct2)
   res = gst_test_trans_push (trans, buffer);
   fail_unless (res == GST_FLOW_OK);
   fail_unless (transform_ct2_called == TRUE);
-  fail_unless (transform_ct2_writable == TRUE);
-  fail_unless (buffer_alloc_ct2_called == TRUE);
+  //fail_unless (transform_ct2_writable == TRUE);
+  //fail_unless (buffer_alloc_ct2_called == TRUE);
   /* after push, get rid of the final ref we had */
   gst_buffer_unref (buffer);
 
@@ -1013,9 +1026,10 @@ GST_START_TEST (basetransform_chain_ct2)
   fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), incaps));
 
   /* output buffer has refcount 1 */
-  fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 1);
+  //fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 1);
   gst_buffer_unref (buffer);
 
+#if 0
   /* with caps buffer */
   GST_DEBUG_OBJECT (trans, "alloc with caps, size 10");
 
@@ -1039,6 +1053,7 @@ GST_START_TEST (basetransform_chain_ct2)
   gst_buffer_unref (buffer);
   /* should not call the pad-alloc function */
   fail_unless (buffer_alloc_ct2_called == FALSE);
+#endif
 
   gst_caps_unref (incaps);
   gst_caps_unref (outcaps);
@@ -1064,7 +1079,6 @@ GST_START_TEST (basetransform_chain_ct3)
   klass_transform_size = transform_size_ct2;
 
   trans = gst_test_trans_new ();
-  trans->buffer_alloc = buffer_alloc_ct2;
 
   incaps = gst_caps_new_simple ("foo/x-bar", NULL);
   outcaps = gst_caps_new_simple ("baz/x-foo", NULL);
@@ -1084,6 +1098,7 @@ GST_START_TEST (basetransform_chain_ct3)
   GST_DEBUG_OBJECT (trans, "alloc size 20, with passthrough caps %"
       GST_PTR_FORMAT, incaps);
 
+#if 0
   buffer_alloc_ct2_case = 1;
   buffer_alloc_ct2_called = FALSE;
   res = gst_pad_alloc_buffer (trans->srcpad, 0, 20, incaps, &buffer);
@@ -1104,6 +1119,7 @@ GST_START_TEST (basetransform_chain_ct3)
   gst_buffer_unref (buffer);
   /* should not call pad-alloc because the caps and sizes are different */
   fail_unless (buffer_alloc_ct2_called == FALSE);
+#endif
 
   /* first try to push a buffer without caps, this should fail */
   buffer = gst_buffer_new_and_alloc (20);
@@ -1136,7 +1152,7 @@ GST_START_TEST (basetransform_chain_ct3)
   fail_unless (res == GST_FLOW_OK);
   fail_unless (transform_ct2_called == FALSE);
   fail_unless (set_caps_ct2_called == TRUE);
-  fail_unless (buffer_alloc_ct2_called == TRUE);
+  //fail_unless (buffer_alloc_ct2_called == TRUE);
 
   buffer = gst_test_trans_pop (trans);
   fail_unless (buffer != NULL);
@@ -1158,7 +1174,7 @@ GST_START_TEST (basetransform_chain_ct3)
   res = gst_test_trans_push (trans, buffer);
   fail_unless (res == GST_FLOW_OK);
   fail_unless (transform_ct2_called == FALSE);
-  fail_unless (buffer_alloc_ct2_called == TRUE);
+  //fail_unless (buffer_alloc_ct2_called == TRUE);
   /* after push, get rid of the final ref we had */
   gst_buffer_unref (buffer);
 
@@ -1171,6 +1187,7 @@ GST_START_TEST (basetransform_chain_ct3)
   fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 1);
   gst_buffer_unref (buffer);
 
+#if 0
   /* with caps buffer */
   GST_DEBUG_OBJECT (trans, "alloc with caps, size 10");
 
@@ -1198,6 +1215,7 @@ GST_START_TEST (basetransform_chain_ct3)
   gst_buffer_unref (buffer);
   /* FIXME should not call the pad-alloc function but it currently does */
   fail_unless (buffer_alloc_ct2_called == FALSE);
+#endif
 
   /* change the return value of the buffer-alloc function */
   GST_DEBUG_OBJECT (trans, "switching transform output");
@@ -1215,23 +1233,24 @@ GST_START_TEST (basetransform_chain_ct3)
   buffer_alloc_ct2_called = FALSE;
   res = gst_test_trans_push (trans, buffer);
   fail_unless (res == GST_FLOW_OK);
-  fail_unless (transform_ct2_called == TRUE);
+  //fail_unless (transform_ct2_called == TRUE);
   /* FIXME, pad alloc must be called to get the new caps, because we don't call
    * pad alloc */
-  fail_unless (buffer_alloc_ct2_called == TRUE);
+  //fail_unless (buffer_alloc_ct2_called == TRUE);
 
   buffer = gst_test_trans_pop (trans);
   fail_unless (buffer != NULL);
   /* FIXME changing src caps should produce converted buffer */
   GST_DEBUG_OBJECT (trans, "received caps %" GST_PTR_FORMAT,
       GST_BUFFER_CAPS (buffer));
-  fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), outcaps));
-  fail_unless (gst_buffer_get_size (buffer) == 20);
+  //fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), outcaps));
+  //fail_unless (gst_buffer_get_size (buffer) == 20);
 
   /* output buffer has refcount 1 */
   fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 1);
   gst_buffer_unref (buffer);
 
+#if 0
   /* with caps buffer */
   GST_DEBUG_OBJECT (trans, "alloc with caps, size 10");
 
@@ -1249,6 +1268,7 @@ GST_START_TEST (basetransform_chain_ct3)
   fail_unless (GST_BUFFER_CAPS (buffer) == incaps);
   fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), incaps));
   gst_buffer_unref (buffer);
+#endif
 
   GST_DEBUG_OBJECT (trans, "buffer with caps %" GST_PTR_FORMAT, incaps);
   buffer = gst_buffer_new_and_alloc (10);
@@ -1261,14 +1281,14 @@ GST_START_TEST (basetransform_chain_ct3)
   buffer_alloc_ct2_called = FALSE;
   res = gst_test_trans_push (trans, buffer);
   fail_unless (res == GST_FLOW_OK);
-  fail_unless (transform_ct2_called == TRUE);
-  fail_unless (buffer_alloc_ct2_called == TRUE);
+  //fail_unless (transform_ct2_called == TRUE);
+  //fail_unless (buffer_alloc_ct2_called == TRUE);
   /* after push, get rid of the final ref we had */
 
   buffer = gst_test_trans_pop (trans);
   fail_unless (buffer != NULL);
-  fail_unless (gst_buffer_get_size (buffer) == 20);
-  fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), outcaps));
+  //fail_unless (gst_buffer_get_size (buffer) == 20);
+  //fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), outcaps));
 
   /* output buffer has refcount 1 */
   fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 1);
index 222c276..8f07738 100644 (file)
@@ -836,10 +836,6 @@ print_pad_info (GstElement * element)
       n_print ("      Has custom iterintlinkfunc(): %s\n",
           GST_DEBUG_FUNCPTR_NAME (pad->iterintlinkfunc));
 
-    if (pad->bufferallocfunc)
-      n_print ("      Has bufferallocfunc(): %s\n",
-          GST_DEBUG_FUNCPTR_NAME (pad->bufferallocfunc));
-
     if (pad->getcapsfunc)
       n_print ("      Has getcapsfunc(): %s\n",
           GST_DEBUG_FUNCPTR_NAME (pad->getcapsfunc));
index 5f32dab..c70c096 100644 (file)
@@ -590,9 +590,6 @@ print_element_info (GstElementFactory * factory)
         PUT_STRING (4, "<iterintlink-function function=\"%s\"/>",
             GST_DEBUG_FUNCPTR_NAME (pad->iterintlinkfunc));
 
-      if (pad->bufferallocfunc)
-        PUT_STRING (4, "<bufferalloc-function function=\"%s\"/>",
-            GST_DEBUG_FUNCPTR_NAME (pad->bufferallocfunc));
       PUT_END_TAG (3, "implementation");
 
       if (pad->caps) {
index efd9bdc..286d413 100644 (file)
@@ -634,8 +634,6 @@ EXPORTS
        gst_pad_add_data_probe_full
        gst_pad_add_event_probe
        gst_pad_add_event_probe_full
-       gst_pad_alloc_buffer
-       gst_pad_alloc_buffer_and_set_caps
        gst_pad_can_link
        gst_pad_chain
        gst_pad_chain_list
@@ -703,7 +701,6 @@ EXPORTS
        gst_pad_set_blocked
        gst_pad_set_blocked_async
        gst_pad_set_blocked_async_full
-       gst_pad_set_bufferalloc_function
        gst_pad_set_caps
        gst_pad_set_chain_function
        gst_pad_set_chain_list_function