Details
GST_DATA()
#define GST_DATA(data) ((GstData*)(data)) |
Cast a pointer to a GstData
GST_DATA_TYPE()
#define GST_DATA_TYPE(data) (GST_DATA(data)->type) |
Get the type of the GstData
GST_DATA_FLAGS()
#define GST_DATA_FLAGS(data) (GST_DATA(data)->flags) |
Get the flags of this GstData
GST_DATA_FLAG_SHIFT()
#define GST_DATA_FLAG_SHIFT(flag) (1<<(flag)) |
Shift a given flag so that it can be used in an or operation
GST_DATA_FLAG_IS_SET()
#define GST_DATA_FLAG_IS_SET(data,flag) (GST_DATA_FLAGS(data) & (1<<(flag))) |
Check if a given flag is set on the data
GST_DATA_FLAG_SET()
#define GST_DATA_FLAG_SET(data,flag) G_STMT_START{ (GST_DATA_FLAGS(data) |= (1<<(flag))); }G_STMT_END |
Set the flag on the data
GST_DATA_FLAG_UNSET()
#define GST_DATA_FLAG_UNSET(data,flag) G_STMT_START{ (GST_DATA_FLAGS(data) &= ~(1<<(flag))); }G_STMT_END |
Unset the given flag
struct GstData
struct GstData {
GType type;
/* refcounting */
GstAtomicInt refcount;
guint16 flags;
/* utility function pointers, can override default */
GstDataFreeFunction free; /* free the data */
GstDataCopyFunction copy; /* copy the data */
}; |
The base structure
GstDataFreeFunction ()
void (*GstDataFreeFunction) (GstData *data); |
The signature of the free function. Subclasses should provide a free function
with this signature and pass it in the gst_data_init() function.
GstDataCopyFunction ()
The signature of the copy function. Subclasses should provide a copy function
with this signature and pass it in the gst_data_init() function.
enum GstDataFlags
typedef enum
{
GST_DATA_READONLY = 1,
/* insert more */
GST_DATA_FLAG_LAST = 8
} GstDataFlags; |
Various flags that can be set on a GstData
GST_DATA_IS_READONLY()
#define GST_DATA_IS_READONLY(data) (GST_DATA_FLAG_IS_SET((data), GST_DATA_READONLY)) |
Query if the GstData is READONLY
GST_DATA_REFCOUNT()
#define GST_DATA_REFCOUNT(data) ((GST_DATA(data))->refcount) |
Get access to the refcount field of the GstData
GST_DATA_REFCOUNT_VALUE()
#define GST_DATA_REFCOUNT_VALUE(data) (GST_ATOMIC_INT_VALUE((&GST_DATA_REFCOUNT (data)))) |
Get the current refcount value
GST_DATA_REFCOUNT_READ()
#define GST_DATA_REFCOUNT_READ(data,value) (GST_ATOMIC_INT_READ(&(GST_DATA_REFCOUNT (data)),value) |
Read the current refcount value into the specified value
GST_DATA_COPY_FUNC()
#define GST_DATA_COPY_FUNC(data) (GST_DATA(data)->copy) |
Get access to the copy function of the data
GST_DATA_FREE_FUNC()
#define GST_DATA_FREE_FUNC(data) (GST_DATA(data)->free) |
Get access to the free function of the data
gst_data_init ()
Initialize the given data structure with the given parameters. The free and copy
function will be called when this data is freed or copied respectively.
gst_data_dispose ()
void gst_data_dispose (GstData *data); |
Free all the resources allocated in the gst_data_init() function,
mainly used by subclass implementors.
gst_data_copy_into ()
Copy the GstData into the specified target GstData structure.
Thos method is mainly used by subclasses when they want to copy
the relevant GstData info.
gst_data_copy ()
Copies the given GstData. This function will call the custom subclass
copy function or return NULL if no function was provided by the subclass.
gst_data_copy_on_write ()
Copies the given GstData if the refcount is greater than 1 so that the
GstData object can be written to safely.
gst_data_free ()
void gst_data_free (GstData *data); |
Frees the given GstData. This function will call the custom free function
provided by the subclass.
gst_data_ref ()
Increments the reference count of this data.
gst_data_ref_by_count ()
Increments the reference count of this data by the given number.
gst_data_unref ()
void gst_data_unref (GstData *data); |
Decrements the refcount of this data. If the refcount is
zero, the data will be freeed.