Debian Codegraph @

gstreamer/src/childproxy.hg

raw
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/gstchildproxy.h>
21 #include <glibmm/interface.h>
22
23 _DEFS(gstreamermm,gst)
24
25 namespace Gst
26 {
27
28 class Object;
29
30 /**
31 * Interface for multi child elements.
32 *
33 * This interface abstracts handling of property sets for elements with
34 * children. Imagine elements such as mixers or polyphonic generators. They all
35 * have multiple Gst::Pad or some kind of voice objects. Another use case are
36 * container elements like Gst::Bin.
37 * The element implementing the interface acts as a parent for those child
38 * objects.
39 *
40 * By implementing this interface the child properties can be accessed from the
41 * parent element by using get_proxy_property() and set_proxy_property().
42 *
43 * Property names are written as "child-name::property-name". The whole naming
44 * scheme is recursive. Thus "child1::child2::property" is valid too, if
45 * "child1" and "child2" implement the Gst::ChildProxy interface.
46 *
47 * Last reviewed on 2016-05-16 (1.8.0)
48 *
49 * @ingroup GstInterfaces
50 */
51 class ChildProxy : public Glib::Interface
52 {
53 _CLASS_INTERFACE(ChildProxy, GstChildProxy, GST_CHILD_PROXY, GstChildProxyInterface)
54
55 public:
56 _WRAP_METHOD(guint get_children_count() const, gst_child_proxy_get_children_count)
57
58 #m4 _CONVERSION(`GObject*',`Glib::RefPtr<Gst::Object>',`Glib::wrap(GST_OBJECT($3), true)')
59
60 _WRAP_METHOD(Glib::RefPtr<Gst::Object> get_child(const Glib::ustring& name), gst_child_proxy_get_child_by_name)
61 _WRAP_METHOD(Glib::RefPtr<const Gst::Object> get_child(const Glib::ustring& name) const, gst_child_proxy_get_child_by_name, constversion)
62
63 _WRAP_METHOD(Glib::RefPtr<Glib::Object> get_child(guint index), gst_child_proxy_get_child_by_index)
64 _WRAP_METHOD(Glib::RefPtr<const Glib::Object> get_child(guint index) const, gst_child_proxy_get_child_by_index, constversion)
65
66 _WRAP_METHOD_DOCS_ONLY(gst_child_proxy_lookup)
67 //TODO: Maybe GParamSpec should be wrapped in glibmm?
68 bool lookup(const Glib::ustring& name, Glib::RefPtr<Glib::Object>& target, GParamSpec*& pspec);
69
70 /** Gets a single property using the Gst::ChildProxy mechanism.
71 * @param name The property to get.
72 * @param value An empty Glib::ValueBase in which to store the property.
73 * @return This Gst::ChildProxy so more properties can be retrieved if
74 * needed.
75 */
76 Glib::RefPtr<Gst::ChildProxy> get_proxy_property(const Glib::ustring& name, Glib::ValueBase& value);
77 _IGNORE(gst_child_proxy_get_property, gst_child_proxy_get, gst_child_proxy_get_valist)
78
79 /** Gets a single property using the Gst::ChildProxy mechanism.
80 * @param name The property to get.
81 * @param value An empty Glib::ValueBase in which to store the property.
82 * @return This Gst::ChildProxy so more properties can be retrieved if
83 * needed.
84 */
85 Glib::RefPtr<const Gst::ChildProxy> get_proxy_property(const Glib::ustring& name, Glib::ValueBase& value) const;
86
87
88 /** Sets a single property using the Gst::ChildProxy mechanism.
89 * @param name The property to get.
90 * @param value The Glib::ValueBase to set the property to (non-empty).
91 * @return This Gst::ChildProxy so more properties can be set.
92 */
93 Glib::RefPtr<Gst::ChildProxy> set_proxy_property(const Glib::ustring& name, const Glib::ValueBase& value);
94 _IGNORE(gst_child_proxy_set_property, gst_child_proxy_set, gst_child_proxy_set_valist)
95
96 #m4 _CONVERSION(`const Glib::RefPtr<Gst::Object>&',`GObject*',`G_OBJECT(Glib::unwrap($3))')
97
98 _WRAP_METHOD(void child_added(const Glib::RefPtr<Gst::Object>& child, const Glib::ustring& name), gst_child_proxy_child_added)
99 _WRAP_METHOD(void child_removed(const Glib::RefPtr<Gst::Object>& child, const Glib::ustring& name), gst_child_proxy_child_removed)
100
101 #m4 _CONVERSION(`GObject*',`const Glib::RefPtr<Gst::Object>&',`Glib::wrap(GST_OBJECT($3), true)')
102
103 _WRAP_SIGNAL(void child_added(const Glib::RefPtr<Gst::Object>& object, const Glib::ustring& name), "child-added")
104 _WRAP_SIGNAL(void child_removed(const Glib::RefPtr<Gst::Object>& object, const Glib::ustring& name), "child-removed")
105
106 /** Virtual method to fetch the child by name.
107 */
108 _WRAP_VFUNC(Glib::RefPtr<Glib::Object> get_child_by_name(const Glib::ustring& name) const, "get_child_by_name")
109
110 /** Virtual method to fetch the child by index.
111 */
112 _WRAP_VFUNC(Glib::RefPtr<Glib::Object> get_child_by_index(guint index) const, "get_child_by_index")
113
114 /** Virtual method to get the children count.
115 */
116 _WRAP_VFUNC(guint get_children_count() const, "get_children_count")
117 };
118
119 } // namespace Gst