PROP_QOS
};
-#define GST_BASE_TRANSFORM_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_BASE_TRANSFORM, GstBaseTransformPrivate))
-
struct _GstBaseTransformPrivate
{
/* Set by sub-class */
static GstElementClass *parent_class = NULL;
+static gint private_offset = 0;
static void gst_base_transform_class_init (GstBaseTransformClass * klass);
static void gst_base_transform_init (GstBaseTransform * trans,
_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstBaseTransform", &base_transform_info, G_TYPE_FLAG_ABSTRACT);
+
+ private_offset =
+ g_type_add_instance_private (_type, sizeof (GstBaseTransformPrivate));
+
g_once_init_leave (&base_transform_type, _type);
}
return base_transform_type;
}
+static inline GstBaseTransformPrivate *
+gst_base_transform_get_instance_private (GstBaseTransform * self)
+{
+ return (G_STRUCT_MEMBER_P (self, private_offset));
+}
+
static void gst_base_transform_finalize (GObject * object);
static void gst_base_transform_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
gobject_class = G_OBJECT_CLASS (klass);
+ if (private_offset != 0)
+ g_type_class_adjust_private_offset (klass, &private_offset);
+
GST_DEBUG_CATEGORY_INIT (gst_base_transform_debug, "basetransform", 0,
"basetransform element");
GST_DEBUG ("gst_base_transform_class_init");
- g_type_class_add_private (klass, sizeof (GstBaseTransformPrivate));
-
parent_class = g_type_class_peek_parent (klass);
gobject_class->set_property = gst_base_transform_set_property;
GST_DEBUG ("gst_base_transform_init");
- priv = trans->priv = GST_BASE_TRANSFORM_GET_PRIVATE (trans);
+ priv = trans->priv = gst_base_transform_get_instance_private (trans);
pad_template =
gst_element_class_get_pad_template (GST_ELEMENT_CLASS (bclass), "sink");
GST_DEBUG_OBJECT (pad, "transformed %" GST_PTR_FORMAT, peerfilter);
gst_caps_unref (temp);
- if (!gst_caps_is_empty (peerfilter)) {
+ if (peerfilter && !gst_caps_is_empty (peerfilter)) {
/* and filter against the template of the other pad */
GST_DEBUG_OBJECT (pad, "our template %" GST_PTR_FORMAT, otempl);
/* We keep the caps sorted like the returned caps */
/* If change are not acceptable, fallback to generic pool */
if (!gst_buffer_pool_config_validate_params (config, outcaps, size, min,
max)) {
- GST_DEBUG_OBJECT (trans, "unsuported pool, making new pool");
+ GST_DEBUG_OBJECT (trans, "unsupported pool, making new pool");
gst_object_unref (pool);
pool = gst_buffer_pool_new ();
if (!result)
goto no_decide_allocation;
+ /* check again in case the sub-class have switch to passthrough/in-place
+ * after looking at the meta APIs */
+ if (priv->passthrough || priv->always_in_place) {
+ GST_DEBUG_OBJECT (trans, "no doing passthrough, delay bufferpool");
+ gst_base_transform_set_allocation (trans, NULL, NULL, NULL, NULL);
+ gst_query_unref (query);
+ return TRUE;
+ }
+
/* we got configuration from our peer or the decide_allocation method,
* parse them */
if (gst_query_get_n_allocation_params (query) > 0) {
GstBaseTransformClass *bclass;
gboolean ret = FALSE;
- trans = GST_BASE_TRANSFORM (parent);
+ trans = GST_BASE_TRANSFORM_CAST (parent);
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
if (bclass->query)
* function and when it returns %TRUE */
if (do_copy) {
GstMetaTransformCopy copy_data = { FALSE, 0, -1 };
- GST_DEBUG_OBJECT (trans, "copy metadata %s", g_type_name (info->api));
/* simply copy then */
- info->transform_func (outbuf, *meta, inbuf,
- _gst_meta_transform_copy, ©_data);
+ if (info->transform_func) {
+ GST_DEBUG_OBJECT (trans, "copy metadata %s", g_type_name (info->api));
+ info->transform_func (outbuf, *meta, inbuf,
+ _gst_meta_transform_copy, ©_data);
+ } else {
+ GST_DEBUG_OBJECT (trans, "couldn't copy metadata %s",
+ g_type_name (info->api));
+ }
}
return TRUE;
}
}
}
-/* Given @caps calcultate the size of one unit.
+/* Given @caps calculate the size of one unit.
*
* For video caps, this is the size of one frame (and thus one buffer).
* For audio caps, this is the size of one sample.
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
res = bclass->get_unit_size (trans, caps, size);
GST_DEBUG_OBJECT (trans,
- "caps %" GST_PTR_FORMAT ") has unit size %" G_GSIZE_FORMAT ", res %s",
+ "caps %" GST_PTR_FORMAT " has unit size %" G_GSIZE_FORMAT ", res %s",
caps, *size, res ? "TRUE" : "FALSE");
if (res) {
GstBaseTransformClass *bclass;
gboolean ret = TRUE;
- trans = GST_BASE_TRANSFORM (parent);
+ trans = GST_BASE_TRANSFORM_CAST (parent);
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
if (bclass->sink_event)
GstBaseTransformClass *bclass;
gboolean ret = TRUE;
- trans = GST_BASE_TRANSFORM (parent);
+ trans = GST_BASE_TRANSFORM_CAST (parent);
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
if (bclass->src_event)
guint length, GstBuffer ** buffer)
{
GstBaseTransformClass *klass = GST_BASE_TRANSFORM_GET_CLASS (parent);
- GstBaseTransform *trans = GST_BASE_TRANSFORM (parent);
+ GstBaseTransform *trans = GST_BASE_TRANSFORM_CAST (parent);
GstBaseTransformPrivate *priv = trans->priv;
GstFlowReturn ret;
GstBuffer *inbuf = NULL;
static GstFlowReturn
gst_base_transform_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
{
- GstBaseTransform *trans = GST_BASE_TRANSFORM (parent);
+ GstBaseTransform *trans = GST_BASE_TRANSFORM_CAST (parent);
GstBaseTransformClass *klass = GST_BASE_TRANSFORM_GET_CLASS (trans);
GstBaseTransformPrivate *priv = trans->priv;
GstFlowReturn ret;
{
GstBaseTransform *trans;
- trans = GST_BASE_TRANSFORM (object);
+ trans = GST_BASE_TRANSFORM_CAST (object);
switch (prop_id) {
case PROP_QOS:
{
GstBaseTransform *trans;
- trans = GST_BASE_TRANSFORM (object);
+ trans = GST_BASE_TRANSFORM_CAST (object);
switch (prop_id) {
case PROP_QOS:
gboolean result = FALSE;
GstBaseTransform *trans;
- trans = GST_BASE_TRANSFORM (parent);
+ trans = GST_BASE_TRANSFORM_CAST (parent);
switch (mode) {
case GST_PAD_MODE_PUSH:
gboolean result = FALSE;
GstBaseTransform *trans;
- trans = GST_BASE_TRANSFORM (parent);
+ trans = GST_BASE_TRANSFORM_CAST (parent);
switch (mode) {
case GST_PAD_MODE_PULL:
*
* Updates the srcpad caps and send the caps downstream. This function
* can be used by subclasses when they have already negotiated their caps
- * but found a change in them (or computed new informations). This way,
- * they can notify downstream about that change without loosing any
+ * but found a change in them (or computed new information). This way,
+ * they can notify downstream about that change without losing any
* buffer.
*
* Returns: %TRUE if the caps could be send downstream %FALSE otherwise