|
Packit Service |
963350 |
/* GStreamer
|
|
Packit Service |
963350 |
* Copyright (C) 2009 Wim Taymans <wim.taymans@gmail.be>
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* gstmeta.h: Header for Metadata structures
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* This library is free software; you can redistribute it and/or
|
|
Packit Service |
963350 |
* modify it under the terms of the GNU Library General Public
|
|
Packit Service |
963350 |
* License as published by the Free Software Foundation; either
|
|
Packit Service |
963350 |
* version 2 of the License, or (at your option) any later version.
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* This library is distributed in the hope that it will be useful,
|
|
Packit Service |
963350 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
963350 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
963350 |
* Library General Public License for more details.
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* You should have received a copy of the GNU Library General Public
|
|
Packit Service |
963350 |
* License along with this library; if not, write to the
|
|
Packit Service |
963350 |
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
Packit Service |
963350 |
* Boston, MA 02110-1301, USA.
|
|
Packit Service |
963350 |
*/
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
#ifndef __GST_META_H__
|
|
Packit Service |
963350 |
#define __GST_META_H__
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
#include <glib.h>
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
G_BEGIN_DECLS
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
typedef struct _GstMeta GstMeta;
|
|
Packit Service |
963350 |
typedef struct _GstMetaInfo GstMetaInfo;
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
#define GST_META_CAST(meta) ((GstMeta *)(meta))
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
/**
|
|
Packit Service |
963350 |
* GstMetaFlags:
|
|
Packit Service |
963350 |
* @GST_META_FLAG_NONE: no flags
|
|
Packit Service |
963350 |
* @GST_META_FLAG_READONLY: metadata should not be modified
|
|
Packit Service |
963350 |
* @GST_META_FLAG_POOLED: metadata is managed by a bufferpool
|
|
Packit Service |
963350 |
* @GST_META_FLAG_LOCKED: metadata should not be removed
|
|
Packit Service |
963350 |
* @GST_META_FLAG_LAST: additional flags can be added starting from this flag.
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* Extra metadata flags.
|
|
Packit Service |
963350 |
*/
|
|
Packit Service |
963350 |
typedef enum {
|
|
Packit Service |
963350 |
GST_META_FLAG_NONE = 0,
|
|
Packit Service |
963350 |
GST_META_FLAG_READONLY = (1 << 0),
|
|
Packit Service |
963350 |
GST_META_FLAG_POOLED = (1 << 1),
|
|
Packit Service |
963350 |
GST_META_FLAG_LOCKED = (1 << 2),
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
GST_META_FLAG_LAST = (1 << 16)
|
|
Packit Service |
963350 |
} GstMetaFlags;
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
/**
|
|
Packit Service |
963350 |
* GST_META_FLAGS:
|
|
Packit Service |
963350 |
* @meta: a #GstMeta.
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* A flags word containing #GstMetaFlags flags set on @meta
|
|
Packit Service |
963350 |
*/
|
|
Packit Service |
963350 |
#define GST_META_FLAGS(meta) (GST_META_CAST (meta)->flags)
|
|
Packit Service |
963350 |
/**
|
|
Packit Service |
963350 |
* GST_META_FLAG_IS_SET:
|
|
Packit Service |
963350 |
* @meta: a #GstMeta.
|
|
Packit Service |
963350 |
* @flag: the #GstMetaFlags to check.
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* Gives the status of a specific flag on a metadata.
|
|
Packit Service |
963350 |
*/
|
|
Packit Service |
963350 |
#define GST_META_FLAG_IS_SET(meta,flag) !!(GST_META_FLAGS (meta) & (flag))
|
|
Packit Service |
963350 |
/**
|
|
Packit Service |
963350 |
* GST_META_FLAG_SET:
|
|
Packit Service |
963350 |
* @meta: a #GstMeta.
|
|
Packit Service |
963350 |
* @flag: the #GstMetaFlags to set.
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* Sets a metadata flag on a metadata.
|
|
Packit Service |
963350 |
*/
|
|
Packit Service |
963350 |
#define GST_META_FLAG_SET(meta,flag) (GST_META_FLAGS (meta) |= (flag))
|
|
Packit Service |
963350 |
/**
|
|
Packit Service |
963350 |
* GST_META_FLAG_UNSET:
|
|
Packit Service |
963350 |
* @meta: a #GstMeta.
|
|
Packit Service |
963350 |
* @flag: the #GstMetaFlags to clear.
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* Clears a metadata flag.
|
|
Packit Service |
963350 |
*/
|
|
Packit Service |
963350 |
#define GST_META_FLAG_UNSET(meta,flag) (GST_META_FLAGS (meta) &= ~(flag))
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
/**
|
|
Packit Service |
963350 |
* GST_META_TAG_MEMORY_STR:
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* This metadata stays relevant as long as memory layout is unchanged.
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* Since: 1.2
|
|
Packit Service |
963350 |
*/
|
|
Packit Service |
963350 |
#define GST_META_TAG_MEMORY_STR "memory"
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
/**
|
|
Packit Service |
963350 |
* GstMeta:
|
|
Packit Service |
963350 |
* @flags: extra flags for the metadata
|
|
Packit Service |
963350 |
* @info: pointer to the #GstMetaInfo
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* Base structure for metadata. Custom metadata will put this structure
|
|
Packit Service |
963350 |
* as the first member of their structure.
|
|
Packit Service |
963350 |
*/
|
|
Packit Service |
963350 |
struct _GstMeta {
|
|
Packit Service |
963350 |
GstMetaFlags flags;
|
|
Packit Service |
963350 |
const GstMetaInfo *info;
|
|
Packit Service |
963350 |
};
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
#include <gst/gstbuffer.h>
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
/**
|
|
Packit Service |
963350 |
* GstMetaInitFunction:
|
|
Packit Service |
963350 |
* @meta: a #GstMeta
|
|
Packit Service |
963350 |
* @params: parameters passed to the init function
|
|
Packit Service |
963350 |
* @buffer: a #GstBuffer
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* Function called when @meta is initialized in @buffer.
|
|
Packit Service |
963350 |
*/
|
|
Packit Service |
963350 |
typedef gboolean (*GstMetaInitFunction) (GstMeta *meta, gpointer params, GstBuffer *buffer);
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
/**
|
|
Packit Service |
963350 |
* GstMetaFreeFunction:
|
|
Packit Service |
963350 |
* @meta: a #GstMeta
|
|
Packit Service |
963350 |
* @buffer: a #GstBuffer
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* Function called when @meta is freed in @buffer.
|
|
Packit Service |
963350 |
*/
|
|
Packit Service |
963350 |
typedef void (*GstMetaFreeFunction) (GstMeta *meta, GstBuffer *buffer);
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
/**
|
|
Packit Service |
963350 |
* gst_meta_transform_copy:
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* GQuark for the "gst-copy" transform.
|
|
Packit Service |
963350 |
*/
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
GST_API GQuark _gst_meta_transform_copy;
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
/**
|
|
Packit Service |
963350 |
* GST_META_TRANSFORM_IS_COPY:
|
|
Packit Service |
963350 |
* @type: a transform type
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* Check if the transform type is a copy transform
|
|
Packit Service |
963350 |
*/
|
|
Packit Service |
963350 |
#define GST_META_TRANSFORM_IS_COPY(type) ((type) == _gst_meta_transform_copy)
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
/**
|
|
Packit Service |
963350 |
* GstMetaTransformCopy:
|
|
Packit Service |
963350 |
* @region: %TRUE if only region is copied
|
|
Packit Service |
963350 |
* @offset: the offset to copy, 0 if @region is %FALSE, otherwise > 0
|
|
Packit Service |
963350 |
* @size: the size to copy, -1 or the buffer size when @region is %FALSE
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* Extra data passed to a "gst-copy" transform #GstMetaTransformFunction.
|
|
Packit Service |
963350 |
*/
|
|
Packit Service |
963350 |
typedef struct {
|
|
Packit Service |
963350 |
gboolean region;
|
|
Packit Service |
963350 |
gsize offset;
|
|
Packit Service |
963350 |
gsize size;
|
|
Packit Service |
963350 |
} GstMetaTransformCopy;
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
/**
|
|
Packit Service |
963350 |
* GstMetaTransformFunction:
|
|
Packit Service |
963350 |
* @transbuf: a #GstBuffer
|
|
Packit Service |
963350 |
* @meta: a #GstMeta
|
|
Packit Service |
963350 |
* @buffer: a #GstBuffer
|
|
Packit Service |
963350 |
* @type: the transform type
|
|
Packit Service |
963350 |
* @data: transform specific data.
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* Function called for each @meta in @buffer as a result of performing a
|
|
Packit Service |
963350 |
* transformation on @transbuf. Additional @type specific transform data
|
|
Packit Service |
963350 |
* is passed to the function as @data.
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* Implementations should check the @type of the transform and parse
|
|
Packit Service |
963350 |
* additional type specific fields in @data that should be used to update
|
|
Packit Service |
963350 |
* the metadata on @transbuf.
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* Returns: %TRUE if the transform could be performed
|
|
Packit Service |
963350 |
*/
|
|
Packit Service |
963350 |
typedef gboolean (*GstMetaTransformFunction) (GstBuffer *transbuf,
|
|
Packit Service |
963350 |
GstMeta *meta, GstBuffer *buffer,
|
|
Packit Service |
963350 |
GQuark type, gpointer data);
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
/**
|
|
Packit Service |
963350 |
* GstMetaInfo:
|
|
Packit Service |
963350 |
* @api: tag identifying the metadata structure and api
|
|
Packit Service |
963350 |
* @type: type identifying the implementor of the api
|
|
Packit Service |
963350 |
* @size: size of the metadata
|
|
Packit Service |
963350 |
* @init_func: function for initializing the metadata
|
|
Packit Service |
963350 |
* @free_func: function for freeing the metadata
|
|
Packit Service |
963350 |
* @transform_func: function for transforming the metadata
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* The #GstMetaInfo provides information about a specific metadata
|
|
Packit Service |
963350 |
* structure.
|
|
Packit Service |
963350 |
*/
|
|
Packit Service |
963350 |
struct _GstMetaInfo {
|
|
Packit Service |
963350 |
GType api;
|
|
Packit Service |
963350 |
GType type;
|
|
Packit Service |
963350 |
gsize size;
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
GstMetaInitFunction init_func;
|
|
Packit Service |
963350 |
GstMetaFreeFunction free_func;
|
|
Packit Service |
963350 |
GstMetaTransformFunction transform_func;
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
/* No padding needed, GstMetaInfo is always allocated by GStreamer and is
|
|
Packit Service |
963350 |
* not subclassable or stack-allocatable, so we can extend it as we please
|
|
Packit Service |
963350 |
* just like interfaces */
|
|
Packit Service |
963350 |
};
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
GST_API
|
|
Packit Service |
963350 |
GType gst_meta_api_type_register (const gchar *api,
|
|
Packit Service |
963350 |
const gchar **tags);
|
|
Packit Service |
963350 |
GST_API
|
|
Packit Service |
963350 |
gboolean gst_meta_api_type_has_tag (GType api, GQuark tag);
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
GST_API
|
|
Packit Service |
963350 |
const GstMetaInfo * gst_meta_register (GType api, const gchar *impl,
|
|
Packit Service |
963350 |
gsize size,
|
|
Packit Service |
963350 |
GstMetaInitFunction init_func,
|
|
Packit Service |
963350 |
GstMetaFreeFunction free_func,
|
|
Packit Service |
963350 |
GstMetaTransformFunction transform_func);
|
|
Packit Service |
963350 |
GST_API
|
|
Packit Service |
963350 |
const GstMetaInfo * gst_meta_get_info (const gchar * impl);
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
GST_API
|
|
Packit Service |
963350 |
const gchar* const* gst_meta_api_type_get_tags (GType api);
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
/* some default tags */
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
GST_API GQuark _gst_meta_tag_memory;
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
/**
|
|
Packit Service |
963350 |
* GST_META_TAG_MEMORY:
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* Metadata tagged with this tag depends on the particular memory
|
|
Packit Service |
963350 |
* or buffer that it is on.
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* Deprecated: The GQuarks are not exported by any public API, use
|
|
Packit Service |
963350 |
* GST_META_TAG_MEMORY_STR instead.
|
|
Packit Service |
963350 |
*/
|
|
Packit Service |
963350 |
#ifndef GST_DISABLE_DEPRECATED
|
|
Packit Service |
963350 |
#define GST_META_TAG_MEMORY (_gst_meta_tag_memory)
|
|
Packit Service |
963350 |
#endif
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
G_END_DECLS
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
#endif /* __GST_META_H__ */
|