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);
68 typedef void (*GstMetaCopyFunction) (GstBuffer *dest, GstMeta *meta,
69 GstBuffer *buffer, gsize offset, gsize size);
71 * GstMetaTransformFunction:
72 * @transbuf: a #GstBuffer
74 * @buffer: a #GstBuffer
75 * @data: transform specific data.
77 * Function called for each @meta in @buffer as a result of performing a
78 * transformation on @transbuf. Additional type specific transform data
79 * is passed to the function.
81 * Implementations should check the type of the transform @data and parse
82 * additional type specific field that should be used to perform the transform.
84 typedef void (*GstMetaTransformFunction) (GstBuffer *transbuf, GstMeta *meta,
85 GstBuffer *buffer, gpointer data);
89 * @api: tag indentifying the metadata structure and api
90 * @type: type indentifying the implementor of the api
91 * @size: size of the metadata
92 * @init_func: function for initializing the metadata
93 * @free_func: function for freeing the metadata
94 * @copy_func: function for copying the metadata
95 * @transform_func: function for transforming the metadata
97 * The #GstMetaInfo provides information about a specific metadata
100 struct _GstMetaInfo {
105 GstMetaInitFunction init_func;
106 GstMetaFreeFunction free_func;
107 GstMetaCopyFunction copy_func;
108 GstMetaTransformFunction transform_func;
111 const GstMetaInfo * gst_meta_register (const gchar *api, const gchar *impl,
113 GstMetaInitFunction init_func,
114 GstMetaFreeFunction free_func,
115 GstMetaCopyFunction copy_func,
116 GstMetaTransformFunction transform_func);
117 const GstMetaInfo * gst_meta_get_info (const gchar * impl);
121 #endif /* __GST_META_H__ */