preset: add gst_preset_is_editable()

Add a function to check if the preset iface implementation is editable and
document this from the implementers perspective.
API: gst_preset_is_editable()
This commit is contained in:
Stefan Sauer 2014-12-12 21:38:26 +01:00
parent e1fd8d2964
commit a35094f1b3
2 changed files with 22 additions and 0 deletions

View file

@ -34,6 +34,9 @@
* native preset format of those wrapped plugins.
* One method that is useful to be overridden is gst_preset_get_property_names().
* With that one can control which properties are saved and in which order.
* When implementing support for read-only presets, one should set the vmethods
* for gst_preset_save_preset() and gst_preset_delete_preset() to %NULL.
* Applications can use gst_preset_is_editable() to check for that.
*
* The default implementation supports presets located in a system directory,
* application specific directory and in the users home directory. When getting
@ -1148,6 +1151,24 @@ gst_preset_get_app_dir (void)
return preset_app_dir;
}
/**
* gst_preset_is_editable:
* @preset: a #GObject that implements #GstPreset
*
* Check if one can add new presets, change existing ones and remove presets.
*
* Returns: %TRUE if presets are editable or %FALSE if they are static
*
* Since: 1.6
*/
gboolean
gst_preset_is_editable (GstPreset * preset)
{
GstPresetInterface *iface = GST_PRESET_GET_INTERFACE (preset);
return iface->save_preset && iface->delete_preset;
}
/* class internals */
static void

View file

@ -97,6 +97,7 @@ gboolean gst_preset_get_meta (GstPreset *preset, const gchar *name
gboolean gst_preset_set_app_dir (const gchar *app_dir);
const gchar *gst_preset_get_app_dir (void);
gboolean gst_preset_is_editable (GstPreset *preset);
G_END_DECLS
#endif /* __GST_PRESET_H__ */