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.Format;
26 
27 private import glib.Str;
28 private import gobject.ObjectG;
29 private import gstreamer.Iterator;
30 private import gstreamer.c.functions;
31 public  import gstreamer.c.types;
32 public  import gstreamerc.gstreamertypes;
33 
34 
35 /** */
36 public struct Format
37 {
38 
39 	/**
40 	 * Return the format registered with the given nick.
41 	 *
42 	 * Params:
43 	 *     nick = The nick of the format
44 	 *
45 	 * Returns: The format with @nick or GST_FORMAT_UNDEFINED
46 	 *     if the format was not registered.
47 	 */
48 	public static GstFormat getByNick(string nick)
49 	{
50 		return gst_format_get_by_nick(Str.toStringz(nick));
51 	}
52 
53 	/**
54 	 * Get details about the given format.
55 	 *
56 	 * Params:
57 	 *     format = The format to get details of
58 	 *
59 	 * Returns: The #GstFormatDefinition for @format or %NULL
60 	 *     on failure.
61 	 *
62 	 *     MT safe.
63 	 */
64 	public static GstFormatDefinition* getDetails(GstFormat format)
65 	{
66 		return gst_format_get_details(format);
67 	}
68 
69 	/**
70 	 * Get a printable name for the given format. Do not modify or free.
71 	 *
72 	 * Params:
73 	 *     format = a #GstFormat
74 	 *
75 	 * Returns: a reference to the static name of the format
76 	 *     or %NULL if the format is unknown.
77 	 */
78 	public static string getName(GstFormat format)
79 	{
80 		return Str.toString(gst_format_get_name(format));
81 	}
82 
83 	/**
84 	 * Iterate all the registered formats. The format definition is read
85 	 * only.
86 	 *
87 	 * Returns: a GstIterator of #GstFormatDefinition.
88 	 */
89 	public static Iterator iterateDefinitions()
90 	{
91 		auto p = gst_format_iterate_definitions();
92 
93 		if(p is null)
94 		{
95 			return null;
96 		}
97 
98 		return ObjectG.getDObject!(Iterator)(cast(GstIterator*) p, true);
99 	}
100 
101 	/**
102 	 * Create a new GstFormat based on the nick or return an
103 	 * already registered format with that nick.
104 	 *
105 	 * Params:
106 	 *     nick = The nick of the new format
107 	 *     description = The description of the new format
108 	 *
109 	 * Returns: A new GstFormat or an already registered format
110 	 *     with the same nick.
111 	 *
112 	 *     MT safe.
113 	 */
114 	public static GstFormat register(string nick, string description)
115 	{
116 		return gst_format_register(Str.toStringz(nick), Str.toStringz(description));
117 	}
118 
119 	/**
120 	 * Get the unique quark for the given format.
121 	 *
122 	 * Params:
123 	 *     format = a #GstFormat
124 	 *
125 	 * Returns: the quark associated with the format or 0 if the format
126 	 *     is unknown.
127 	 */
128 	public static GQuark toQuark(GstFormat format)
129 	{
130 		return gst_format_to_quark(format);
131 	}
132 
133 	/**
134 	 * See if the given format is inside the format array.
135 	 *
136 	 * Params:
137 	 *     formats = The format array to search
138 	 *     format = the format to find
139 	 *
140 	 * Returns: %TRUE if the format is found inside the array
141 	 */
142 	public static bool contains(GstFormat[] formats, GstFormat format)
143 	{
144 		return gst_formats_contains(formats.ptr, format) != 0;
145 	}
146 }