1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gstreamer.Meta;
26 
27 private import glib.Str;
28 private import glib.c.functions;
29 private import gstreamer.c.functions;
30 public  import gstreamer.c.types;
31 public  import gstreamerc.gstreamertypes;
32 private import gtkd.Loader;
33 
34 
35 /**
36  * The #GstMeta structure should be included as the first member of a #GstBuffer
37  * metadata structure. The structure defines the API of the metadata and should
38  * be accessible to all elements using the metadata.
39  * 
40  * A metadata API is registered with gst_meta_api_type_register() which takes a
41  * name for the metadata API and some tags associated with the metadata.
42  * With gst_meta_api_type_has_tag() one can check if a certain metadata API
43  * contains a given tag.
44  * 
45  * Multiple implementations of a metadata API can be registered.
46  * To implement a metadata API, gst_meta_register() should be used. This
47  * function takes all parameters needed to create, free and transform metadata
48  * along with the size of the metadata. The function returns a #GstMetaInfo
49  * structure that contains the information for the implementation of the API.
50  * 
51  * A specific implementation can be retrieved by name with gst_meta_get_info().
52  * 
53  * See #GstBuffer for how the metadata can be added, retrieved and removed from
54  * buffers.
55  */
56 public struct Meta
57 {
58 
59 	/**
60 	 *
61 	 * Params:
62 	 *     api = an API
63 	 * Returns: an array of tags as strings.
64 	 *
65 	 * Since: 1.2
66 	 */
67 	public static string[] apiTypeGetTags(GType api)
68 	{
69 		return Str.toStringArray(gst_meta_api_type_get_tags(api));
70 	}
71 
72 	/**
73 	 * Check if @api was registered with @tag.
74 	 *
75 	 * Params:
76 	 *     api = an API
77 	 *     tag = the tag to check
78 	 *
79 	 * Returns: %TRUE if @api was registered with @tag.
80 	 */
81 	public static bool apiTypeHasTag(GType api, GQuark tag)
82 	{
83 		return gst_meta_api_type_has_tag(api, tag) != 0;
84 	}
85 
86 	/**
87 	 * Register and return a GType for the @api and associate it with
88 	 * @tags.
89 	 *
90 	 * Params:
91 	 *     api = an API to register
92 	 *     tags = tags for @api
93 	 *
94 	 * Returns: a unique GType for @api.
95 	 */
96 	public static GType apiTypeRegister(string api, string[] tags)
97 	{
98 		return gst_meta_api_type_register(Str.toStringz(api), Str.toStringzArray(tags));
99 	}
100 
101 	/**
102 	 * Lookup a previously registered meta info structure by its implementation name
103 	 * @impl.
104 	 *
105 	 * Params:
106 	 *     impl = the name
107 	 *
108 	 * Returns: a #GstMetaInfo with @impl, or
109 	 *     %NULL when no such metainfo exists.
110 	 */
111 	public static GstMetaInfo* getInfo(string impl)
112 	{
113 		return gst_meta_get_info(Str.toStringz(impl));
114 	}
115 
116 	/**
117 	 * Register a new #GstMeta implementation.
118 	 *
119 	 * The same @info can be retrieved later with gst_meta_get_info() by using
120 	 * @impl as the key.
121 	 *
122 	 * Params:
123 	 *     api = the type of the #GstMeta API
124 	 *     impl = the name of the #GstMeta implementation
125 	 *     size = the size of the #GstMeta structure
126 	 *     initFunc = a #GstMetaInitFunction
127 	 *     freeFunc = a #GstMetaFreeFunction
128 	 *     transformFunc = a #GstMetaTransformFunction
129 	 *
130 	 * Returns: a #GstMetaInfo that can be used to access metadata.
131 	 */
132 	public static GstMetaInfo* register(GType api, string impl, size_t size, GstMetaInitFunction initFunc, GstMetaFreeFunction freeFunc, GstMetaTransformFunction transformFunc)
133 	{
134 		return gst_meta_register(api, Str.toStringz(impl), size, initFunc, freeFunc, transformFunc);
135 	}
136 }