summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kiagiadakis <kiagiadakis.george@gmail.com>2010-07-03 20:40:25 +0300
committerGeorge Kiagiadakis <kiagiadakis.george@gmail.com>2010-07-03 20:40:25 +0300
commitd12fca55c73ea3d7b54a42f1d78c0022dc8c72e7 (patch)
tree0b2cc6d3a06f13e732a0e9486fd2696a8b138005
parent8d11fbd2e7c7139083892656eb3e6b3cf94d0bcb (diff)
Change RefCountedObject::object() to be a template that automatically casts to the requested pointer type.
This is to avoid the overhead of using gstreamer's GST_FOO() macros that internally make a type check too.
-rw-r--r--src/QGlib/object.cpp8
-rw-r--r--src/QGlib/paramspec.cpp20
-rw-r--r--src/QGlib/refpointer.h17
-rw-r--r--src/QGst/bin.cpp16
-rw-r--r--src/QGst/bus.cpp16
-rw-r--r--src/QGst/caps.cpp52
-rw-r--r--src/QGst/childproxy.cpp8
-rw-r--r--src/QGst/element.cpp22
-rw-r--r--src/QGst/elementfactory.cpp22
-rw-r--r--src/QGst/ghostpad.cpp4
-rw-r--r--src/QGst/message.cpp10
-rw-r--r--src/QGst/miniobject.cpp12
-rw-r--r--src/QGst/object.cpp16
-rw-r--r--src/QGst/pad.cpp30
-rw-r--r--src/QGst/pluginfeature.cpp12
15 files changed, 135 insertions, 130 deletions
diff --git a/src/QGlib/object.cpp b/src/QGlib/object.cpp
index a9f9ae6..cd98cdc 100644
--- a/src/QGlib/object.cpp
+++ b/src/QGlib/object.cpp
@@ -31,7 +31,7 @@ QList< RefPointer<T> > arrayToList(typename T::CType **array, uint n)
ParamSpecPtr Object::findProperty(const String & name) const
{
- GObjectClass *klass = G_OBJECT_CLASS(g_type_class_ref(Type::fromInstance(object())));
+ GObjectClass *klass = G_OBJECT_CLASS(g_type_class_ref(Type::fromInstance(object<void>())));
GParamSpec *param = g_object_class_find_property(klass, name);
g_type_class_unref(klass);
if (param) {
@@ -43,7 +43,7 @@ ParamSpecPtr Object::findProperty(const String & name) const
QList<ParamSpecPtr> Object::listProperties() const
{
- GObjectClass *klass = G_OBJECT_CLASS(g_type_class_ref(Type::fromInstance(object())));
+ GObjectClass *klass = G_OBJECT_CLASS(g_type_class_ref(Type::fromInstance(object<void>())));
uint n;
GParamSpec **param = g_object_class_list_properties(klass, &n);
g_type_class_unref(klass);
@@ -58,14 +58,14 @@ Value Object::property(const String & name) const
ParamSpecPtr param = findProperty(name);
if (param && (param->flags() & ParamSpec::Readable)) {
result.init(param->valueType());
- g_object_get_property(G_OBJECT(object()), name, result);
+ g_object_get_property(object<GObject>(), name, result);
}
return result;
}
void Object::setPropertyValue(const String & name, const ValueBase & value)
{
- g_object_set_property(G_OBJECT(object()), name, value);
+ g_object_set_property(object<GObject>(), name, value);
}
void Object::ref()
diff --git a/src/QGlib/paramspec.cpp b/src/QGlib/paramspec.cpp
index 82a6897..cf0f1bb 100644
--- a/src/QGlib/paramspec.cpp
+++ b/src/QGlib/paramspec.cpp
@@ -23,52 +23,52 @@ namespace QGlib {
String ParamSpec::name() const
{
- return String(g_param_spec_get_name(G_PARAM_SPEC(object())));
+ return String(g_param_spec_get_name(object<GParamSpec>()));
}
String ParamSpec::nick() const
{
- return String(g_param_spec_get_nick(G_PARAM_SPEC(object())));
+ return String(g_param_spec_get_nick(object<GParamSpec>()));
}
String ParamSpec::description() const
{
- return String(g_param_spec_get_blurb(G_PARAM_SPEC(object())));
+ return String(g_param_spec_get_blurb(object<GParamSpec>()));
}
ParamSpec::ParamFlags ParamSpec::flags() const
{
- return ParamFlags(G_PARAM_SPEC(object())->flags);
+ return ParamFlags(object<GParamSpec>()->flags);
}
Type ParamSpec::valueType() const
{
- return Type(G_PARAM_SPEC_VALUE_TYPE(G_PARAM_SPEC(object())));
+ return Type(G_PARAM_SPEC_VALUE_TYPE(object<GParamSpec>()));
}
Type ParamSpec::ownerType() const
{
- return Type(G_PARAM_SPEC(object())->owner_type);
+ return Type(object<GParamSpec>()->owner_type);
}
void *ParamSpec::quarkData(const Quark & quark) const
{
- return g_param_spec_get_qdata(G_PARAM_SPEC(object()), quark);
+ return g_param_spec_get_qdata(object<GParamSpec>(), quark);
}
void *ParamSpec::stealQuarkData(const Quark & quark) const
{
- return g_param_spec_steal_qdata(G_PARAM_SPEC(object()), quark);
+ return g_param_spec_steal_qdata(object<GParamSpec>(), quark);
}
void ParamSpec::setQuarkData(const Quark & quark, void *data, void (*destroyCallback)(void*))
{
- g_param_spec_set_qdata_full(G_PARAM_SPEC(object()), quark, data, destroyCallback);
+ g_param_spec_set_qdata_full(object<GParamSpec>(), quark, data, destroyCallback);
}
ParamSpecPtr ParamSpec::redirectTarget() const
{
- return ParamSpecPtr::wrap(g_param_spec_get_redirect_target(G_PARAM_SPEC(object())));
+ return ParamSpecPtr::wrap(g_param_spec_get_redirect_target(object<GParamSpec>()));
}
void ParamSpec::ref()
diff --git a/src/QGlib/refpointer.h b/src/QGlib/refpointer.h
index e92d6af..be88cd4 100644
--- a/src/QGlib/refpointer.h
+++ b/src/QGlib/refpointer.h
@@ -75,21 +75,26 @@ protected:
virtual void unref() = 0;
virtual void makeWritable() {}
- inline void* & object();
- inline void* const & object() const;
+ template <class T>
+ inline T* object();
+
+ template <class T>
+ inline T* object() const;
void *m_object;
};
-inline void* & RefCountedObject::object()
+template <class T>
+inline T* RefCountedObject::object()
{
makeWritable();
- return m_object;
+ return static_cast<T*>(m_object);
}
-inline void* const & RefCountedObject::object() const
+template <class T>
+inline T* RefCountedObject::object() const
{
- return m_object;
+ return static_cast<T* const>(m_object);
}
diff --git a/src/QGst/bin.cpp b/src/QGst/bin.cpp
index 503a5ad..4579e9b 100644
--- a/src/QGst/bin.cpp
+++ b/src/QGst/bin.cpp
@@ -25,18 +25,18 @@ namespace QGst {
BinPtr Bin::create(const QGlib::String & name)
{
GstElement *bin = gst_bin_new(name);
- gst_object_ref_sink(GST_OBJECT(bin));
+ gst_object_ref_sink(bin);
return BinPtr::wrap(GST_BIN(bin), false);
}
bool Bin::add(const ElementPtr & element)
{
- return gst_bin_add(GST_BIN(object()), element);
+ return gst_bin_add(object<GstBin>(), element);
}
bool Bin::remove(const ElementPtr & element)
{
- return gst_bin_remove(GST_BIN(object()), element);
+ return gst_bin_remove(object<GstBin>(), element);
}
ElementPtr Bin::getElementByName(const QGlib::String & name, RecursionType r) const
@@ -44,10 +44,10 @@ ElementPtr Bin::getElementByName(const QGlib::String & name, RecursionType r) co
GstElement *e = NULL;
switch(r) {
case RecurseDown:
- e = gst_bin_get_by_name(GST_BIN(object()), name);
+ e = gst_bin_get_by_name(object<GstBin>(), name);
break;
case RecurseUp:
- e = gst_bin_get_by_name_recurse_up(GST_BIN(object()), name);
+ e = gst_bin_get_by_name_recurse_up(object<GstBin>(), name);
break;
default:
Q_ASSERT_X(false, "QGst::Bin::getByName", "Invalid RecursionType");
@@ -57,18 +57,18 @@ ElementPtr Bin::getElementByName(const QGlib::String & name, RecursionType r) co
ElementPtr Bin::getElementByInterface(QGlib::Type interfaceType) const
{
- return ElementPtr::wrap(gst_bin_get_by_interface(GST_BIN(object()), interfaceType), false);
+ return ElementPtr::wrap(gst_bin_get_by_interface(object<GstBin>(), interfaceType), false);
}
PadPtr Bin::findUnlinkedPad(PadDirection direction) const
{
- return PadPtr::wrap(gst_bin_find_unlinked_pad(GST_BIN(object()),
+ return PadPtr::wrap(gst_bin_find_unlinked_pad(object<GstBin>(),
static_cast<GstPadDirection>(direction)), false);
}
bool Bin::recalculateLatency()
{
- return gst_bin_recalculate_latency(GST_BIN(object()));
+ return gst_bin_recalculate_latency(object<GstBin>());
}
}
diff --git a/src/QGst/bus.cpp b/src/QGst/bus.cpp
index a2e3bd7..ab4e544 100644
--- a/src/QGst/bus.cpp
+++ b/src/QGst/bus.cpp
@@ -31,43 +31,43 @@ BusPtr Bus::create()
bool Bus::hasPendingMessages() const
{
- return gst_bus_have_pending(GST_BUS(object()));
+ return gst_bus_have_pending(object<GstBus>());
}
MessagePtr Bus::peek() const
{
- return MessagePtr::wrap(gst_bus_peek(GST_BUS(object())), false);
+ return MessagePtr::wrap(gst_bus_peek(object<GstBus>()), false);
}
MessagePtr Bus::pop(ClockTime timeout)
{
- return MessagePtr::wrap(gst_bus_timed_pop(GST_BUS(object()), timeout), false);
+ return MessagePtr::wrap(gst_bus_timed_pop(object<GstBus>(), timeout), false);
}
MessagePtr Bus::pop(MessageType type, ClockTime timeout)
{
- return MessagePtr::wrap(gst_bus_timed_pop_filtered(GST_BUS(object()), timeout,
+ return MessagePtr::wrap(gst_bus_timed_pop_filtered(object<GstBus>(), timeout,
static_cast<GstMessageType>(type)), false);
}
bool Bus::post(const QGst::MessagePtr & message)
{
- return gst_bus_post(GST_BUS(object()), message->copy().staticCast<Message>());
+ return gst_bus_post(object<GstBus>(), message->copy().staticCast<Message>());
}
void Bus::setFlushing(bool flush)
{
- gst_bus_set_flushing(GST_BUS(object()), flush);
+ gst_bus_set_flushing(object<GstBus>(), flush);
}
void Bus::enableSyncMessageEmission()
{
- gst_bus_enable_sync_message_emission(GST_BUS(object()));
+ gst_bus_enable_sync_message_emission(object<GstBus>());
}
void Bus::disableSyncMessageEmission()
{
- gst_bus_disable_sync_message_emission(GST_BUS(object()));
+ gst_bus_disable_sync_message_emission(object<GstBus>());
}
} //namespace QGst
diff --git a/src/QGst/caps.cpp b/src/QGst/caps.cpp
index f39e8f3..ca75d63 100644
--- a/src/QGst/caps.cpp
+++ b/src/QGst/caps.cpp
@@ -47,7 +47,7 @@ CapsPtr Caps::fromString(const QGlib::String & string)
QGlib::String Caps::toString() const
{
- return QGlib::String::fromGCharPtr(gst_caps_to_string(GST_CAPS(object())));
+ return QGlib::String::fromGCharPtr(gst_caps_to_string(object<GstCaps>()));
}
//static
@@ -58,127 +58,127 @@ CapsPtr Caps::fromXml(xmlNodePtr node)
xmlNodePtr Caps::toXml(xmlNodePtr parent) const
{
- return gst_caps_save_thyself(GST_CAPS(object()), parent);
+ return gst_caps_save_thyself(object<GstCaps>(), parent);
}
void Caps::append(const CapsPtr & caps2)
{
- gst_caps_append(GST_CAPS(object()), gst_caps_copy(caps2));
+ gst_caps_append(object<GstCaps>(), gst_caps_copy(caps2));
}
void Caps::merge(const CapsPtr & caps2)
{
- gst_caps_merge(GST_CAPS(object()), gst_caps_copy(caps2));
+ gst_caps_merge(object<GstCaps>(), gst_caps_copy(caps2));
}
void Caps::setValue(const QGlib::String & field, const QGlib::Value & value)
{
- gst_caps_set_value(GST_CAPS(object()), field, value);
+ gst_caps_set_value(object<GstCaps>(), field, value);
}
bool Caps::simplify()
{
- return gst_caps_do_simplify(GST_CAPS(object()));
+ return gst_caps_do_simplify(object<GstCaps>());
}
void Caps::truncate()
{
- gst_caps_truncate(GST_CAPS(object()));
+ gst_caps_truncate(object<GstCaps>());
}
SharedStructure Caps::structure(uint index)
{
- return SharedStructure(gst_caps_get_structure(GST_CAPS(object()), index));
+ return SharedStructure(gst_caps_get_structure(object<GstCaps>(), index));
}
void Caps::appendStructure(const StructureBase & structure)
{
- gst_caps_append_structure(GST_CAPS(object()), gst_structure_copy(structure));
+ gst_caps_append_structure(object<GstCaps>(), gst_structure_copy(structure));
}
void Caps::mergeStructure(const StructureBase & structure)
{
- gst_caps_merge_structure(GST_CAPS(object()), gst_structure_copy(structure));
+ gst_caps_merge_structure(object<GstCaps>(), gst_structure_copy(structure));
}
void Caps::removeStructure(uint index)
{
- gst_caps_remove_structure(GST_CAPS(object()), index);
+ gst_caps_remove_structure(object<GstCaps>(), index);
}
uint Caps::size() const
{
- return gst_caps_get_size(GST_CAPS(object()));
+ return gst_caps_get_size(object<GstCaps>());
}
bool Caps::isSimple() const
{
- return GST_CAPS_IS_SIMPLE(GST_CAPS(object()));
+ return GST_CAPS_IS_SIMPLE(object<GstCaps>());
}
bool Caps::isAny() const
{
- return gst_caps_is_any(GST_CAPS(object()));
+ return gst_caps_is_any(object<GstCaps>());
}
bool Caps::isEmpty() const
{
- return gst_caps_is_empty(GST_CAPS(object()));
+ return gst_caps_is_empty(object<GstCaps>());
}
bool Caps::isFixed() const
{
- return gst_caps_is_fixed(GST_CAPS(object()));
+ return gst_caps_is_fixed(object<GstCaps>());
}
bool Caps::equals(const CapsPtr & caps2) const
{
- return gst_caps_is_equal(GST_CAPS(object()), caps2);
+ return gst_caps_is_equal(object<GstCaps>(), caps2);
}
bool Caps::isAlwaysCompatibleWith(const CapsPtr & caps2) const
{
- return gst_caps_is_always_compatible(GST_CAPS(object()), caps2);
+ return gst_caps_is_always_compatible(object<GstCaps>(), caps2);
}
bool Caps::isSubsetOf(const CapsPtr & superset) const
{
- return gst_caps_is_subset(GST_CAPS(object()), superset);
+ return gst_caps_is_subset(object<GstCaps>(), superset);
}
bool Caps::canIntersect(const CapsPtr & caps2) const
{
- return gst_caps_can_intersect(GST_CAPS(object()), caps2);
+ return gst_caps_can_intersect(object<GstCaps>(), caps2);
}
CapsPtr Caps::getIntersection(const CapsPtr & caps2) const
{
- return CapsPtr::wrap(gst_caps_intersect(GST_CAPS(object()), caps2), false);
+ return CapsPtr::wrap(gst_caps_intersect(object<GstCaps>(), caps2), false);
}
CapsPtr Caps::getUnion(const CapsPtr & caps2) const
{
- return CapsPtr::wrap(gst_caps_union(GST_CAPS(object()), caps2), false);
+ return CapsPtr::wrap(gst_caps_union(object<GstCaps>(), caps2), false);
}
CapsPtr Caps::getNormal() const
{
- return CapsPtr::wrap(gst_caps_normalize(GST_CAPS(object())), false);
+ return CapsPtr::wrap(gst_caps_normalize(object<GstCaps>()), false);
}
CapsPtr Caps::subtract(const CapsPtr & subtrahend) const
{
- return CapsPtr::wrap(gst_caps_subtract(GST_CAPS(object()), subtrahend), false);
+ return CapsPtr::wrap(gst_caps_subtract(object<GstCaps>(), subtrahend), false);
}
CapsPtr Caps::copy() const
{
- return CapsPtr::wrap(gst_caps_copy(GST_CAPS(object())), false);
+ return CapsPtr::wrap(gst_caps_copy(object<GstCaps>()), false);
}
CapsPtr Caps::copyNth(uint index) const
{
- return CapsPtr::wrap(gst_caps_copy_nth(GST_CAPS(object()), index), false);
+ return CapsPtr::wrap(gst_caps_copy_nth(object<GstCaps>(), index), false);
}
void Caps::ref()
diff --git a/src/QGst/childproxy.cpp b/src/QGst/childproxy.cpp
index 5011b0b..dbe0075 100644
--- a/src/QGst/childproxy.cpp
+++ b/src/QGst/childproxy.cpp
@@ -22,24 +22,24 @@ namespace QGst {
uint ChildProxy::childrenCount() const
{
- return gst_child_proxy_get_children_count(GST_CHILD_PROXY(object()));
+ return gst_child_proxy_get_children_count(object<GstChildProxy>());
}
ObjectPtr ChildProxy::childByName(const QGlib::String & name) const
{
- return ObjectPtr::wrap(gst_child_proxy_get_child_by_name(GST_CHILD_PROXY(object()), name), false);
+ return ObjectPtr::wrap(gst_child_proxy_get_child_by_name(object<GstChildProxy>(), name), false);
}
ObjectPtr ChildProxy::childByIndex(uint index) const
{
- return ObjectPtr::wrap(gst_child_proxy_get_child_by_index(GST_CHILD_PROXY(object()), index), false);
+ return ObjectPtr::wrap(gst_child_proxy_get_child_by_index(object<GstChildProxy>(), index), false);
}
bool ChildProxy::findChildProperty(const QGlib::String & name, ObjectPtr *obj, QGlib::ParamSpecPtr *paramSpec) const
{
GstObject *op;
GParamSpec *pp;
- bool result = gst_child_proxy_lookup(GST_OBJECT(object()), name, &op, &pp);
+ bool result = gst_child_proxy_lookup(object<GstObject>(), name, &op, &pp);
if (result) {
*obj = ObjectPtr::wrap(op, false);
*paramSpec = QGlib::ParamSpecPtr::wrap(pp, false);
diff --git a/src/QGst/element.cpp b/src/QGst/element.cpp
index c8f1520..b2a36db 100644
--- a/src/QGst/element.cpp
+++ b/src/QGst/element.cpp
@@ -24,7 +24,7 @@ namespace QGst {
StateChangeReturn Element::getState(State *state, State *pending, ClockTime timeout)
{
GstState curState, pendingState;
- GstStateChangeReturn result = gst_element_get_state(GST_ELEMENT(object()),
+ GstStateChangeReturn result = gst_element_get_state(object<GstElement>(),
&curState, &pendingState, timeout);
if (state) {
*state = static_cast<State>(curState);
@@ -37,51 +37,51 @@ StateChangeReturn Element::getState(State *state, State *pending, ClockTime time
StateChangeReturn Element::setState(State state)
{
- return static_cast<StateChangeReturn>(gst_element_set_state(GST_ELEMENT(object()),
+ return static_cast<StateChangeReturn>(gst_element_set_state(object<GstElement>(),
static_cast<GstState>(state)));
}
bool Element::syncStateWithParent()
{
- return gst_element_sync_state_with_parent(GST_ELEMENT(object()));
+ return gst_element_sync_state_with_parent(object<GstElement>());
}
bool Element::stateIsLocked() const
{
- return gst_element_is_locked_state(GST_ELEMENT(object()));
+ return gst_element_is_locked_state(object<GstElement>());
}
bool Element::setStateLocked(bool locked)
{
- return gst_element_set_locked_state(GST_ELEMENT(object()), locked);
+ return gst_element_set_locked_state(object<GstElement>(), locked);
}
bool Element::addPad(const PadPtr & pad)
{
- return gst_element_add_pad(GST_ELEMENT(object()), pad);
+ return gst_element_add_pad(object<GstElement>(), pad);
}
PadPtr Element::getStaticPad(const QGlib::String & name)
{
- GstPad *pad = gst_element_get_static_pad(GST_ELEMENT(object()), name);
+ GstPad *pad = gst_element_get_static_pad(object<GstElement>(), name);
return PadPtr::wrap(pad, false);
}
PadPtr Element::getRequestPad(const QGlib::String & name)
{
- GstPad *pad = gst_element_get_request_pad(GST_ELEMENT(object()), name);
+ GstPad *pad = gst_element_get_request_pad(object<GstElement>(), name);
return PadPtr::wrap(pad, false);
}
void Element::releaseRequestPad(const PadPtr & pad)
{
- gst_element_release_request_pad(GST_ELEMENT(object()), pad);
+ gst_element_release_request_pad(object<GstElement>(), pad);
}
bool Element::link(const QGlib::String & srcPadName, const ElementPtr & dest,
const QGlib::String& sinkPadName, const CapsPtr & filter)
{
- return gst_element_link_pads_filtered(GST_ELEMENT(object()), srcPadName,
+ return gst_element_link_pads_filtered(object<GstElement>(), srcPadName,
dest, sinkPadName, filter);
}
@@ -103,7 +103,7 @@ bool Element::link(const ElementPtr & dest, const CapsPtr & filter)
void Element::unlink(const QGlib::String & srcPadName, const ElementPtr & dest,
const QGlib::String & sinkPadName)
{
- gst_element_unlink_pads(GST_ELEMENT(object()), srcPadName, dest, sinkPadName);
+ gst_element_unlink_pads(object<GstElement>(), srcPadName, dest, sinkPadName);
}
void Element::unlink(const ElementPtr & dest, const QGlib::String & sinkPadName)
diff --git a/src/QGst/elementfactory.cpp b/src/QGst/elementfactory.cpp
index e95bae7..80651ac 100644
--- a/src/QGst/elementfactory.cpp
+++ b/src/QGst/elementfactory.cpp
@@ -38,57 +38,57 @@ ElementPtr ElementFactory::make(const QGlib::String & factoryName, const QGlib::
QGlib::Type ElementFactory::elementType() const
{
- return gst_element_factory_get_element_type(GST_ELEMENT_FACTORY(object()));
+ return gst_element_factory_get_element_type(object<GstElementFactory>());
}
QGlib::String ElementFactory::longName() const
{
- return QGlib::String(gst_element_factory_get_longname(GST_ELEMENT_FACTORY(object())));
+ return QGlib::String(gst_element_factory_get_longname(object<GstElementFactory>()));
}
QGlib::String ElementFactory::klass() const
{
- return QGlib::String(gst_element_factory_get_klass(GST_ELEMENT_FACTORY(object())));
+ return QGlib::String(gst_element_factory_get_klass(object<GstElementFactory>()));
}
QGlib::String ElementFactory::description() const
{
- return QGlib::String(gst_element_factory_get_description(GST_ELEMENT_FACTORY(object())));
+ return QGlib::String(gst_element_factory_get_description(object<GstElementFactory>()));
}
QGlib::String ElementFactory::author() const
{
- return QGlib::String(gst_element_factory_get_author(GST_ELEMENT_FACTORY(object())));
+ return QGlib::String(gst_element_factory_get_author(object<GstElementFactory>()));
}
uint ElementFactory::padTemplatesCount() const
{
- return gst_element_factory_get_num_pad_templates(GST_ELEMENT_FACTORY(object()));
+ return gst_element_factory_get_num_pad_templates(object<GstElementFactory>());
}
int ElementFactory::uriType() const
{
- return gst_element_factory_get_uri_type(GST_ELEMENT_FACTORY(object()));
+ return gst_element_factory_get_uri_type(object<GstElementFactory>());
}
bool ElementFactory::hasInterface(const QGlib::String & interfaceName) const
{
- return gst_element_factory_has_interface(GST_ELEMENT_FACTORY(object()), interfaceName);
+ return gst_element_factory_has_interface(object<GstElementFactory>(), interfaceName);
}
bool ElementFactory::canSinkCaps(const CapsPtr & caps) const
{
- return gst_element_factory_can_sink_caps(GST_ELEMENT_FACTORY(object()), caps);
+ return gst_element_factory_can_sink_caps(object<GstElementFactory>(), caps);
}
bool ElementFactory::canSrcCaps(const CapsPtr & caps) const
{
- return gst_element_factory_can_src_caps(GST_ELEMENT_FACTORY(object()), caps);
+ return gst_element_factory_can_src_caps(object<GstElementFactory>(), caps);
}
ElementPtr ElementFactory::create(const QGlib::String & elementName) const
{
- GstElement *e = gst_element_factory_create(GST_ELEMENT_FACTORY(object()), elementName);
+ GstElement *e = gst_element_factory_create(object<GstElementFactory>(), elementName);
gst_object_ref_sink(e);
return ElementPtr::wrap(e, false);
}
diff --git a/src/QGst/ghostpad.cpp b/src/QGst/ghostpad.cpp
index ec52d83..89331d1 100644
--- a/src/QGst/ghostpad.cpp
+++ b/src/QGst/ghostpad.cpp
@@ -35,12 +35,12 @@ GhostPadPtr GhostPad::create(PadDirection direction, const QGlib::String & name)
PadPtr GhostPad::target() const
{
- return PadPtr::wrap(gst_ghost_pad_get_target(GST_GHOST_PAD(object())), false);
+ return PadPtr::wrap(gst_ghost_pad_get_target(object<GstGhostPad>()), false);
}
bool GhostPad::setTarget(const PadPtr & target)
{
- return gst_ghost_pad_set_target(GST_GHOST_PAD(object()), target);
+ return gst_ghost_pad_set_target(object<GstGhostPad>(), target);
}
}
diff --git a/src/QGst/message.cpp b/src/QGst/message.cpp
index 16ecc1b..e29f375 100644
--- a/src/QGst/message.cpp
+++ b/src/QGst/message.cpp
@@ -23,27 +23,27 @@ namespace QGst {
ObjectPtr Message::source() const
{
- return ObjectPtr::wrap(GST_MESSAGE_SRC(GST_MESSAGE(object())));
+ return ObjectPtr::wrap(GST_MESSAGE_SRC(object<GstMessage>()));
}
quint64 Message::timestamp() const
{
- return GST_MESSAGE(object())->timestamp;
+ return object<GstMessage>()->timestamp;
}
MessageType Message::type() const
{
- return static_cast<MessageType>(GST_MESSAGE_TYPE(object()));
+ return static_cast<MessageType>(GST_MESSAGE_TYPE(object<GstMessage>()));
}
quint32 Message::sequenceNumber() const
{
- return gst_message_get_seqnum(GST_MESSAGE(object()));
+ return gst_message_get_seqnum(object<GstMessage>());
}
void Message::setSequenceNumber(quint32 num)
{
- gst_message_set_seqnum(GST_MESSAGE(object()), num);
+ gst_message_set_seqnum(object<GstMessage>(), num);
}
} //namespace QGst
diff --git a/src/QGst/miniobject.cpp b/src/QGst/miniobject.cpp
index eeb8b0c..bebcdd0 100644
--- a/src/QGst/miniobject.cpp
+++ b/src/QGst/miniobject.cpp
@@ -21,32 +21,32 @@ namespace QGst {
MiniObjectPtr MiniObject::copy() const
{
- return MiniObjectPtr::wrap(gst_mini_object_copy(GST_MINI_OBJECT(object())), false);
+ return MiniObjectPtr::wrap(gst_mini_object_copy(object<GstMiniObject>()), false);
}
bool MiniObject::isWritable() const
{
- return gst_mini_object_is_writable(GST_MINI_OBJECT(object()));
+ return gst_mini_object_is_writable(object<GstMiniObject>());
}
MiniObjectFlags MiniObject::flags() const
{
- return QFlag((GST_MINI_OBJECT_FLAGS(object())));
+ return QFlag((GST_MINI_OBJECT_FLAGS(object<GstMiniObject>())));
}
bool MiniObject::flagIsSet(MiniObjectFlag flag) const
{
- return GST_MINI_OBJECT_FLAG_IS_SET(object(), flag);
+ return GST_MINI_OBJECT_FLAG_IS_SET(object<GstMiniObject>(), flag);
}
void MiniObject::setFlag(MiniObjectFlag flag)
{
- GST_MINI_OBJECT_FLAG_SET(object(), flag);
+ GST_MINI_OBJECT_FLAG_SET(object<GstMiniObject>(), flag);
}
void MiniObject::unsetFlag(MiniObjectFlag flag)
{
- GST_MINI_OBJECT_FLAG_UNSET(object(), flag);
+ GST_MINI_OBJECT_FLAG_UNSET(object<GstMiniObject>(), flag);
}
void MiniObject::ref()
diff --git a/src/QGst/object.cpp b/src/QGst/object.cpp
index a9bdf58..833f027 100644
--- a/src/QGst/object.cpp
+++ b/src/QGst/object.cpp
@@ -21,42 +21,42 @@ namespace QGst {
QGlib::String Object::name() const
{
- return QGlib::String::fromGCharPtr(gst_object_get_name(GST_OBJECT(object())));
+ return QGlib::String::fromGCharPtr(gst_object_get_name(object<GstObject>()));
}
bool Object::setName(const QGlib::String & name)
{
- return gst_object_set_name(GST_OBJECT(object()), name);
+ return gst_object_set_name(object<GstObject>(), name);
}
ObjectPtr Object::parent() const
{
- return ObjectPtr::wrap(gst_object_get_parent(GST_OBJECT(object())), false);
+ return ObjectPtr::wrap(gst_object_get_parent(object<GstObject>()), false);
}
bool Object::setParent(const ObjectPtr & parent)
{
- return gst_object_set_parent(GST_OBJECT(object()), parent);
+ return gst_object_set_parent(object<GstObject>(), parent);
}
void Object::unparent()
{
- gst_object_unparent(GST_OBJECT(object()));
+ gst_object_unparent(object<GstObject>());
}
QGlib::String Object::namePrefix() const
{
- return QGlib::String::fromGCharPtr(gst_object_get_name_prefix(GST_OBJECT(object())));
+ return QGlib::String::fromGCharPtr(gst_object_get_name_prefix(object<GstObject>()));
}
void Object::setNamePrefix(const QGlib::String & prefix)
{
- gst_object_set_name_prefix(GST_OBJECT(object()), prefix);
+ gst_object_set_name_prefix(object<GstObject>(), prefix);
}
bool Object::isAncestorOf(const ObjectPtr & obj) const
{
- return gst_object_has_ancestor(obj, GST_OBJECT(object()));
+ return gst_object_has_ancestor(obj, object<GstObject>());
}
void Object::ref()
diff --git a/src/QGst/pad.cpp b/src/QGst/pad.cpp
index a99527b..a28994e 100644
--- a/src/QGst/pad.cpp
+++ b/src/QGst/pad.cpp
@@ -32,77 +32,77 @@ PadPtr Pad::create(PadDirection direction, const QGlib::String & name)
PadDirection Pad::direction() const
{
- return static_cast<PadDirection>(gst_pad_get_direction(GST_PAD(object())));
+ return static_cast<PadDirection>(gst_pad_get_direction(object<GstPad>()));
}
ElementPtr Pad::parentElement() const
{
- return ElementPtr::wrap(gst_pad_get_parent_element(GST_PAD(object())), false);
+ return ElementPtr::wrap(gst_pad_get_parent_element(object<GstPad>()), false);
}
PadPtr Pad::peer() const
{
- return PadPtr::wrap(gst_pad_get_peer(GST_PAD(object())), false);
+ return PadPtr::wrap(gst_pad_get_peer(object<GstPad>()), false);
}
bool Pad::isLinked() const
{
- return gst_pad_is_linked(GST_PAD(object()));
+ return gst_pad_is_linked(object<GstPad>());
}
bool Pad::canLink(const PadPtr & sink) const
{
- return gst_pad_can_link(GST_PAD(object()), sink);
+ return gst_pad_can_link(object<GstPad>(), sink);
}
PadLinkReturn Pad::link(const PadPtr & sink)
{
- return static_cast<PadLinkReturn>(gst_pad_link(GST_PAD(object()), sink));
+ return static_cast<PadLinkReturn>(gst_pad_link(object<GstPad>(), sink));
}
bool Pad::unlink(const PadPtr & sink)
{
- return gst_pad_unlink(GST_PAD(object()), sink);
+ return gst_pad_unlink(object<GstPad>(), sink);
}
CapsPtr Pad::caps() const
{
- return CapsPtr::wrap(gst_pad_get_caps_reffed(GST_PAD(object())), false);
+ return CapsPtr::wrap(gst_pad_get_caps_reffed(object<GstPad>()), false);
}
CapsPtr Pad::allowedCaps() const
{
- return CapsPtr::wrap(gst_pad_get_allowed_caps(GST_PAD(object())), false);
+ return CapsPtr::wrap(gst_pad_get_allowed_caps(object<GstPad>()), false);
}
CapsPtr Pad::negotiatedCaps() const
{
- return CapsPtr::wrap(gst_pad_get_negotiated_caps(GST_PAD(object())), false);
+ return CapsPtr::wrap(gst_pad_get_negotiated_caps(object<GstPad>()), false);
}
bool Pad::setCaps(const CapsPtr & caps)
{
- return gst_pad_set_caps(GST_PAD(object()), caps);
+ return gst_pad_set_caps(object<GstPad>(), caps);
}
bool Pad::isActive() const
{
- return gst_pad_is_active(GST_PAD(object()));
+ return gst_pad_is_active(object<GstPad>());
}
bool Pad::isBlocked() const
{
- return gst_pad_is_blocked(GST_PAD(object()));
+ return gst_pad_is_blocked(object<GstPad>());
}
bool Pad::isBlocking() const
{
- return gst_pad_is_blocking(GST_PAD(object()));
+ return gst_pad_is_blocking(object<GstPad>());
}
bool Pad::setBlocked(bool blocked)
{
- return gst_pad_set_blocked(GST_PAD(object()), blocked);
+ return gst_pad_set_blocked(object<GstPad>(), blocked);
}
}
diff --git a/src/QGst/pluginfeature.cpp b/src/QGst/pluginfeature.cpp
index 16af331..b1b3015 100644
--- a/src/QGst/pluginfeature.cpp
+++ b/src/QGst/pluginfeature.cpp
@@ -21,32 +21,32 @@ namespace QGst {
uint PluginFeature::rank() const
{
- return gst_plugin_feature_get_rank(GST_PLUGIN_FEATURE(object()));
+ return gst_plugin_feature_get_rank(object<GstPluginFeature>());
}
void PluginFeature::setRank(uint rank)
{
- gst_plugin_feature_set_rank(GST_PLUGIN_FEATURE(object()), rank);
+ gst_plugin_feature_set_rank(object<GstPluginFeature>(), rank);
}
QGlib::String PluginFeature::name() const
{
- return QGlib::String(gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(object())));
+ return QGlib::String(gst_plugin_feature_get_name(object<GstPluginFeature>()));
}
void PluginFeature::setName(const QGlib::String & name)
{
- gst_plugin_feature_set_name(GST_PLUGIN_FEATURE(object()), name);
+ gst_plugin_feature_set_name(object<GstPluginFeature>(), name);
}
bool PluginFeature::checkVersion(uint major, uint minor, uint micro) const
{
- return gst_plugin_feature_check_version(GST_PLUGIN_FEATURE(object()), major, minor, micro);
+ return gst_plugin_feature_check_version(object<GstPluginFeature>(), major, minor, micro);
}
PluginFeaturePtr PluginFeature::load() const
{
- return PluginFeaturePtr::wrap(gst_plugin_feature_load(GST_PLUGIN_FEATURE(object())), false);
+ return PluginFeaturePtr::wrap(gst_plugin_feature_load(object<GstPluginFeature>()), false);
}
}