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_setcaps (GstBaseTransform * trans,
+ 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);
static const GstQueryType *gst_base_transform_query_type (GstPad * pad);
+static GstFlowReturn default_prepare_output_buffer (GstBaseTransform * trans,
+ GstBuffer * inbuf, GstBuffer ** outbuf);
+static gboolean default_copy_metadata (GstBaseTransform * trans,
+ GstBuffer * inbuf, GstBuffer * outbuf);
+
/* static guint gst_base_transform_signals[LAST_SIGNAL] = { 0 }; */
static void
klass->src_event = GST_DEBUG_FUNCPTR (gst_base_transform_src_eventfunc);
klass->accept_caps =
GST_DEBUG_FUNCPTR (gst_base_transform_acceptcaps_default);
+ klass->prepare_output_buffer =
+ GST_DEBUG_FUNCPTR (default_prepare_output_buffer);
+ klass->copy_metadata = GST_DEBUG_FUNCPTR (default_copy_metadata);
+ klass->query = GST_DEBUG_FUNCPTR (gst_base_transform_default_query);
}
static void
break;
}
+done:
+ 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);
+
return ret;
}
* element ?
* @fixate_caps: Optional. Given the pad in this direction and the given
* caps, fixate the caps on the other pad.
+ * @accept_caps: Optional. Since 0.10.30
+ * Subclasses can override this method to check if @caps can be
+ * handled by the element. The default implementation might not be
+ * the most optimal way to check this in all cases.
+ * @set_caps: allows the subclass to be notified of the actual caps set.
++ * @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
* @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.
void (*fixate_caps) (GstBaseTransform *trans,
GstPadDirection direction, GstCaps *caps,
GstCaps *othercaps);
+ gboolean (*accept_caps) (GstBaseTransform *trans, GstPadDirection direction,
+ GstCaps *caps);
+ gboolean (*set_caps) (GstBaseTransform *trans, GstCaps *incaps,
+ GstCaps *outcaps);
++ gboolean (*query) (GstBaseTransform *trans, GstPad *pad,
++ GstQuery *query);
+ /* setup allocation query for output buffers */
+ gboolean (*setup_allocation) (GstBaseTransform *trans, GstQuery *query);
+
+ /* transform size */
gboolean (*transform_size) (GstBaseTransform *trans,
GstPadDirection direction,
- GstCaps *caps, guint size,
- GstCaps *othercaps, guint *othersize);
+ GstCaps *caps, gsize size,
+ GstCaps *othercaps, gsize *othersize);
gboolean (*get_unit_size) (GstBaseTransform *trans, GstCaps *caps,
- guint *size);
-
- gboolean (*set_caps) (GstBaseTransform *trans, GstCaps *incaps,
- GstCaps *outcaps);
+ gsize *size);
+ /* states */
gboolean (*start) (GstBaseTransform *trans);
gboolean (*stop) (GstBaseTransform *trans);
- gboolean (*event) (GstBaseTransform *trans, GstEvent *event);
-
- GstFlowReturn (*transform) (GstBaseTransform *trans, GstBuffer *inbuf,
- GstBuffer *outbuf);
- GstFlowReturn (*transform_ip) (GstBaseTransform *trans, GstBuffer *buf);
-
- /* FIXME: When adjusting the padding, move these to nicer places in the class */
- gboolean passthrough_on_same_caps;
+ /* sink and src pad event handlers */
+ gboolean (*sink_event) (GstBaseTransform *trans, GstEvent *event);
+ gboolean (*src_event) (GstBaseTransform *trans, GstEvent *event);
GstFlowReturn (*prepare_output_buffer) (GstBaseTransform * trans,
- GstBuffer *input, GstBuffer **outbuf);
- GstBuffer *input, gint size, GstCaps *caps, GstBuffer **buf);
++ GstBuffer *input, GstBuffer **outbuf);
- gboolean (*copy_metadata) (GstBaseTransform * trans, GstBuffer *input, GstBuffer *outbuf);
- /* src event */
- gboolean (*src_event) (GstBaseTransform *trans, GstEvent *event);
++ gboolean (*copy_metadata) (GstBaseTransform * trans, GstBuffer *input,
++ GstBuffer *outbuf);
void (*before_transform) (GstBaseTransform *trans, GstBuffer *buffer);