buffer: add copy flag for meta

Add a flag to control if the meta should be copied or not instead of always
copying.
This commit is contained in:
Wim Taymans 2011-12-01 15:34:06 +01:00
parent 23bec521bf
commit dc23684b12
2 changed files with 14 additions and 8 deletions

View file

@ -323,6 +323,7 @@ gst_buffer_copy_into (GstBuffer * dest, GstBuffer * src,
} }
} }
if (flags & GST_BUFFER_COPY_META) {
for (walk = GST_BUFFER_META (src); walk; walk = walk->next) { for (walk = GST_BUFFER_META (src); walk; walk = walk->next) {
GstMeta *meta = &walk->meta; GstMeta *meta = &walk->meta;
const GstMetaInfo *info = meta->info; const GstMetaInfo *info = meta->info;
@ -330,6 +331,7 @@ gst_buffer_copy_into (GstBuffer * dest, GstBuffer * src,
if (info->copy_func) if (info->copy_func)
info->copy_func (dest, meta, src, offset, size); info->copy_func (dest, meta, src, offset, size);
} }
}
} }
static GstBuffer * static GstBuffer *

View file

@ -393,6 +393,8 @@ gst_buffer_copy (const GstBuffer * buf)
* and appended to already existing memory * and appended to already existing memory
* @GST_BUFFER_COPY_MERGE: flag indicating that buffer memory should be * @GST_BUFFER_COPY_MERGE: flag indicating that buffer memory should be
* merged * merged
* @GST_BUFFER_COPY_META: flag indicating that buffer meta should be
* copied
* *
* A set of flags that can be provided to the gst_buffer_copy_into() * A set of flags that can be provided to the gst_buffer_copy_into()
* function to specify which items should be copied. * function to specify which items should be copied.
@ -401,8 +403,9 @@ typedef enum {
GST_BUFFER_COPY_NONE = 0, GST_BUFFER_COPY_NONE = 0,
GST_BUFFER_COPY_FLAGS = (1 << 0), GST_BUFFER_COPY_FLAGS = (1 << 0),
GST_BUFFER_COPY_TIMESTAMPS = (1 << 1), GST_BUFFER_COPY_TIMESTAMPS = (1 << 1),
GST_BUFFER_COPY_MEMORY = (1 << 2), GST_BUFFER_COPY_META = (1 << 2),
GST_BUFFER_COPY_MERGE = (1 << 3) GST_BUFFER_COPY_MEMORY = (1 << 3),
GST_BUFFER_COPY_MERGE = (1 << 4)
} GstBufferCopyFlags; } GstBufferCopyFlags;
/** /**
@ -411,7 +414,8 @@ typedef enum {
* Combination of all possible metadata fields that can be copied with * Combination of all possible metadata fields that can be copied with
* gst_buffer_copy_into(). * gst_buffer_copy_into().
*/ */
#define GST_BUFFER_COPY_METADATA (GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS) #define GST_BUFFER_COPY_METADATA (GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS |\
GST_BUFFER_COPY_META)
/** /**
* GST_BUFFER_COPY_ALL: * GST_BUFFER_COPY_ALL: