2 * Copyright (C) 2009 Wim Taymans <wim.taymans@gmail.be>
4 * gstmeta.h: Header for Metadata structures
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
23 #ifndef __GST_META_H__
24 #define __GST_META_H__
28 typedef struct _GstMeta GstMeta;
29 typedef struct _GstMetaInfo GstMetaInfo;
33 * @info: pointer to the #GstMetaInfo
35 * Base structure for metadata. Custom metadata will put this structure
36 * as the first member of their structure.
39 const GstMetaInfo *info;
43 * GST_META_TRACE_NAME:
45 * The name used for tracing memory allocations.
47 #define GST_META_TRACE_NAME "GstMeta"
50 * GstMetaInitFunction:
52 * @params: parameters passed to the init function
53 * @buffer: a #GstBuffer
55 * Function called when @meta is initialized in @buffer.
57 typedef gboolean (*GstMetaInitFunction) (GstMeta *meta, gpointer params, GstBuffer *buffer);
60 * GstMetaFreeFunction:
62 * @buffer: a #GstBuffer
64 * Function called when @meta is freed in @buffer.
66 typedef void (*GstMetaFreeFunction) (GstMeta *meta, GstBuffer *buffer);
69 * GstMetaCopyFunction:
70 * @dest: a destination #GstBuffer
72 * @buffer: a #GstBuffer
76 * Function called when the region at @offset and @size in @buffer is copied
77 * into @dest. The function should update the metadata on @dest using @meta.
79 typedef void (*GstMetaCopyFunction) (GstBuffer *dest, GstMeta *meta,
80 GstBuffer *buffer, gsize offset, gsize size);
82 * GstMetaTransformFunction:
83 * @transbuf: a #GstBuffer
85 * @buffer: a #GstBuffer
86 * @data: transform specific data.
88 * Function called for each @meta in @buffer as a result of performing a
89 * transformation on @transbuf. Additional type specific transform data
90 * is passed to the function.
92 * Implementations should check the type of the transform @data and parse
93 * additional type specific field that should be used to perform the transform.
95 typedef void (*GstMetaTransformFunction) (GstBuffer *transbuf, GstMeta *meta,
96 GstBuffer *buffer, gpointer data);
100 * @api: tag indentifying the metadata structure and api
101 * @type: type indentifying the implementor of the api
102 * @size: size of the metadata
103 * @init_func: function for initializing the metadata
104 * @free_func: function for freeing the metadata
105 * @copy_func: function for copying the metadata
106 * @transform_func: function for transforming the metadata
108 * The #GstMetaInfo provides information about a specific metadata
111 struct _GstMetaInfo {
116 GstMetaInitFunction init_func;
117 GstMetaFreeFunction free_func;
118 GstMetaCopyFunction copy_func;
119 GstMetaTransformFunction transform_func;
122 gpointer _gst_reserved[GST_PADDING];
125 const GstMetaInfo * gst_meta_register (const gchar *api, const gchar *impl,
127 GstMetaInitFunction init_func,
128 GstMetaFreeFunction free_func,
129 GstMetaCopyFunction copy_func,
130 GstMetaTransformFunction transform_func);
131 const GstMetaInfo * gst_meta_get_info (const gchar * impl);
135 #endif /* __GST_META_H__ */