1/* gstreamermm - a C++ wrapper for gstreamer
2 *
3 * Copyright 2008-2016 The gstreamermm Development Team
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library 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 GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20#include <gst/gst.h>
21#include <glibmm/arrayhandle.h>
22#include <glibmm/interface.h>
23
24_DEFS(gstreamermm,gst)
25
26namespace Gst
27{
28
29/** A helper interface for element presets.
30 * This interface offers methods to query and manipulate parameter preset sets.
31 * A preset is a bunch of property settings, together with meta data and a
32 * name. The name of a preset serves as key for subsequent method calls to
33 * manipulate single presets. All instances of one type will share the list of
34 * presets. The list is created on demand, if presets are not used, the list is
35 * not created.
36 *
37 * The interface comes with a default implementation that serves most plugins.
38 * Wrapper plugins will override most methods to implement support for the
39 * native preset format of those wrapped plugins. One method that is useful to
40 * be overridden is property_names_vfunc(). With that, one can control which
41 * properties are saved and in which order.
42 *
43 * Last reviewed on 2016-06-06 (1.8.0)
44 * @ingroup GstInterfaces
45 */
46class Preset : public Glib::Interface
47{
48  _CLASS_INTERFACE(Preset, GstPreset, GST_PRESET, GstPresetInterface)
49
50public:
51#m4 _CONVERSION(`gchar**', `Glib::StringArrayHandle', `Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)')
52  _WRAP_METHOD(Glib::StringArrayHandle get_preset_names() const, gst_preset_get_preset_names)
53  _WRAP_METHOD(Glib::StringArrayHandle get_property_names() const, gst_preset_get_property_names)
54  _WRAP_METHOD(bool load_preset(const Glib::ustring& name), gst_preset_load_preset)
55  _WRAP_METHOD(bool save_preset(const Glib::ustring& name), gst_preset_save_preset)
56  _WRAP_METHOD(bool rename_preset(const Glib::ustring& old_name, const Glib::ustring& new_name), gst_preset_rename_preset)
57  _WRAP_METHOD(bool delete_preset(const Glib::ustring& name), gst_preset_delete_preset)
58  _WRAP_METHOD(bool set_meta(const Glib::ustring& name, const Glib::ustring& tag, const Glib::ustring& value), gst_preset_set_meta)
59  _WRAP_METHOD(bool is_editable() const, gst_preset_is_editable)
60
61  _WRAP_METHOD_DOCS_ONLY(gst_preset_get_meta)
62  bool get_meta(const Glib::ustring& name, const Glib::ustring& tag, Glib::ustring& value) const;
63
64#m4 _CONVERSION(`Glib::StringArrayHandle', `gchar**', `const_cast<gchar**>(($3).data())')
65
66  virtual Glib::StringArrayHandle get_preset_names_vfunc() const;
67  virtual Glib::StringArrayHandle get_property_names_vfunc() const;
68
69  _WRAP_VFUNC(bool load_preset(const Glib::ustring& name), "load_preset")
70  _WRAP_VFUNC(bool save_preset(const Glib::ustring& name) const, "save_preset")
71  _WRAP_VFUNC(bool rename_preset(const Glib::ustring& old_name, const Glib::ustring& new_name), "rename_preset")
72  _WRAP_VFUNC(bool delete_preset(const Glib::ustring& name), "delete_preset")
73  _WRAP_VFUNC(bool set_meta(const Glib::ustring& name, const Glib::ustring& tag, const Glib::ustring& value), "set_meta")
74
75  virtual bool get_meta_vfunc(const Glib::ustring& name,
76    const Glib::ustring& tag, Glib::ustring& value) const;
77
78protected:
79#m4begin
80  _PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
81  klass->get_preset_names = &get_preset_names_vfunc_callback;
82  klass->get_property_names = &get_property_names_vfunc_callback;
83  klass->get_meta = &get_meta_vfunc_callback;
84  _SECTION(SECTION_PH_VFUNCS)
85  static gchar** get_preset_names_vfunc_callback(GstPreset* self);
86  static gchar** get_property_names_vfunc_callback(GstPreset* self);
87  static gboolean get_meta_vfunc_callback(GstPreset* self, const gchar* name,
88    const gchar* tag, gchar** value);
89  _POP()
90#m4end
91};
92
93} // namespace Gst
94