GstPad * pad, GstCaps * caps);
static gboolean gst_base_transform_query (GstPad * pad, GstQuery * query);
static gboolean gst_base_transform_default_query (GstBaseTransform * trans,
- GstPad * pad, GstQuery * query);
+ GstPadDirection direction, GstQuery * query);
static const GstQueryType *gst_base_transform_query_type (GstPad * pad);
static GstFlowReturn default_prepare_output_buffer (GstBaseTransform * trans,
static gboolean
gst_base_transform_default_query (GstBaseTransform * trans,
- GstPad * pad, GstQuery * query)
+ GstPadDirection direction, GstQuery * query)
{
gboolean ret = FALSE;
- GstPad *otherpad;
+ GstPad *pad, *otherpad;
- otherpad = (pad == trans->srcpad) ? trans->sinkpad : trans->srcpad;
+ pad = (direction == GST_PAD_SRC) ? trans->srcpad : trans->sinkpad;
+ otherpad = (direction == GST_PAD_SINK) ? trans->sinkpad : trans->srcpad;
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_ALLOCATION:
gboolean passthrough;
/* can only be done on the sinkpad */
- if (!GST_PAD_IS_SINK (pad))
+ if (direction != GST_PAD_SINK)
goto done;
GST_BASE_TRANSFORM_LOCK (trans);
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
if (bclass->query)
- ret = bclass->query (trans, pad, query);
+ ret = bclass->query (trans, GST_PAD_DIRECTION (pad), query);
else
ret = gst_pad_query_default (pad, query);
* Handle a requested query. Subclasses that implement this
* should must chain up to the parent if they didn't handle the
* query
+ * @decide_allocation: Decide what parameters you want upstream elements to use
+ * for the allocation of buffers. This function is only
+ * called when not operating in passthrough mode.
+ * @setup_allocation: Setup the allocation parameters for allocating output
+ * buffers. The passed in query contains the result of the
+ * downstream allocation query. This function is only called
+ * when not operating in passthrough mode.
* @transform_size: Optional. Given the size of a buffer in the given direction
* with the given caps, calculate the size in bytes of a buffer
* on the other pad with the given other caps.
GstCaps *caps);
gboolean (*set_caps) (GstBaseTransform *trans, GstCaps *incaps,
GstCaps *outcaps);
- gboolean (*query) (GstBaseTransform *trans, GstPad *pad,
+ gboolean (*query) (GstBaseTransform *trans, GstPadDirection direction,
GstQuery *query);
+ /* decide allocation query parameters for input buffers */
+ gboolean (*decide_allocation) (GstBaseTransform *trans, GstQuery *query);
/* setup allocation query for output buffers */
gboolean (*setup_allocation) (GstBaseTransform *trans, GstQuery *query);