From f09aa1dd08b61a6496ed9ab61583c5a51da57350 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Fri, 15 Feb 2008 12:33:00 +0000 Subject: [PATCH] gst/gstbuffer.c: Copy selected buffer-flags when creating subbuffers. Original commit message from CVS: * gst/gstbuffer.c: Copy selected buffer-flags when creating subbuffers. Fixes #516395. --- ChangeLog | 6 ++++++ common | 2 +- gst/gstbuffer.c | 16 ++++++++++------ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index abef797931..6ef489dc60 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-02-15 Stefan Kost + + * gst/gstbuffer.c: + Copy selected buffer-flags when creating subbuffers. + Fixes #516395. + 2008-02-12 Sebastian Dröge * gst/gstbuffer.c: (gst_buffer_class_init), (gst_buffer_finalize): diff --git a/common b/common index 05a617c904..2a19465fdb 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 05a617c9043ddb78f8578195b18c166d7e1d4c2e +Subproject commit 2a19465fdb43a75f4d32950fd2beb1beb950eec2 diff --git a/gst/gstbuffer.c b/gst/gstbuffer.c index 7d7eca040d..e28c11d2b3 100644 --- a/gst/gstbuffer.c +++ b/gst/gstbuffer.c @@ -464,12 +464,6 @@ gst_buffer_make_metadata_writable (GstBuffer * buf) } else { ret = gst_buffer_create_sub (buf, 0, GST_BUFFER_SIZE (buf)); - /* copy all the flags except IN_CAPS */ - GST_BUFFER_FLAGS (ret) = GST_BUFFER_FLAGS (buf); - GST_BUFFER_FLAG_UNSET (ret, GST_BUFFER_FLAG_IN_CAPS); - /* data should always be set to READONLY */ - GST_BUFFER_FLAG_SET (ret, GST_BUFFER_FLAG_READONLY); - gst_buffer_unref (buf); } @@ -599,6 +593,16 @@ gst_buffer_create_sub (GstBuffer * buffer, guint offset, guint size) GST_BUFFER_DATA (GST_BUFFER_CAST (subbuffer)) = buffer->data + offset; GST_BUFFER_SIZE (GST_BUFFER_CAST (subbuffer)) = size; + if ((offset == 0) && (size == GST_BUFFER_SIZE (buffer))) { + /* copy all the flags except IN_CAPS */ + GST_BUFFER_FLAG_SET (subbuffer, GST_BUFFER_FLAGS (buffer)); + GST_BUFFER_FLAG_UNSET (subbuffer, GST_BUFFER_FLAG_IN_CAPS); + } else { + /* copy only PREROLL & GAP flags */ + GST_BUFFER_FLAG_SET (subbuffer, (GST_BUFFER_FLAGS (buffer) & + (GST_BUFFER_FLAG_PREROLL | GST_BUFFER_FLAG_GAP))); + } + /* we can copy the timestamp and offset if the new buffer starts at * offset 0 */ if (offset == 0) {