00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "miniobject.h"
00018 #include "objectstore_p.h"
00019 #include <gst/gst.h>
00020
00021 namespace QGst {
00022
00023 MiniObjectPtr MiniObject::copy() const
00024 {
00025 return MiniObjectPtr::wrap(gst_mini_object_copy(object<GstMiniObject>()), false);
00026 }
00027
00028 bool MiniObject::isWritable() const
00029 {
00030 return gst_mini_object_is_writable(object<GstMiniObject>());
00031 }
00032
00033 void MiniObject::ref(bool increaseRef)
00034 {
00035 if (Private::ObjectStore::put(this)) {
00036 if (increaseRef) {
00037 gst_mini_object_ref(GST_MINI_OBJECT(m_object));
00038 }
00039 }
00040 }
00041
00042 void MiniObject::unref()
00043 {
00044 if (Private::ObjectStore::take(this)) {
00045 gst_mini_object_unref(GST_MINI_OBJECT(m_object));
00046 delete this;
00047 }
00048 }
00049
00050 MiniObjectPtr MiniObject::makeWritable() const
00051 {
00052
00053
00054
00055
00056
00057
00058 if (!isWritable()) {
00059 return copy();
00060 } else {
00061 return MiniObjectPtr(const_cast<MiniObject*>(this));
00062 }
00063 }
00064
00065
00066 namespace Private {
00067
00068 QGlib::RefCountedObject *wrapMiniObject(void *miniObject)
00069 {
00070 return QGlib::constructWrapper(QGlib::Type::fromInstance(miniObject), miniObject);
00071 }
00072
00073 }
00074 }