Module: Gst::Preset

Defined in:
(unknown)

Overview

This interface offers methods to query and manipulate parameter preset sets. A preset is a bunch of property settings, together with meta data and a name. The name of a preset serves as key for subsequent method calls to manipulate single presets. All instances of one type will share the list of presets. The list is created on demand, if presets are not used, the list is not created.

The interface comes with a default implementation that serves most plugins. Wrapper plugins will override most methods to implement support for the 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 nil. 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 a list of presets individual presets are read and overlaid in 1) system, 2) application and 3) user order. Whenever an earlier entry is newer, the later entries will be updated. Since 1.8 you can also provide extra paths where to find presets through the GST_PRESET_PATH environment variable. Presets found in those paths will be considered as "app presets".

Instance Method Summary collapse

Instance Method Details

#delete_preset(name) ⇒ Boolean

Delete the given preset.

Parameters:

  • name (String)

    preset name to remove

Returns:

  • (Boolean)

    true for success, false if e.g. there is no preset with that name

#get_meta(name, tag, value) ⇒ Boolean

Gets the value for an existing meta data tag. Meta data tag names can be something like e.g. "comment". Returned values need to be released when done. or no value for the given tag

Parameters:

  • name (String)

    preset name

  • tag (String)

    meta data item name

  • value (String)

    value

Returns:

  • (Boolean)

    true for success, false if e.g. there is no preset with that name

#is_editableBoolean

Check if one can add new presets, change existing ones and remove presets.

Returns:

  • (Boolean)

    true if presets are editable or false if they are static

#load_preset(name) ⇒ Boolean

Load the given preset.

Parameters:

  • name (String)

    preset name to load

Returns:

  • (Boolean)

    true for success, false if e.g. there is no preset with that name

#preset_namesArray<String>

Get a copy of preset names as a nil terminated string array.

Returns:

  • (Array<String>)

    list with names, use g_strfreev() after usage.

#property_namesArray<String>

Get a the names of the GObject properties that can be used for presets.

Returns:

  • (Array<String>)

    an array of property names which should be freed with g_strfreev() after use.

#rename_preset(old_name, new_name) ⇒ Boolean

Renames a preset. If there is already a preset by the new_name it will be overwritten.

Parameters:

  • old_name (String)

    current preset name

  • new_name (String)

    new preset name

Returns:

  • (Boolean)

    true for success, false if e.g. there is no preset with old_name

#save_preset(name) ⇒ Boolean

Save the current object settings as a preset under the given name. If there is already a preset by this name it will be overwritten.

Parameters:

  • name (String)

    preset name to save

Returns:

  • (Boolean)

    true for success, false

#set_meta(name, tag, value) ⇒ Boolean

Sets a new value for an existing meta data item or adds a new item. Meta data tag names can be something like e.g. "comment". Supplying nil for the value will unset an existing value.

Parameters:

  • name (String)

    preset name

  • tag (String)

    meta data item name

  • value (String)

    new value

Returns:

  • (Boolean)

    true for success, false if e.g. there is no preset with that name