X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gst%2Fgstmeta.h;h=d617ef8b799aa2de2245f6a10becdd3df6c2d834;hb=706e10ad0586bf98c829cdfaa079118447b94ef5;hp=7f786b6815edc09b44cce55008799c194f04da82;hpb=81ce8b76d0b31c130ea4a49ea10eb7718490ba6e;p=platform%2Fupstream%2Fgstreamer.git diff --git a/gst/gstmeta.h b/gst/gstmeta.h index 7f786b6..d617ef8 100644 --- a/gst/gstmeta.h +++ b/gst/gstmeta.h @@ -15,14 +15,16 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. */ #ifndef __GST_META_H__ #define __GST_META_H__ +#include + G_BEGIN_DECLS typedef struct _GstMeta GstMeta; @@ -34,8 +36,8 @@ typedef struct _GstMetaInfo GstMetaInfo; * GstMetaFlags: * @GST_META_FLAG_NONE: no flags * @GST_META_FLAG_READONLY: metadata should not be modified - * @GST_META_FLAG_POOLED: metadata is managed by a bufferpool and should not - * be removed + * @GST_META_FLAG_POOLED: metadata is managed by a bufferpool + * @GST_META_FLAG_LOCKED: metadata should not be removed * @GST_META_FLAG_LAST: additional flags can be added starting from this flag. * * Extra metadata flags. @@ -44,6 +46,7 @@ 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; @@ -52,13 +55,13 @@ typedef enum { * GST_META_FLAGS: * @meta: a #GstMeta. * - * A flags word containing #GstMetaFlag flags set on @meta + * A flags word containing #GstMetaFlags flags set on @meta */ #define GST_META_FLAGS(meta) (GST_META_CAST (meta)->flags) /** * GST_META_FLAG_IS_SET: * @meta: a #GstMeta. - * @flag: the #GstMetaFlag to check. + * @flag: the #GstMetaFlags to check. * * Gives the status of a specific flag on a metadata. */ @@ -66,7 +69,7 @@ typedef enum { /** * GST_META_FLAG_SET: * @meta: a #GstMeta. - * @flag: the #GstMetaFlag to set. + * @flag: the #GstMetaFlags to set. * * Sets a metadata flag on a metadata. */ @@ -74,13 +77,22 @@ typedef enum { /** * GST_META_FLAG_UNSET: * @meta: a #GstMeta. - * @flag: the #GstMetaFlag to clear. + * @flag: the #GstMetaFlags to clear. * * Clears a metadata flag. */ #define GST_META_FLAG_UNSET(meta,flag) (GST_META_FLAGS (meta) &= ~(flag)) /** + * GST_META_TAG_MEMORY_STR: + * + * This metadata stays relevant as long as memory layout is unchanged. + * + * Since: 1.2 + */ +#define GST_META_TAG_MEMORY_STR "memory" + +/** * GstMeta: * @flags: extra flags for the metadata * @info: pointer to the #GstMetaInfo @@ -93,12 +105,7 @@ struct _GstMeta { const GstMetaInfo *info; }; -/** - * GST_META_TRACE_NAME: - * - * The name used for tracing memory allocations. - */ -#define GST_META_TRACE_NAME "GstMeta" +#include /** * GstMetaInitFunction: @@ -120,69 +127,124 @@ typedef gboolean (*GstMetaInitFunction) (GstMeta *meta, gpointer params, GstBuff typedef void (*GstMetaFreeFunction) (GstMeta *meta, GstBuffer *buffer); /** - * GstMetaCopyFunction: - * @dest: a destination #GstBuffer - * @meta: a #GstMeta - * @buffer: a #GstBuffer - * @offset: an offset - * @size: a size + * gst_meta_transform_copy: + * + * GQuark for the "gst-copy" transform. + */ + +GST_API GQuark _gst_meta_transform_copy; + +/** + * GST_META_TRANSFORM_IS_COPY: + * @type: a transform type * - * Function called when the region at @offset and @size in @buffer is copied - * into @dest. The function should update the metadata on @dest using @meta. + * Check if the transform type is a copy transform */ -typedef void (*GstMetaCopyFunction) (GstBuffer *dest, GstMeta *meta, - GstBuffer *buffer, gsize offset, gsize size); +#define GST_META_TRANSFORM_IS_COPY(type) ((type) == _gst_meta_transform_copy) + +/** + * GstMetaTransformCopy: + * @region: %TRUE if only region is copied + * @offset: the offset to copy, 0 if @region is %FALSE, otherwise > 0 + * @size: the size to copy, -1 or the buffer size when @region is %FALSE + * + * Extra data passed to a "gst-copy" transform #GstMetaTransformFunction. + */ +typedef struct { + gboolean region; + gsize offset; + gsize size; +} GstMetaTransformCopy; + /** * GstMetaTransformFunction: * @transbuf: a #GstBuffer * @meta: a #GstMeta * @buffer: a #GstBuffer + * @type: the transform type * @data: transform specific 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. + * transformation on @transbuf. Additional @type specific transform data + * is passed to the function as @data. * - * Implementations should check the type of the transform @data and parse - * additional type specific field that should be used to perform the transform. + * 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. + * + * Returns: %TRUE if the transform could be performed */ -typedef void (*GstMetaTransformFunction) (GstBuffer *transbuf, GstMeta *meta, - GstBuffer *buffer, gpointer data); +typedef gboolean (*GstMetaTransformFunction) (GstBuffer *transbuf, + GstMeta *meta, GstBuffer *buffer, + GQuark type, gpointer data); /** * GstMetaInfo: - * @api: tag indentifying the metadata structure and api - * @type: type indentifying the implementor of the api + * @api: tag identifying the metadata structure and api + * @type: type identifying the implementor of the api * @size: size of the metadata * @init_func: function for initializing the metadata * @free_func: function for freeing the metadata - * @copy_func: function for copying the metadata * @transform_func: function for transforming the metadata * * The #GstMetaInfo provides information about a specific metadata * structure. */ struct _GstMetaInfo { - GQuark api; + GType api; GType type; gsize size; GstMetaInitFunction init_func; GstMetaFreeFunction free_func; - GstMetaCopyFunction copy_func; GstMetaTransformFunction transform_func; - /*< private >*/ - gpointer _gst_reserved[GST_PADDING]; + /* No padding needed, GstMetaInfo is always allocated by GStreamer and is + * not subclassable or stack-allocatable, so we can extend it as we please + * just like interfaces */ }; -const GstMetaInfo * gst_meta_register (const gchar *api, const gchar *impl, - gsize size, - GstMetaInitFunction init_func, - GstMetaFreeFunction free_func, - GstMetaCopyFunction copy_func, - GstMetaTransformFunction transform_func); -const GstMetaInfo * gst_meta_get_info (const gchar * impl); +GST_API +GType gst_meta_api_type_register (const gchar *api, + const gchar **tags); +GST_API +gboolean gst_meta_api_type_has_tag (GType api, GQuark tag); + +GST_API +const GstMetaInfo * gst_meta_register (GType api, const gchar *impl, + gsize size, + GstMetaInitFunction init_func, + GstMetaFreeFunction free_func, + GstMetaTransformFunction transform_func); +GST_API +const GstMetaInfo * gst_meta_get_info (const gchar * impl); + +GST_API +const gchar* const* gst_meta_api_type_get_tags (GType api); + +GST_API +guint64 gst_meta_get_seqnum (const GstMeta * meta); + +GST_API +gint gst_meta_compare_seqnum (const GstMeta * meta1, + const GstMeta * meta2); + +/* some default tags */ + +GST_API GQuark _gst_meta_tag_memory; + +/** + * GST_META_TAG_MEMORY: + * + * Metadata tagged with this tag depends on the particular memory + * or buffer that it is on. + * + * Deprecated: The GQuarks are not exported by any public API, use + * GST_META_TAG_MEMORY_STR instead. + */ +#ifndef GST_DISABLE_DEPRECATED +#define GST_META_TAG_MEMORY (_gst_meta_tag_memory) +#endif G_END_DECLS