+2007-12-14 Sebastian Dröge <slomo@circular-chaos.org>
+
+ * docs/libs/gstreamer-libs-sections.txt:
+ * libs/gst/base/gstbasetransform.c: (gst_base_transform_init),
+ (gst_base_transform_prepare_output_buffer),
+ (gst_base_transform_set_gap_aware):
+ * libs/gst/base/gstbasetransform.h:
+ API: Add gst_base_transform_set_gap_aware() to control whether
+ the element correctly handles GST_BUFFER_FLAG_GAP or shouldn't
+ get buffers with this flag at all. Fixes #503231.
+
2007-12-13 Stefan Kost <ensonic@users.sf.net>
* libs/gst/base/gstbasesink.c:
gboolean discont;
GstActivateMode pad_mode;
+
+ gboolean gap_aware;
};
static GstElementClass *parent_class = NULL;
trans->cache_caps1 = NULL;
trans->cache_caps2 = NULL;
trans->priv->pad_mode = GST_ACTIVATE_NONE;
+ trans->priv->gap_aware = FALSE;
trans->passthrough = FALSE;
if (bclass->transform == NULL) {
gst_buffer_copy_metadata (*out_buf, in_buf,
GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS);
+
+ /* Unset the GAP flag if the element is _not_ GAP aware. Otherwise
+ * it might create an output buffer that does not contain neutral data
+ * but still has the GAP flag on it! */
+ if (!trans->priv->gap_aware)
+ GST_BUFFER_FLAG_UNSET (*out_buf, GST_BUFFER_FLAG_GAP);
}
done:
return result;
}
+
+/**
+ * gst_base_transform_set_gap_aware:
+ * @trans: a #GstBaseTransform
+ * @gap_aware: New state
+ *
+ * If @gap_aware is %FALSE (as it is by default) subclasses will never get
+ * output buffers with the %GST_BUFFER_FLAG_GAP flag set.
+ *
+ * If set to %TRUE elements must handle output buffers with this flag set
+ * correctly, i.e. they can assume that the buffer contains neutral data
+ * but must unset the flag if the output is no neutral data.
+ * Since: 0.10.16
+ *
+ * MT safe.
+ */
+void
+gst_base_transform_set_gap_aware (GstBaseTransform * trans, gboolean gap_aware)
+{
+ g_return_if_fail (trans != NULL);
+
+ GST_OBJECT_LOCK (trans);
+ trans->priv->gap_aware = gap_aware;
+ GST_DEBUG_OBJECT (trans, "set gap aware %d", trans->priv->gap_aware);
+ GST_OBJECT_UNLOCK (trans);
+}