mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-08 23:42:28 +00:00
buffer: always copy all buffer flags when asked
Don't try to be smart and copy only a subset of buffer flag
This commit is contained in:
parent
96ecd61618
commit
b5ef693e88
2 changed files with 14 additions and 44 deletions
|
@ -270,14 +270,8 @@ gst_buffer_copy_into (GstBuffer * dest, GstBuffer * src,
|
||||||
bufsize);
|
bufsize);
|
||||||
|
|
||||||
if (flags & GST_BUFFER_COPY_FLAGS) {
|
if (flags & GST_BUFFER_COPY_FLAGS) {
|
||||||
guint mask;
|
/* copy flags */
|
||||||
|
GST_MINI_OBJECT_FLAGS (dest) = GST_MINI_OBJECT_FLAGS (src);
|
||||||
/* copy relevant flags */
|
|
||||||
mask = GST_BUFFER_FLAG_LIVE | GST_BUFFER_FLAG_IN_CAPS |
|
|
||||||
GST_BUFFER_FLAG_DELTA_UNIT | GST_BUFFER_FLAG_DISCONT |
|
|
||||||
GST_BUFFER_FLAG_GAP | GST_BUFFER_FLAG_MEDIA1 |
|
|
||||||
GST_BUFFER_FLAG_MEDIA2 | GST_BUFFER_FLAG_MEDIA3;
|
|
||||||
GST_MINI_OBJECT_FLAGS (dest) |= GST_MINI_OBJECT_FLAGS (src) & mask;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & GST_BUFFER_COPY_TIMESTAMPS) {
|
if (flags & GST_BUFFER_COPY_TIMESTAMPS) {
|
||||||
|
|
|
@ -1457,48 +1457,24 @@ static gboolean
|
||||||
default_copy_metadata (GstBaseTransform * trans,
|
default_copy_metadata (GstBaseTransform * trans,
|
||||||
GstBuffer * inbuf, GstBuffer * outbuf)
|
GstBuffer * inbuf, GstBuffer * outbuf)
|
||||||
{
|
{
|
||||||
GstBaseTransformPrivate *priv;
|
GstBaseTransformPrivate *priv = trans->priv;
|
||||||
gboolean copymeta;
|
|
||||||
guint mask;
|
|
||||||
|
|
||||||
priv = trans->priv;
|
|
||||||
|
|
||||||
/* now copy the metadata */
|
/* now copy the metadata */
|
||||||
mask = GST_BUFFER_FLAG_LIVE | GST_BUFFER_FLAG_IN_CAPS |
|
GST_DEBUG_OBJECT (trans, "copying metadata");
|
||||||
GST_BUFFER_FLAG_DELTA_UNIT | GST_BUFFER_FLAG_DISCONT |
|
|
||||||
GST_BUFFER_FLAG_GAP | GST_BUFFER_FLAG_MEDIA1 |
|
|
||||||
GST_BUFFER_FLAG_MEDIA2 | GST_BUFFER_FLAG_MEDIA3;
|
|
||||||
|
|
||||||
/* see if the flags and timestamps match */
|
/* this should not happen, buffers allocated from a pool or with
|
||||||
copymeta =
|
* new_allocate should always be writable. */
|
||||||
(GST_MINI_OBJECT_FLAGS (outbuf) & mask) !=
|
if (!gst_buffer_is_writable (outbuf))
|
||||||
(GST_MINI_OBJECT_FLAGS (inbuf) & mask);
|
goto not_writable;
|
||||||
copymeta |=
|
|
||||||
GST_BUFFER_TIMESTAMP (outbuf) != GST_BUFFER_TIMESTAMP (inbuf) ||
|
|
||||||
GST_BUFFER_DURATION (outbuf) != GST_BUFFER_DURATION (inbuf) ||
|
|
||||||
GST_BUFFER_OFFSET (outbuf) != GST_BUFFER_OFFSET (inbuf) ||
|
|
||||||
GST_BUFFER_OFFSET_END (outbuf) != GST_BUFFER_OFFSET_END (inbuf);
|
|
||||||
/* we need to modify the metadata when the element is not gap aware,
|
|
||||||
* passthrough is not used and the gap flag is set */
|
|
||||||
copymeta |= !priv->gap_aware && !trans->passthrough
|
|
||||||
&& (GST_MINI_OBJECT_FLAGS (outbuf) & GST_BUFFER_FLAG_GAP);
|
|
||||||
|
|
||||||
if (copymeta) {
|
/* when we get here, the metadata should be writable */
|
||||||
GST_DEBUG_OBJECT (trans, "copying metadata");
|
gst_buffer_copy_into (outbuf, inbuf,
|
||||||
|
GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
|
||||||
|
|
||||||
/* this should not happen, buffers allocated from a pool or with
|
/* clear the GAP flag when the subclass does not understand it */
|
||||||
* new_allocate should always be writable. */
|
if (!priv->gap_aware)
|
||||||
if (!gst_buffer_is_writable (outbuf))
|
GST_BUFFER_FLAG_UNSET (outbuf, GST_BUFFER_FLAG_GAP);
|
||||||
goto not_writable;
|
|
||||||
|
|
||||||
/* when we get here, the metadata should be writable */
|
|
||||||
gst_buffer_copy_into (outbuf, inbuf,
|
|
||||||
GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
|
|
||||||
|
|
||||||
/* clear the GAP flag when the subclass does not understand it */
|
|
||||||
if (!priv->gap_aware)
|
|
||||||
GST_BUFFER_FLAG_UNSET (outbuf, GST_BUFFER_FLAG_GAP);
|
|
||||||
}
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
|
Loading…
Reference in a new issue