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