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