API: Add gst_base_transform_set_gap_aware() to control whether the element correctly handles GST_BUFFER_FLAG_GAP or s...

Original commit message from CVS:
* 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.
This commit is contained in:
Sebastian Dröge 2007-12-14 16:52:38 +00:00
parent 55bfc68e93
commit 5f55ba792a
4 changed files with 50 additions and 0 deletions

View file

@ -1,3 +1,14 @@
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:

View file

@ -303,6 +303,7 @@ gst_base_transform_set_in_place
gst_base_transform_is_qos_enabled
gst_base_transform_set_qos_enabled
gst_base_transform_update_qos
gst_base_transform_set_gap_aware
GST_BASE_TRANSFORM_SINK_NAME
GST_BASE_TRANSFORM_SRC_NAME

View file

@ -234,6 +234,8 @@ struct _GstBaseTransformPrivate
gboolean discont;
GstActivateMode pad_mode;
gboolean gap_aware;
};
static GstElementClass *parent_class = NULL;
@ -400,6 +402,7 @@ gst_base_transform_init (GstBaseTransform * trans,
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) {
@ -974,6 +977,12 @@ gst_base_transform_prepare_output_buffer (GstBaseTransform * trans,
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:
@ -1945,3 +1954,29 @@ gst_base_transform_is_qos_enabled (GstBaseTransform * trans)
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);
}

View file

@ -253,6 +253,9 @@ void gst_base_transform_set_qos_enabled (GstBaseTransform *trans,
gboolean enabled);
gboolean gst_base_transform_is_qos_enabled (GstBaseTransform *trans);
void gst_base_transform_set_gap_aware (GstBaseTransform *trans,
gboolean gap_aware);
G_END_DECLS
#endif /* __GST_BASE_TRANSFORM_H__ */