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