buffer: add explicit getters and setters for buffer flags

These can be used from bindings.

https://bugzilla.gnome.org/show_bug.cgi?id=768301
This commit is contained in:
Arjen Veenhuizen 2016-07-07 08:01:24 +02:00 committed by Tim-Philipp Müller
parent 63fa65f777
commit cf6cac07dd
4 changed files with 87 additions and 1 deletions

View file

@ -258,6 +258,11 @@ GstParentBufferMeta
gst_buffer_add_parent_buffer_meta gst_buffer_add_parent_buffer_meta
gst_buffer_get_parent_buffer_meta gst_buffer_get_parent_buffer_meta
gst_buffer_get_flags
gst_buffer_set_flags
gst_buffer_unset_flags
gst_buffer_has_flags
<SUBSECTION Standard> <SUBSECTION Standard>
GstBufferClass GstBufferClass
GST_BUFFER GST_BUFFER

View file

@ -306,6 +306,77 @@ _replace_memory (GstBuffer * buffer, guint len, guint idx, guint length,
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_TAG_MEMORY); GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_TAG_MEMORY);
} }
/**
* gst_buffer_get_flags:
* @buffer: a #GstBuffer
*
* Get the #GstBufferFlags flags set on this buffer.
*
* Returns: the flags set on this buffer.
*
* Since: 1.10
*/
GstBufferFlags
gst_buffer_get_flags (GstBuffer * buffer)
{
return (GstBufferFlags) GST_BUFFER_FLAGS (buffer);
}
/**
* gst_buffer_flag_is_set:
* @buffer: a #GstBuffer
* @flags: the #GstBufferFlags flag to check.
*
* Gives the status of a specific flag on a buffer.
*
* Returns: %TRUE if all flags in @flags are found on @buffer.
*
* Since: 1.10
*/
gboolean
gst_buffer_has_flags (GstBuffer * buffer, GstBufferFlags flags)
{
return GST_BUFFER_FLAG_IS_SET (buffer, flags);
}
/**
* gst_buffer_set_flags:
* @buffer: a #GstBuffer
* @flags: the #GstBufferFlags to set.
*
* Sets one or more buffer flags on a buffer.
*
* Returns: %TRUE if @flags were successfully set on buffer.
*
* Since: 1.10
*/
gboolean
gst_buffer_set_flags (GstBuffer * buffer, GstBufferFlags flags)
{
GST_BUFFER_FLAG_SET (buffer, flags);
return TRUE;
}
/**
* gst_buffer_unset_flags:
* @buffer: a #GstBuffer
* @flags: the #GstBufferFlags to clear
*
* Clears one or more buffer flags.
*
* Returns: true if @flags is successfully cleared from buffer.
*
* Since: 1.10
*/
gboolean
gst_buffer_unset_flags (GstBuffer * buffer, GstBufferFlags flags)
{
GST_BUFFER_FLAG_UNSET (buffer, flags);
return TRUE;
}
/* transfer full for return and transfer none for @mem */ /* transfer full for return and transfer none for @mem */
static inline GstMemory * static inline GstMemory *
_memory_get_exclusive_reference (GstMemory * mem) _memory_get_exclusive_reference (GstMemory * mem)
@ -2102,7 +2173,6 @@ gst_buffer_add_meta (GstBuffer * buffer, const GstMetaInfo * info,
result = &item->meta; result = &item->meta;
result->info = info; result->info = info;
result->flags = GST_META_FLAG_NONE; result->flags = GST_META_FLAG_NONE;
GST_CAT_DEBUG (GST_CAT_BUFFER, GST_CAT_DEBUG (GST_CAT_BUFFER,
"alloc metadata %p (%s) of size %" G_GSIZE_FORMAT, result, "alloc metadata %p (%s) of size %" G_GSIZE_FORMAT, result,
g_type_name (info->type), info->size); g_type_name (info->type), info->size);

View file

@ -332,6 +332,13 @@ void gst_buffer_extract_dup (GstBuffer *buffer, gsize offset,
gsize size, gpointer *dest, gsize size, gpointer *dest,
gsize *dest_size); gsize *dest_size);
GstBufferFlags gst_buffer_get_flags (GstBuffer * buffer);
gboolean gst_buffer_has_flags (GstBuffer * buffer, GstBufferFlags flags);
gboolean gst_buffer_set_flags (GstBuffer * buffer, GstBufferFlags flags);
gboolean gst_buffer_unset_flags (GstBuffer * buffer, GstBufferFlags flags);
/* refcounting */ /* refcounting */
/** /**
* gst_buffer_ref: * gst_buffer_ref:

View file

@ -128,6 +128,7 @@ EXPORTS
gst_buffer_flags_get_type gst_buffer_flags_get_type
gst_buffer_foreach_meta gst_buffer_foreach_meta
gst_buffer_get_all_memory gst_buffer_get_all_memory
gst_buffer_get_flags
gst_buffer_get_max_memory gst_buffer_get_max_memory
gst_buffer_get_memory gst_buffer_get_memory
gst_buffer_get_memory_range gst_buffer_get_memory_range
@ -136,6 +137,7 @@ EXPORTS
gst_buffer_get_sizes gst_buffer_get_sizes
gst_buffer_get_sizes_range gst_buffer_get_sizes_range
gst_buffer_get_type gst_buffer_get_type
gst_buffer_has_flags
gst_buffer_insert_memory gst_buffer_insert_memory
gst_buffer_is_all_memory_writable gst_buffer_is_all_memory_writable
gst_buffer_is_memory_range_writable gst_buffer_is_memory_range_writable
@ -190,8 +192,10 @@ EXPORTS
gst_buffer_replace_memory_range gst_buffer_replace_memory_range
gst_buffer_resize gst_buffer_resize
gst_buffer_resize_range gst_buffer_resize_range
gst_buffer_set_flags
gst_buffer_set_size gst_buffer_set_size
gst_buffer_unmap gst_buffer_unmap
gst_buffer_unset_flags
gst_buffering_mode_get_type gst_buffering_mode_get_type
gst_bus_add_signal_watch gst_bus_add_signal_watch
gst_bus_add_signal_watch_full gst_bus_add_signal_watch_full