mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
BaseTransform: Add a query vfunc
This commit is contained in:
parent
341d7a4c0d
commit
63a21ca8b1
2 changed files with 33 additions and 6 deletions
|
@ -350,6 +350,8 @@ static gboolean gst_base_transform_setcaps (GstPad * pad, GstCaps * caps);
|
||||||
static GstFlowReturn gst_base_transform_buffer_alloc (GstPad * pad,
|
static GstFlowReturn gst_base_transform_buffer_alloc (GstPad * pad,
|
||||||
guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
|
guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
|
||||||
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,
|
||||||
|
GstPad * pad, GstQuery * query);
|
||||||
static const GstQueryType *gst_base_transform_query_type (GstPad * pad);
|
static const GstQueryType *gst_base_transform_query_type (GstPad * pad);
|
||||||
|
|
||||||
/* static guint gst_base_transform_signals[LAST_SIGNAL] = { 0 }; */
|
/* static guint gst_base_transform_signals[LAST_SIGNAL] = { 0 }; */
|
||||||
|
@ -397,6 +399,7 @@ gst_base_transform_class_init (GstBaseTransformClass * klass)
|
||||||
klass->src_event = GST_DEBUG_FUNCPTR (gst_base_transform_src_eventfunc);
|
klass->src_event = GST_DEBUG_FUNCPTR (gst_base_transform_src_eventfunc);
|
||||||
klass->accept_caps =
|
klass->accept_caps =
|
||||||
GST_DEBUG_FUNCPTR (gst_base_transform_acceptcaps_default);
|
GST_DEBUG_FUNCPTR (gst_base_transform_acceptcaps_default);
|
||||||
|
klass->query = GST_DEBUG_FUNCPTR (gst_base_transform_default_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1234,15 +1237,12 @@ failed_configure:
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_base_transform_query (GstPad * pad, GstQuery * query)
|
gst_base_transform_default_query (GstBaseTransform * trans,
|
||||||
|
GstPad * pad, GstQuery * query)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
GstBaseTransform *trans;
|
|
||||||
GstPad *otherpad;
|
GstPad *otherpad;
|
||||||
|
|
||||||
trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad));
|
|
||||||
if (G_UNLIKELY (trans == NULL))
|
|
||||||
return FALSE;
|
|
||||||
otherpad = (pad == trans->srcpad) ? trans->sinkpad : trans->srcpad;
|
otherpad = (pad == trans->srcpad) ? trans->sinkpad : trans->srcpad;
|
||||||
|
|
||||||
switch (GST_QUERY_TYPE (query)) {
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
|
@ -1274,7 +1274,29 @@ gst_base_transform_query (GstPad * pad, GstQuery * query)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_base_transform_query (GstPad * pad, GstQuery * query)
|
||||||
|
{
|
||||||
|
GstBaseTransform *trans;
|
||||||
|
GstBaseTransformClass *bclass;
|
||||||
|
gboolean ret;
|
||||||
|
|
||||||
|
trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad));
|
||||||
|
if (G_UNLIKELY (trans == NULL))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
|
||||||
|
|
||||||
|
if (bclass->query)
|
||||||
|
ret = bclass->query (trans, pad, query);
|
||||||
|
else
|
||||||
|
ret = gst_pad_query_default (pad, query);
|
||||||
|
|
||||||
gst_object_unref (trans);
|
gst_object_unref (trans);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -190,6 +190,10 @@ struct _GstBaseTransform {
|
||||||
* Subclasses can override this method to check if @caps can be
|
* Subclasses can override this method to check if @caps can be
|
||||||
* handled by the element. The default implementation might not be
|
* handled by the element. The default implementation might not be
|
||||||
* the most optimal way to check this in all cases.
|
* the most optimal way to check this in all cases.
|
||||||
|
* @query: Optional Since 0.10.36
|
||||||
|
* Handle a requested query. Subclasses that implement this
|
||||||
|
* should must chain up to the parent if they didn't handle the
|
||||||
|
* query
|
||||||
*
|
*
|
||||||
* Subclasses can override any of the available virtual methods or not, as
|
* Subclasses can override any of the available virtual methods or not, as
|
||||||
* needed. At minimum either @transform or @transform_ip need to be overridden.
|
* needed. At minimum either @transform or @transform_ip need to be overridden.
|
||||||
|
@ -243,9 +247,10 @@ struct _GstBaseTransformClass {
|
||||||
|
|
||||||
gboolean (*accept_caps) (GstBaseTransform *trans, GstPadDirection direction,
|
gboolean (*accept_caps) (GstBaseTransform *trans, GstPadDirection direction,
|
||||||
GstCaps *caps);
|
GstCaps *caps);
|
||||||
|
gboolean (*query) (GstBaseTransform *trans, GstPad *pad, GstQuery *query);
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
gpointer _gst_reserved[GST_PADDING_LARGE - 3];
|
gpointer _gst_reserved[GST_PADDING_LARGE - 4];
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gst_base_transform_get_type (void);
|
GType gst_base_transform_get_type (void);
|
||||||
|
|
Loading…
Reference in a new issue