mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-03 01:02:19 +00:00
basetransform: use pad direction like other vmethods
This commit is contained in:
parent
31b70ea701
commit
f1566e85c0
2 changed files with 17 additions and 7 deletions
|
@ -325,7 +325,7 @@ static gboolean gst_base_transform_setcaps (GstBaseTransform * trans,
|
||||||
GstPad * pad, GstCaps * caps);
|
GstPad * pad, GstCaps * caps);
|
||||||
static gboolean gst_base_transform_query (GstPad * pad, GstQuery * query);
|
static gboolean gst_base_transform_query (GstPad * pad, GstQuery * query);
|
||||||
static gboolean gst_base_transform_default_query (GstBaseTransform * trans,
|
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 const GstQueryType *gst_base_transform_query_type (GstPad * pad);
|
||||||
|
|
||||||
static GstFlowReturn default_prepare_output_buffer (GstBaseTransform * trans,
|
static GstFlowReturn default_prepare_output_buffer (GstBaseTransform * trans,
|
||||||
|
@ -1303,12 +1303,13 @@ failed_configure:
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_base_transform_default_query (GstBaseTransform * trans,
|
gst_base_transform_default_query (GstBaseTransform * trans,
|
||||||
GstPad * pad, GstQuery * query)
|
GstPadDirection direction, GstQuery * query)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
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)) {
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
case GST_QUERY_ALLOCATION:
|
case GST_QUERY_ALLOCATION:
|
||||||
|
@ -1316,7 +1317,7 @@ gst_base_transform_default_query (GstBaseTransform * trans,
|
||||||
gboolean passthrough;
|
gboolean passthrough;
|
||||||
|
|
||||||
/* can only be done on the sinkpad */
|
/* can only be done on the sinkpad */
|
||||||
if (!GST_PAD_IS_SINK (pad))
|
if (direction != GST_PAD_SINK)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
GST_BASE_TRANSFORM_LOCK (trans);
|
GST_BASE_TRANSFORM_LOCK (trans);
|
||||||
|
@ -1378,7 +1379,7 @@ gst_base_transform_query (GstPad * pad, GstQuery * query)
|
||||||
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
|
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
|
||||||
|
|
||||||
if (bclass->query)
|
if (bclass->query)
|
||||||
ret = bclass->query (trans, pad, query);
|
ret = bclass->query (trans, GST_PAD_DIRECTION (pad), query);
|
||||||
else
|
else
|
||||||
ret = gst_pad_query_default (pad, query);
|
ret = gst_pad_query_default (pad, query);
|
||||||
|
|
||||||
|
|
|
@ -160,6 +160,13 @@ struct _GstBaseTransform {
|
||||||
* Handle a requested query. Subclasses that implement this
|
* Handle a requested query. Subclasses that implement this
|
||||||
* should must chain up to the parent if they didn't handle the
|
* should must chain up to the parent if they didn't handle the
|
||||||
* query
|
* 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
|
* @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
|
* with the given caps, calculate the size in bytes of a buffer
|
||||||
* on the other pad with the given other caps.
|
* on the other pad with the given other caps.
|
||||||
|
@ -225,9 +232,11 @@ struct _GstBaseTransformClass {
|
||||||
GstCaps *caps);
|
GstCaps *caps);
|
||||||
gboolean (*set_caps) (GstBaseTransform *trans, GstCaps *incaps,
|
gboolean (*set_caps) (GstBaseTransform *trans, GstCaps *incaps,
|
||||||
GstCaps *outcaps);
|
GstCaps *outcaps);
|
||||||
gboolean (*query) (GstBaseTransform *trans, GstPad *pad,
|
gboolean (*query) (GstBaseTransform *trans, GstPadDirection direction,
|
||||||
GstQuery *query);
|
GstQuery *query);
|
||||||
|
|
||||||
|
/* decide allocation query parameters for input buffers */
|
||||||
|
gboolean (*decide_allocation) (GstBaseTransform *trans, GstQuery *query);
|
||||||
/* setup allocation query for output buffers */
|
/* setup allocation query for output buffers */
|
||||||
gboolean (*setup_allocation) (GstBaseTransform *trans, GstQuery *query);
|
gboolean (*setup_allocation) (GstBaseTransform *trans, GstQuery *query);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue