[gstreamermm] MiniObject: Make it an opaque refcounted class generated by gmmproc.



commit ba60241eeef5d1b2e4cae59db03b2c13657b9ab2
Author: José Alburquerque <jaalburquerque gmail com>
Date:   Tue Jul 16 18:32:30 2013 -0400

    MiniObject: Make it an opaque refcounted class generated by gmmproc.
    
        * gstreamer/gstreamermm/filelist.am:
        * gstreamer/gstreamermm/miniobject.{cc,h}:
        * gstreamer/gstreamermm/private/miniobject_p.h: Remove these files and
        remove them from the build.
        * gstreamer/gstreamermm/private/.gitignore: Also update the .gitignore
        file.
    
        * gstreamer/src/filelist.am:
        * gstreamer/src/miniobject.{ccg,hg}: Add these new files wrapping
        GstMiniObject and include the files in the build.
        * gstreamer/src/enums.hg (MiniObjectFlags): Move enum to the
        miniobject.hg file.
        * tools/m4/convert_gst.m4: Update the conversions file to include
        needed conversions.

 gstreamer/gstreamermm/filelist.am                  |    4 +-
 gstreamer/gstreamermm/miniobject.cc                |  206 --------------------
 gstreamer/gstreamermm/miniobject.h                 |  177 -----------------
 gstreamer/gstreamermm/private/.gitignore           |    1 -
 gstreamer/src/enums.hg                             |    1 -
 gstreamer/src/filelist.am                          |    1 +
 .../private/miniobject_p.h => src/miniobject.ccg}  |   43 ++---
 gstreamer/src/miniobject.hg                        |   52 +++++
 tools/m4/convert_gst.m4                            |    2 +
 9 files changed, 68 insertions(+), 419 deletions(-)
---
diff --git a/gstreamer/gstreamermm/filelist.am b/gstreamer/gstreamermm/filelist.am
index 2e2de35..a4c7099 100644
--- a/gstreamer/gstreamermm/filelist.am
+++ b/gstreamer/gstreamermm/filelist.am
@@ -7,15 +7,13 @@ files_extra_cc =                \
         init.cc                 \
         gst_wrap_init.cc        \
         handle_error.cc         \
-        miniobject.cc           \
         version.cc              \
         wrap.cc
 files_extra_h  =                \
         init.h                  \
         gst_wrap_init.h         \
         handle_error.h          \
-        miniobject.h            \
         version.h               \
         wrap.h                  \
         wrap_init.h
-files_extra_ph = private/miniobject_p.h
+files_extra_ph = 
diff --git a/gstreamer/gstreamermm/private/.gitignore b/gstreamer/gstreamermm/private/.gitignore
index 4294d85..0cb5a60 100644
--- a/gstreamer/gstreamermm/private/.gitignore
+++ b/gstreamer/gstreamermm/private/.gitignore
@@ -1,2 +1 @@
 /*_p.h
-!/miniobject_p.h
diff --git a/gstreamer/src/enums.hg b/gstreamer/src/enums.hg
index 25daaa8..139462c 100644
--- a/gstreamer/src/enums.hg
+++ b/gstreamer/src/enums.hg
@@ -35,7 +35,6 @@ enum GstAutoplugSelectResult
 namespace Gst
 {
 
-_WRAP_ENUM(MiniObjectFlags, GstMiniObjectFlags)
 _WRAP_ENUM(State, GstState)
 
 // Plug-in non-genereated enums.  Handled manually and not generated because
diff --git a/gstreamer/src/filelist.am b/gstreamer/src/filelist.am
index 1cd4942..67bee06 100644
--- a/gstreamer/src/filelist.am
+++ b/gstreamer/src/filelist.am
@@ -119,6 +119,7 @@ files_hg  =                     \
         interface.hg            \
         iterator.hg             \
         message.hg              \
+        miniobject.hg           \
         mixer.hg                \
         mixeroptions.hg         \
         mixertrack.hg           \
diff --git a/gstreamer/gstreamermm/private/miniobject_p.h b/gstreamer/src/miniobject.ccg
similarity index 54%
rename from gstreamer/gstreamermm/private/miniobject_p.h
rename to gstreamer/src/miniobject.ccg
index 6e6902a..dca2eff 100644
--- a/gstreamer/gstreamermm/private/miniobject_p.h
+++ b/gstreamer/src/miniobject.ccg
@@ -17,39 +17,20 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#ifndef _GSTREAMERMM_MINIOBJECT_P_H
-#define _GSTREAMERMM_MINIOBJECT_P_H
-
-#include <glibmm/class.h>
+#include <gstreamermm/miniobject.h>
+#include <gstreamermm/private/miniobject_p.h>
 
 namespace Gst
 {
 
-class MiniObject_Class : public Glib::Class
+MiniObject::~MiniObject()
 {
-public:
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-  typedef MiniObject       CppObjectType;
-  typedef GstMiniObject      BaseObjectType;
-  typedef GstMiniObjectClass BaseClassType;
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
-  const Glib::Class& init();
-
-  static void class_init_function(void* g_class, void* class_data);
-
-  static Gst::MiniObject* wrap_new(GstMiniObject*);
-
-protected:
-
-  static GstMiniObject* copy_vfunc_callback(const GstMiniObject* self);
-  static void finalize_vfunc_callback(GstMiniObject* self);
-
-};
-
-
-} // namespace Gst
-
-
-#endif /* _GSTREAMERMM_MINIOBJECT_P_H */
-
+  // The value of the reference count is checked so that if this mini object is
+  // being destroyed as a result of weak reference notification no
+  // unreferencing is done and thus no error is issued on unreferencing a mini
+  // object with a reference of 0.
+  if(gobject_ && GST_MINI_OBJECT_REFCOUNT_VALUE(gobject_) > 0)
+    gst_mini_object_unref(gobject_);
+}
+
+} //namespace Gst
diff --git a/gstreamer/src/miniobject.hg b/gstreamer/src/miniobject.hg
new file mode 100644
index 0000000..cb3520f
--- /dev/null
+++ b/gstreamer/src/miniobject.hg
@@ -0,0 +1,52 @@
+/* gstreamermm - a C++ wrapper for gstreamer
+ *
+ * Copyright 2008 The gstreamermm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gst/gstminiobject.h>
+#include <glibmm/value.h>
+
+_DEFS(gstreamermm,gst)
+
+namespace Gst
+{
+
+_WRAP_ENUM(MiniObjectFlags, GstMiniObjectFlags)
+_WRAP_ENUM(LockFlags, GstLockFlags)
+
+/** This is a base class for some gstreamermm objects.
+ * It is similar to Glib::Object but has no GObject property or signal support.
+ */
+class MiniObject
+{
+  _CLASS_OPAQUE_REFCOUNTED(MiniObject, GstMiniObject, gst_mini_object_new, gst_mini_object_ref, 
gst_mini_object_unref)
+  _IGNORE(gst_mini_object_ref, gst_mini_object_unref)
+
+public:
+  _MEMBER_GET(flags, flags, guint, guint)
+  _MEMBER_SET(flags, flags, guint, guint)
+
+  _WRAP_METHOD(bool lock(LockFlags flags), gst_mini_object_lock)
+  _WRAP_METHOD(void unlock(LockFlags flags), gst_mini_object_unlock)
+  _WRAP_METHOD(bool is_writable() const, gst_mini_object_is_writable)
+  _WRAP_METHOD(Glib::RefPtr<MiniObject> create_writable(), gst_mini_object_make_writable)
+
+  // Copying a mini object can be achieved by assignment.
+  _IGNORE(gst_mini_object_copy)
+};
+
+} // namespace Gst
diff --git a/tools/m4/convert_gst.m4 b/tools/m4/convert_gst.m4
index 03fc7f9..34b44b2 100644
--- a/tools/m4/convert_gst.m4
+++ b/tools/m4/convert_gst.m4
@@ -23,6 +23,7 @@ _CONV_ENUM(Gst,IndexEntryType)
 _CONV_ENUM(Gst,IndexFlags)
 _CONV_ENUM(Gst,IndexLookupMethod)
 _CONV_ENUM(Gst,IndexResolverMethod)
+_CONV_ENUM(Gst,LockFlags)
 _CONV_ENUM(Gst,MessageType)
 _CONV_ENUM(Gst,MixerFlags)
 _CONV_ENUM(Gst,MixerType)
@@ -135,6 +136,7 @@ _CONVERSION(`GstMessage*',`Glib::RefPtr<const Gst::Message>',`Gst::Message::wrap
 _CONVERSION(`const Glib::RefPtr<Gst::Message>&',`GstMessage*', `Gst::unwrap($3)')
 
 dnl MiniObject
+_CONVERSION(`GstMiniObject*',`Glib::RefPtr<MiniObject>',`Glib::wrap($3)')
 _CONVERSION(`const Glib::RefPtr<Gst::MiniObject>&',`GstMiniObject*',`Gst::unwrap($3)')
 
 dnl Mixer


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]