summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2014-05-03 01:10:20 +0200
committerGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2014-05-03 22:31:58 +0300
commitf63d953647ba3ac09722c9d7edf57380fa07a71a (patch)
treee34cdf4e97ba3413a60b0a272bb76f61193bd8ba
parent5e9b7f411b5256d53eeeef7abb3d75b167c0bc28 (diff)
QGst::Caps: drop custom ref/unref/isWritable/makeWritable, since they are now inherited from MiniObject
In 0.10 GstCaps did not inherit from anything, thus the reason why these methods were duplicated.
-rw-r--r--src/QGst/caps.cpp38
-rw-r--r--src/QGst/caps.h12
2 files changed, 6 insertions, 44 deletions
diff --git a/src/QGst/caps.cpp b/src/QGst/caps.cpp
index edc452d..8d2b05f 100644
--- a/src/QGst/caps.cpp
+++ b/src/QGst/caps.cpp
@@ -124,12 +124,6 @@ bool Caps::isFixed() const
return gst_caps_is_fixed(object<GstCaps>());
}
-bool Caps::isWritable() const
-{
- GstCaps *caps = object<GstCaps>(); //workaround for bug #653266
- return (GST_CAPS_REFCOUNT_VALUE(caps) == 1);
-}
-
bool Caps::equals(const CapsPtr & caps2) const
{
return gst_caps_is_equal(object<GstCaps>(), caps2);
@@ -175,38 +169,6 @@ CapsPtr Caps::copyNth(uint index) const
return CapsPtr::wrap(gst_caps_copy_nth(object<GstCaps>(), index), false);
}
-void Caps::ref(bool increaseRef)
-{
- if (Private::ObjectStore::put(this)) {
- if (increaseRef) {
- gst_caps_ref(GST_CAPS(m_object));
- }
- }
-}
-
-void Caps::unref()
-{
- if (Private::ObjectStore::take(this)) {
- gst_caps_unref(GST_CAPS(m_object));
- delete this;
- }
-}
-
-CapsPtr Caps::makeWritable() const
-{
- /*
- * Calling gst_*_make_writable() below is tempting but wrong.
- * Since MiniObjects and Caps do not share the same C++ instance in various wrappings, calling
- * gst_*_make_writable() on an already writable object and wrapping the result is wrong,
- * since it would just return the same pointer and we would wrap it in a new C++ instance.
- */
- if (!isWritable()) {
- return copy();
- } else {
- return CapsPtr(const_cast<Caps*>(this));
- }
-}
-
QDebug operator<<(QDebug debug, const CapsPtr & caps)
{
debug.nospace() << "QGst::Caps(" << caps->toString() << ")";
diff --git a/src/QGst/caps.h b/src/QGst/caps.h
index c6717f8..741e97a 100644
--- a/src/QGst/caps.h
+++ b/src/QGst/caps.h
@@ -70,12 +70,7 @@ public:
CapsPtr copy() const;
CapsPtr copyNth(uint index) const;
- bool isWritable() const;
- CapsPtr makeWritable() const;
-
-protected:
- virtual void ref(bool increaseRef);
- virtual void unref();
+ inline CapsPtr makeWritable() const;
};
template <typename T>
@@ -90,6 +85,11 @@ inline CapsPtr Caps::fromString(const QString & string)
return fromString(string.toUtf8().constData());
}
+inline CapsPtr Caps::makeWritable() const
+{
+ return MiniObject::makeWritable().staticCast<Caps>();
+}
+
/*! \relates QGst::Caps */
QTGSTREAMER_EXPORT QDebug operator<<(QDebug debug, const CapsPtr & caps);