mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 20:51:13 +00:00
buffer: add gst_buffer_get_n_meta() convenience function
Counts how many metas there are for a certain api type. https://bugzilla.gnome.org/show_bug.cgi?id=791918
This commit is contained in:
parent
b5028383ab
commit
cd10f14726
4 changed files with 27 additions and 0 deletions
|
@ -253,6 +253,7 @@ gst_buffer_append
|
|||
gst_buffer_append_region
|
||||
|
||||
gst_buffer_get_meta
|
||||
gst_buffer_get_n_meta
|
||||
gst_buffer_add_meta
|
||||
gst_buffer_remove_meta
|
||||
gst_buffer_iterate_meta
|
||||
|
|
|
@ -2139,6 +2139,28 @@ gst_buffer_get_meta (GstBuffer * buffer, GType api)
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_buffer_get_n_meta:
|
||||
* @buffer: a #GstBuffer
|
||||
* @api_type: the #GType of an API
|
||||
*
|
||||
* Returns: number of metas of type @api_type on @buffer.
|
||||
*
|
||||
* Since: 1.14
|
||||
*/
|
||||
guint
|
||||
gst_buffer_get_n_meta (GstBuffer * buffer, GType api_type)
|
||||
{
|
||||
gpointer state = NULL;
|
||||
GstMeta *meta;
|
||||
guint n = 0;
|
||||
|
||||
while ((meta = gst_buffer_iterate_meta_filtered (buffer, &state, api_type)))
|
||||
++n;
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_buffer_add_meta:
|
||||
* @buffer: a #GstBuffer
|
||||
|
|
|
@ -612,6 +612,9 @@ typedef gboolean (*GstBufferForeachMetaFunc) (GstBuffer *buffer, GstMeta **me
|
|||
GST_EXPORT
|
||||
GstMeta * gst_buffer_get_meta (GstBuffer *buffer, GType api);
|
||||
|
||||
GST_EXPORT
|
||||
guint gst_buffer_get_n_meta (GstBuffer *buffer, GType api);
|
||||
|
||||
GST_EXPORT
|
||||
GstMeta * gst_buffer_add_meta (GstBuffer *buffer, const GstMetaInfo *info,
|
||||
gpointer params);
|
||||
|
|
|
@ -136,6 +136,7 @@ EXPORTS
|
|||
gst_buffer_get_memory
|
||||
gst_buffer_get_memory_range
|
||||
gst_buffer_get_meta
|
||||
gst_buffer_get_n_meta
|
||||
gst_buffer_get_reference_timestamp_meta
|
||||
gst_buffer_get_size
|
||||
gst_buffer_get_sizes
|
||||
|
|
Loading…
Reference in a new issue