mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 11:29:55 +00:00
memory: add method to check memory type
Add a method to check if a memory was allocated from an allocator of a given type. API: gst_memory_is_type()
This commit is contained in:
parent
b339b0c12e
commit
4df4fd33b1
3 changed files with 26 additions and 0 deletions
|
@ -1345,6 +1345,8 @@ GstMemoryIsSpanFunction
|
|||
|
||||
gst_memory_init
|
||||
|
||||
gst_memory_is_type
|
||||
|
||||
gst_memory_ref
|
||||
gst_memory_unref
|
||||
|
||||
|
|
|
@ -138,6 +138,27 @@ gst_memory_init (GstMemory * mem, GstMemoryFlags flags,
|
|||
offset, size);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_memory_is_type:
|
||||
* @mem: a #GstMemory
|
||||
* @mem_type: a memory type
|
||||
*
|
||||
* Check if @mem if allocated with an allocator for @mem_type.
|
||||
*
|
||||
* Returns: %TRUE if @mem was allocated from an allocator for @mem_type.
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
gboolean
|
||||
gst_memory_is_type (GstMemory * mem, const gchar * mem_type)
|
||||
{
|
||||
g_return_val_if_fail (mem != NULL, FALSE);
|
||||
g_return_val_if_fail (mem->allocator != NULL, FALSE);
|
||||
g_return_val_if_fail (mem_type != NULL, FALSE);
|
||||
|
||||
return (g_strcmp0 (mem->allocator->mem_type, mem_type) == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_memory_get_sizes:
|
||||
* @mem: a #GstMemory
|
||||
|
|
|
@ -287,6 +287,9 @@ void gst_memory_init (GstMemory *mem, GstMemoryFlags flags,
|
|||
GstAllocator *allocator, GstMemory *parent,
|
||||
gsize maxsize, gsize align,
|
||||
gsize offset, gsize size);
|
||||
|
||||
gboolean gst_memory_is_type (GstMemory *mem, const gchar *mem_type);
|
||||
|
||||
/* refcounting */
|
||||
/**
|
||||
* gst_memory_ref:
|
||||
|
|
Loading…
Reference in a new issue