| 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/object.h> |
| 22 |
#include <glibmm/listhandle.h> |
| 23 |
#include <glibmm/threads.h> |
| 24 |
#include <gstreamermm/clockutils.h> |
| 25 |
|
| 26 |
_DEFS(gstreamermm,gst) |
| 27 |
|
| 28 |
namespace Gst |
| 29 |
{ |
| 30 |
|
| 31 |
_WRAP_ENUM(ObjectFlags, GstObjectFlags) |
| 32 |
|
| 33 |
/** @defgroup GstBaseClasses gstreamermm Base Classes |
| 34 |
* Wrapped GStreamer base classes (plug-ins and other classes derrive from |
| 35 |
* these). |
| 36 |
*/ |
| 37 |
|
| 38 |
/** A base class for the GStreamer object hierarchy. |
| 39 |
* Gst::Object provides a root for the object hierarchy tree filed in by the |
| 40 |
* GStreamer library. It is currently a thin wrapper on top of Glib::Object. |
| 41 |
* It is an abstract class that is not very usable on its own. |
| 42 |
* |
| 43 |
* Gst::Object gives us basic refcounting, parenting functionality and |
| 44 |
* locking. Most of the function are just extended for special GStreamer needs |
| 45 |
* and can be found under the same name in the base class of Gst::Object which |
| 46 |
* is Glib::Object (e.g. Glib::Object::reference() becomes |
| 47 |
* Gst:Object::reference(). |
| 48 |
* |
| 49 |
* In contrast to Glib::Object instances, Gst::Object adds a name property. |
| 50 |
* The functions set_name() and get_name() are used to set/get the name of the |
| 51 |
* object. |
| 52 |
* |
| 53 |
* Last reviewed on 2016-06-06 (1.8.0) |
| 54 |
* @ingroup GstBaseClasses |
| 55 |
*/ |
| 56 |
class Object : public Glib::Object |
| 57 |
{ |
| 58 |
_CLASS_GOBJECT(Object, GstObject, GST_OBJECT, Glib::Object, GObject) |
| 59 |
_IGNORE(gst_object_ref, gst_object_unref) |
| 60 |
_CUSTOM_CTOR_CAST |
| 61 |
|
| 62 |
public: |
| 63 |
bool is_element() const; |
| 64 |
bool is_element_factory() const; |
| 65 |
bool is_pad() const; |
| 66 |
bool is_pad_template() const; |
| 67 |
bool is_bin() const; |
| 68 |
|
| 69 |
/** Returns the entire set of flags for the object. |
| 70 |
*/ |
| 71 |
_MEMBER_GET(flags, flags, guint32, guint32) |
| 72 |
|
| 73 |
//TODO: These conversions should probably be in the glibmm conversion files. |
| 74 |
#m4 _CONVERSION(`GMutex*',`Glib::Threads::Mutex*',`Glib::Threads::wrap($3)') |
| 75 |
#m4 _CONVERSION(`GMutex*',`const Glib::Threads::Mutex*',`Glib::Threads::wrap($3)') |
| 76 |
|
| 77 |
_WRAP_METHOD(bool set_name(const Glib::ustring& name), gst_object_set_name) |
| 78 |
_WRAP_METHOD(Glib::ustring get_name() const, gst_object_get_name) |
| 79 |
_WRAP_METHOD(bool set_parent(const Glib::RefPtr<Gst::Object>& parent), gst_object_set_parent) |
| 80 |
_WRAP_METHOD(Glib::RefPtr<Gst::Object> get_parent(), gst_object_get_parent) |
| 81 |
_WRAP_METHOD(Glib::RefPtr<const Gst::Object> get_parent() const, gst_object_get_parent, constversion) |
| 82 |
_WRAP_METHOD(void unparent(), gst_object_unparent) |
| 83 |
|
| 84 |
_WRAP_METHOD(void set_control_rate(Gst::ClockTime control_rate), gst_object_set_control_rate) |
| 85 |
_WRAP_METHOD(Gst::ClockTime get_control_rate() const, gst_object_get_control_rate) |
| 86 |
_WRAP_METHOD(Gst::ClockTime suggest_next_sync() const, gst_object_suggest_next_sync) |
| 87 |
_WRAP_METHOD(bool sync_values(Gst::ClockTime timestamp), gst_object_sync_values) |
| 88 |
|
| 89 |
_WRAP_METHOD(void set_control_bindings_disabled(bool disabled), gst_object_set_control_bindings_disabled) |
| 90 |
_WRAP_METHOD(bool has_asctive_control_bindings() const, gst_object_has_active_control_bindings) |
| 91 |
|
| 92 |
// Ignore default signal and error callback. |
| 93 |
_IGNORE(gst_object_default_deep_notify, gst_object_default_error) |
| 94 |
|
| 95 |
#m4 _CONVERSION(`const Glib::ListHandle<const Gst::Object>&', `GList*', `($3).data()') |
| 96 |
_WRAP_METHOD(static bool check_uniqueness(const Glib::ListHandle<const Gst::Object>& list, const Glib::ustring& name), gst_object_check_uniqueness) |
| 97 |
|
| 98 |
_WRAP_METHOD(bool has_ancestor(const Glib::RefPtr<const Gst::Object>& ancestor) const, gst_object_has_ancestor) |
| 99 |
_WRAP_METHOD(bool has_as_ancestor(const Glib::RefPtr<Gst::Object>& ancestor) const, gst_object_has_as_ancestor) |
| 100 |
_WRAP_METHOD(bool has_as_parent(const Glib::RefPtr<Gst::Object>& parent) const, gst_object_has_as_parent) |
| 101 |
|
| 102 |
_WRAP_METHOD(Glib::ustring get_path_string(), gst_object_get_path_string) |
| 103 |
|
| 104 |
_WRAP_PROPERTY("name", Glib::ustring) |
| 105 |
_WRAP_PROPERTY("parent", Glib::RefPtr<Gst::Object>) |
| 106 |
|
| 107 |
#m4 _CONVERSION(`GstObject*', `const Glib::RefPtr<Gst::Object>&', `Glib::wrap($3, true)') |
| 108 |
//TODO: Maybe GParamSpec should be wrapped in glibmm? |
| 109 |
_WRAP_SIGNAL(void deep_notify(const Glib::RefPtr<Gst::Object>& prop_object, GParamSpec* prop), "deep-notify") |
| 110 |
|
| 111 |
int get_refcount() const; |
| 112 |
}; |
| 113 |
|
| 114 |
} // namespace Gst |