| GStreamer 1.0 Core Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
#include <gst/gst.h> struct GstMeta; enum GstMetaFlags; #define GST_META_FLAGS (meta) #define GST_META_FLAG_IS_SET (meta, flag) #define GST_META_FLAG_SET (meta, flag) #define GST_META_FLAG_UNSET (meta, flag) struct GstMetaInfo; gboolean (*GstMetaInitFunction) (GstMeta *meta,gpointer params,GstBuffer *buffer); void (*GstMetaFreeFunction) (GstMeta *meta,GstBuffer *buffer); gboolean (*GstMetaTransformFunction) (GstBuffer *transbuf,GstMeta *meta,GstBuffer *buffer,GQuark type,gpointer data); GstMetaTransformCopy; #define GST_META_TRANSFORM_IS_COPY (type) GType gst_meta_api_type_register (const gchar *api,const gchar **tags); gboolean gst_meta_api_type_has_tag (GType api,GQuark tag); #define GST_META_TAG_MEMORY const GstMetaInfo * gst_meta_register (GType api,const gchar *impl,gsize size,GstMetaInitFunction init_func,GstMetaFreeFunction free_func,GstMetaTransformFunction transform_func); const GstMetaInfo * gst_meta_get_info (const gchar *impl);
The GstMeta structure should be included as the first member of a GstBuffer metadata structure. The structure defines the API of the metadata and should be accessible to all elements using the metadata.
A metadata API is registered with gst_meta_api_type_register() which takes a
name for the metadata API and some tags associated with the metadata.
With gst_meta_api_type_has_tag() one can check if a certain metadata API
contains a given tag.
Multiple implementations of a metadata API can be registered.
To implement a metadata API, gst_meta_register() should be used. This
function takes all parameters needed to create, free and transform metadata
along with the size of the metadata. The function returns a GstMetaInfo
structure that contains the information for the implementation of the API.
A specific implementation can be retrieved by name with gst_meta_get_info().
See GstBuffer for how the metadata can be added, retrieved and removed from buffers.
Last reviewed on 2012-03-28 (0.11.3)
struct GstMeta {
GstMetaFlags flags;
const GstMetaInfo *info;
};
Base structure for metadata. Custom metadata will put this structure as the first member of their structure.
GstMetaFlags |
extra flags for the metadata |
const GstMetaInfo * |
pointer to the GstMetaInfo |
typedef enum {
GST_META_FLAG_NONE = 0,
GST_META_FLAG_READONLY = (1 << 0),
GST_META_FLAG_POOLED = (1 << 1),
GST_META_FLAG_LOCKED = (1 << 2),
GST_META_FLAG_LAST = (1 << 16)
} GstMetaFlags;
Extra metadata flags.
#define GST_META_FLAGS(meta) (GST_META_CAST (meta)->flags)
A flags word containing GstMetaFlags flags set on meta
|
a GstMeta. |
#define GST_META_FLAG_IS_SET(meta,flag) !!(GST_META_FLAGS (meta) & (flag))
Gives the status of a specific flag on a metadata.
|
a GstMeta. |
|
the GstMetaFlags to check. |
#define GST_META_FLAG_SET(meta,flag) (GST_META_FLAGS (meta) |= (flag))
Sets a metadata flag on a metadata.
|
a GstMeta. |
|
the GstMetaFlags to set. |
#define GST_META_FLAG_UNSET(meta,flag) (GST_META_FLAGS (meta) &= ~(flag))
Clears a metadata flag.
|
a GstMeta. |
|
the GstMetaFlags to clear. |
struct GstMetaInfo {
GType api;
GType type;
gsize size;
GstMetaInitFunction init_func;
GstMetaFreeFunction free_func;
GstMetaTransformFunction transform_func;
};
The GstMetaInfo provides information about a specific metadata structure.
GType |
tag indentifying the metadata structure and api |
GType |
type indentifying the implementor of the api |
| size of the metadata | |
GstMetaInitFunction |
function for initializing the metadata |
GstMetaFreeFunction |
function for freeing the metadata |
GstMetaTransformFunction |
function for transforming the metadata |
gboolean (*GstMetaInitFunction) (GstMeta *meta,gpointer params,GstBuffer *buffer);
Function called when meta is initialized in buffer.
void (*GstMetaFreeFunction) (GstMeta *meta,GstBuffer *buffer);
Function called when meta is freed in buffer.
gboolean (*GstMetaTransformFunction) (GstBuffer *transbuf,GstMeta *meta,GstBuffer *buffer,GQuark type,gpointer data);
Function called for each meta in buffer as a result of performing a
transformation on transbuf. Additional type specific transform data
is passed to the function as data.
Implementations should check the type of the transform and parse
additional type specific fields in data that should be used to update
the metadata on transbuf.
typedef struct {
gboolean region;
gsize offset;
gsize size;
} GstMetaTransformCopy;
Extra data passed to a "gst-copy" transform GstMetaTransformFunction.
#define GST_META_TRANSFORM_IS_COPY(type) ((type) == _gst_meta_transform_copy)
Check if the transform type is a copy transform
|
a transform type |
GType gst_meta_api_type_register (const gchar *api,const gchar **tags);
Register and return a GType for the api and associate it with
tags.
|
an API to register |
|
tags for api
|
Returns : |
a unique GType for api. |
gboolean gst_meta_api_type_has_tag (GType api,GQuark tag);
Check if api was registered with tag.
|
an API |
|
the tag to check |
Returns : |
TRUE if api was registered with tag. |
#define GST_META_TAG_MEMORY (_gst_meta_tag_memory)
Metadata tagged with this tag depends on the particular memory or buffer that it is on.
const GstMetaInfo * gst_meta_register (GType api,const gchar *impl,gsize size,GstMetaInitFunction init_func,GstMetaFreeFunction free_func,GstMetaTransformFunction transform_func);
Register a new GstMeta implementation.
The same info can be retrieved later with gst_meta_get_info() by using
impl as the key.
|
the type of the GstMeta API |
|
the name of the GstMeta implementation |
|
the size of the GstMeta structure |
|
(scope async) a GstMetaInitFunction |
|
(scope async) a GstMetaFreeFunction |
|
(scope async) a GstMetaTransformFunction |
Returns : |
a GstMetaInfo that can be used to access metadata. [transfer none] |
const GstMetaInfo * gst_meta_get_info (const gchar *impl);
Lookup a previously registered meta info structure by its implementation name
impl.
|
the name |
Returns : |
a GstMetaInfo with impl, or NULL when no such
metainfo exists. [transfer none]
|