X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gst%2Fgstmeta.h;h=d6aaa67e932c36d65637018961cfac4188678e28;hb=eb9c8bdf66695d5ad5271ea5936ce4dd4076bbdb;hp=05c0493026a560a677ec055bfaaa7c34f4735ed1;hpb=1fbcc71dbdff79d70b0abe1285f694f3d4596564;p=platform%2Fupstream%2Fgstreamer.git diff --git a/gst/gstmeta.h b/gst/gstmeta.h index 05c0493..d6aaa67 100644 --- a/gst/gstmeta.h +++ b/gst/gstmeta.h @@ -15,14 +15,17 @@ * * 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 +#include + G_BEGIN_DECLS typedef struct _GstMeta GstMeta; @@ -34,8 +37,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 +47,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; @@ -81,6 +85,15 @@ typedef enum { #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 @@ -115,20 +128,28 @@ typedef void (*GstMetaFreeFunction) (GstMeta *meta, GstBuffer *buffer); /** * gst_meta_transform_copy: * - * GQuark for the "copy" transform. + * GQuark for the "gst-copy" transform. */ GST_EXPORT GQuark _gst_meta_transform_copy; +/** + * GST_META_TRANSFORM_IS_COPY: + * @type: a transform type + * + * Check if the transform type is a copy transform + */ #define GST_META_TRANSFORM_IS_COPY(type) ((type) == _gst_meta_transform_copy) /** - * GstMetaTransformDataCopy: - * @offset: the offset to copy - * @size: the size to 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 "copy" transform #GstMetaTransformFunction. + * Extra data passed to a "gst-copy" transform #GstMetaTransformFunction. */ typedef struct { + gboolean region; gsize offset; gsize size; } GstMetaTransformCopy; @@ -148,15 +169,17 @@ typedef struct { * 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, - GQuark type, 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 @@ -166,7 +189,7 @@ typedef void (*GstMetaTransformFunction) (GstBuffer *transbuf, * structure. */ struct _GstMetaInfo { - GQuark api; + GType api; GType type; gsize size; @@ -174,16 +197,38 @@ struct _GstMetaInfo { GstMetaFreeFunction free_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, - GstMetaTransformFunction transform_func); -const GstMetaInfo * gst_meta_get_info (const gchar * impl); +GType gst_meta_api_type_register (const gchar *api, + const gchar **tags); +gboolean gst_meta_api_type_has_tag (GType api, GQuark tag); + +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); +const gchar* const* gst_meta_api_type_get_tags (GType api); + +/* some default tags */ +GST_EXPORT 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