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.PresetT;
26 
27 public  import glib.Str;
28 public  import glib.c.functions;
29 public  import gstreamer.c.functions;
30 public  import gstreamer.c.types;
31 
32 
33 /**
34  * This interface offers methods to query and manipulate parameter preset sets.
35  * A preset is a bunch of property settings, together with meta data and a name.
36  * The name of a preset serves as key for subsequent method calls to manipulate
37  * single presets.
38  * All instances of one type will share the list of presets. The list is created
39  * on demand, if presets are not used, the list is not created.
40  * 
41  * The interface comes with a default implementation that serves most plugins.
42  * Wrapper plugins will override most methods to implement support for the
43  * native preset format of those wrapped plugins.
44  * One method that is useful to be overridden is gst_preset_get_property_names().
45  * With that one can control which properties are saved and in which order.
46  * When implementing support for read-only presets, one should set the vmethods
47  * for gst_preset_save_preset() and gst_preset_delete_preset() to %NULL.
48  * Applications can use gst_preset_is_editable() to check for that.
49  * 
50  * The default implementation supports presets located in a system directory,
51  * application specific directory and in the users home directory. When getting
52  * a list of presets individual presets are read and overlaid in 1) system,
53  * 2) application and 3) user order. Whenever an earlier entry is newer, the
54  * later entries will be updated. Since 1.8 you can also provide extra paths
55  * where to find presets through the GST_PRESET_PATH environment variable.
56  * Presets found in those paths will be considered as "app presets".
57  */
58 public template PresetT(TStruct)
59 {
60 	/** Get the main Gtk struct */
61 	public GstPreset* getPresetStruct(bool transferOwnership = false)
62 	{
63 		if (transferOwnership)
64 			ownedRef = false;
65 		return cast(GstPreset*)getStruct();
66 	}
67 
68 
69 	/**
70 	 * Delete the given preset.
71 	 *
72 	 * Params:
73 	 *     name = preset name to remove
74 	 *
75 	 * Returns: %TRUE for success, %FALSE if e.g. there is no preset with that @name
76 	 */
77 	public bool deletePreset(string name)
78 	{
79 		return gst_preset_delete_preset(getPresetStruct(), Str.toStringz(name)) != 0;
80 	}
81 
82 	/**
83 	 * Gets the @value for an existing meta data @tag. Meta data @tag names can be
84 	 * something like e.g. "comment". Returned values need to be released when done.
85 	 *
86 	 * Params:
87 	 *     name = preset name
88 	 *     tag = meta data item name
89 	 *     value = value
90 	 *
91 	 * Returns: %TRUE for success, %FALSE if e.g. there is no preset with that @name
92 	 *     or no value for the given @tag
93 	 */
94 	public bool getMeta(string name, string tag, out string value)
95 	{
96 		char* outvalue = null;
97 
98 		auto __p = gst_preset_get_meta(getPresetStruct(), Str.toStringz(name), Str.toStringz(tag), &outvalue) != 0;
99 
100 		value = Str.toString(outvalue);
101 
102 		return __p;
103 	}
104 
105 	/**
106 	 * Get a copy of preset names as a %NULL terminated string array.
107 	 *
108 	 * Returns: list with names, use g_strfreev() after usage.
109 	 */
110 	public string[] getPresetNames()
111 	{
112 		auto retStr = gst_preset_get_preset_names(getPresetStruct());
113 
114 		scope(exit) Str.freeStringArray(retStr);
115 		return Str.toStringArray(retStr);
116 	}
117 
118 	/**
119 	 * Get a the names of the GObject properties that can be used for presets.
120 	 *
121 	 * Returns: an
122 	 *     array of property names which should be freed with g_strfreev() after use.
123 	 */
124 	public string[] getPropertyNames()
125 	{
126 		auto retStr = gst_preset_get_property_names(getPresetStruct());
127 
128 		scope(exit) Str.freeStringArray(retStr);
129 		return Str.toStringArray(retStr);
130 	}
131 
132 	/**
133 	 * Check if one can add new presets, change existing ones and remove presets.
134 	 *
135 	 * Returns: %TRUE if presets are editable or %FALSE if they are static
136 	 *
137 	 * Since: 1.6
138 	 */
139 	public bool isEditable()
140 	{
141 		return gst_preset_is_editable(getPresetStruct()) != 0;
142 	}
143 
144 	/**
145 	 * Load the given preset.
146 	 *
147 	 * Params:
148 	 *     name = preset name to load
149 	 *
150 	 * Returns: %TRUE for success, %FALSE if e.g. there is no preset with that @name
151 	 */
152 	public bool loadPreset(string name)
153 	{
154 		return gst_preset_load_preset(getPresetStruct(), Str.toStringz(name)) != 0;
155 	}
156 
157 	/**
158 	 * Renames a preset. If there is already a preset by the @new_name it will be
159 	 * overwritten.
160 	 *
161 	 * Params:
162 	 *     oldName = current preset name
163 	 *     newName = new preset name
164 	 *
165 	 * Returns: %TRUE for success, %FALSE if e.g. there is no preset with @old_name
166 	 */
167 	public bool renamePreset(string oldName, string newName)
168 	{
169 		return gst_preset_rename_preset(getPresetStruct(), Str.toStringz(oldName), Str.toStringz(newName)) != 0;
170 	}
171 
172 	/**
173 	 * Save the current object settings as a preset under the given name. If there
174 	 * is already a preset by this @name it will be overwritten.
175 	 *
176 	 * Params:
177 	 *     name = preset name to save
178 	 *
179 	 * Returns: %TRUE for success, %FALSE
180 	 */
181 	public bool savePreset(string name)
182 	{
183 		return gst_preset_save_preset(getPresetStruct(), Str.toStringz(name)) != 0;
184 	}
185 
186 	/**
187 	 * Sets a new @value for an existing meta data item or adds a new item. Meta
188 	 * data @tag names can be something like e.g. "comment". Supplying %NULL for the
189 	 * @value will unset an existing value.
190 	 *
191 	 * Params:
192 	 *     name = preset name
193 	 *     tag = meta data item name
194 	 *     value = new value
195 	 *
196 	 * Returns: %TRUE for success, %FALSE if e.g. there is no preset with that @name
197 	 */
198 	public bool setMeta(string name, string tag, string value)
199 	{
200 		return gst_preset_set_meta(getPresetStruct(), Str.toStringz(name), Str.toStringz(tag), Str.toStringz(value)) != 0;
201 	}
202 }