![]() |
![]() |
![]() |
GStreamer 1.0 Core Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy |
#include <gst/gst.h> GstAllocator; enum GstAllocatorFlags; struct GstAllocationParams; #define GST_ALLOCATOR_SYSMEM GstAllocator * gst_allocator_find (const gchar *name
); void gst_allocator_register (const gchar *name
,GstAllocator *allocator
); void gst_allocator_set_default (GstAllocator *allocator
); void gst_allocation_params_init (GstAllocationParams *params
); GstAllocationParams * gst_allocation_params_copy (const GstAllocationParams *params
); void gst_allocation_params_free (GstAllocationParams *params
); GstMemory * gst_allocator_alloc (GstAllocator *allocator
,gsize size
,GstAllocationParams *params
); void gst_allocator_free (GstAllocator *allocator
,GstMemory *memory
); GstMemory * gst_memory_new_wrapped (GstMemoryFlags flags
,gpointer data
,gsize maxsize
,gsize offset
,gsize size
,gpointer user_data
,GDestroyNotify notify
);
Memory is usually created by allocators with a gst_allocator_alloc()
method call. When NULL is used as the allocator, the default allocator will
be used.
New allocators can be registered with gst_allocator_register()
.
Allocators are identified by name and can be retrieved with
gst_allocator_find()
. gst_allocator_set_default()
can be used to change the
default allocator.
New memory can be created with gst_memory_new_wrapped()
that wraps the memory
allocated elsewhere.
Last reviewed on 2012-07-09 (0.11.3)
typedef struct _GstAllocator GstAllocator;
The GstAllocator is used to create new memory.
typedef enum { GST_ALLOCATOR_FLAG_CUSTOM_ALLOC = (GST_OBJECT_FLAG_LAST << 0), GST_ALLOCATOR_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 16) } GstAllocatorFlags;
Flags for allocators.
struct GstAllocationParams { GstMemoryFlags flags; gsize align; gsize prefix; gsize padding; };
Parameters to control the allocation of memory
GstMemoryFlags |
flags to control allocation |
the desired alignment of the memory | |
the desired prefix | |
the desired padding |
#define GST_ALLOCATOR_SYSMEM "SystemMemory"
The allocator name for the default system memory allocator
GstAllocator * gst_allocator_find (const gchar *name
);
Find a previously registered allocator with name
. When name
is NULL, the
default allocator will be returned.
|
the name of the allocator |
Returns : |
a GstAllocator or NULL when the allocator with name was not
registered. Use gst_object_unref() to release the allocator after usage. [transfer full]
|
void gst_allocator_register (const gchar *name
,GstAllocator *allocator
);
Registers the memory allocator
with name
. This function takes ownership of
allocator
.
|
the name of the allocator |
|
GstAllocator. [transfer full] |
void gst_allocator_set_default (GstAllocator *allocator
);
Set the default allocator. This function takes ownership of allocator
.
|
a GstAllocator. [transfer full] |
void gst_allocation_params_init (GstAllocationParams *params
);
Initialize params
to its default values
|
a GstAllocationParams |
GstAllocationParams * gst_allocation_params_copy (const GstAllocationParams *params
);
Create a copy of params
.
Free-function: gst_allocation_params_free
|
a GstAllocationParams. [transfer none] |
Returns : |
a new #GstAllocationParams, free with
gst_allocation_params_free() . [transfer full]
|
void gst_allocation_params_free (GstAllocationParams *params
);
Free params
|
a GstAllocationParams. [in][transfer full] |
GstMemory * gst_allocator_alloc (GstAllocator *allocator
,gsize size
,GstAllocationParams *params
);
Use allocator
to allocate a new memory block with memory that is at least
size
big.
The optional params
can specify the prefix and padding for the memory. If
NULL is passed, no flags, no extra prefix/padding and a default alignment is
used.
The prefix/padding will be filled with 0 if flags contains GST_MEMORY_FLAG_ZERO_PREFIXED and GST_MEMORY_FLAG_ZERO_PADDED respectively.
When allocator
is NULL, the default allocator will be used.
The alignment in params
is given as a bitmask so that align
+ 1 equals
the amount of bytes to align to. For example, to align to 8 bytes,
use an alignment of 7.
|
a GstAllocator to use. [transfer none][allow-none] |
|
size of the visible memory area |
|
optional parameters. [transfer none][allow-none] |
Returns : |
a new GstMemory. [transfer full] |
void gst_allocator_free (GstAllocator *allocator
,GstMemory *memory
);
Free memory
that was previously allocated with gst_allocator_alloc()
.
|
a GstAllocator to use. [transfer none] |
|
the memory to free. [transfer full] |
GstMemory * gst_memory_new_wrapped (GstMemoryFlags flags
,gpointer data
,gsize maxsize
,gsize offset
,gsize size
,gpointer user_data
,GDestroyNotify notify
);
Allocate a new memory block that wraps the given data
.
The prefix/padding must be filled with 0 if flags
contains
GST_MEMORY_FLAG_ZERO_PREFIXED and GST_MEMORY_FLAG_ZERO_PADDED respectively.
|
GstMemoryFlags |
|
data to wrap |
|
allocated size of data
|
|
offset in data
|
|
size of valid data |
|
user_data |
|
called with user_data when the memory is freed |
Returns : |
a new GstMemory. |