gst-editing-services: ges: Add a runtime version checking function

Thibault Saunier tsaunier at kemper.freedesktop.org
Wed Jan 11 07:04:35 PST 2012


Module: gst-editing-services
Branch: master
Commit: ba57355d9510cabffa11162702ccfd745f54535e
URL:    http://cgit.freedesktop.org/gstreamer/gst-editing-services/commit/?id=ba57355d9510cabffa11162702ccfd745f54535e

Author: Thibault Saunier <thibault.saunier at collabora.com>
Date:   Mon Dec 26 02:54:29 2011 +0100

ges: Add a runtime version checking function

Bind it in python

API: ges_version

---

 bindings/python/ges.defs     |   10 ++++++++++
 bindings/python/ges.override |   19 +++++++++++++++++++
 docs/libs/ges-sections.txt   |    1 +
 ges/ges.c                    |   24 ++++++++++++++++++++++++
 ges/ges.h                    |   10 +++++++++-
 5 files changed, 63 insertions(+), 1 deletions(-)

diff --git a/bindings/python/ges.defs b/bindings/python/ges.defs
index e05e427..5536e63 100644
--- a/bindings/python/ges.defs
+++ b/bindings/python/ges.defs
@@ -541,6 +541,16 @@
   (return-type "gboolean")
 )
 
+(define-function version
+  (c-name "ges_version")
+  (return-type "none")
+  (parameters
+    '("guint*" "major")
+    '("guint*" "minor")
+    '("guint*" "micro")
+    '("guint*" "nano")
+  )
+)
 
 
 ;; From ges-internal.h
diff --git a/bindings/python/ges.override b/bindings/python/ges.override
index fc97dd0..e3e68e3 100644
--- a/bindings/python/ges.override
+++ b/bindings/python/ges.override
@@ -417,6 +417,25 @@ _wrap_ges_track_object_list_children_properties (PyGObject *self)
 }
 
 %%
+override ges_version noargs
+static PyObject *
+_wrap_ges_version (PyObject *self)
+{
+    guint	major, minor, micro, nano;
+    PyObject	*py_tuple;
+
+    ges_version (&major, &minor, &micro, &nano);
+    py_tuple = PyTuple_New(4);
+    PyTuple_SetItem(py_tuple, 0, PyInt_FromLong(major));
+    PyTuple_SetItem(py_tuple, 1, PyInt_FromLong(minor));
+    PyTuple_SetItem(py_tuple, 2, PyInt_FromLong(micro));
+    PyTuple_SetItem(py_tuple, 3, PyInt_FromLong(nano));
+
+    return py_tuple;
+}
+
+
+%%
 ignore-glob
 
   *_get_type
diff --git a/docs/libs/ges-sections.txt b/docs/libs/ges-sections.txt
index f7e5af2..cab3976 100644
--- a/docs/libs/ges-sections.txt
+++ b/docs/libs/ges-sections.txt
@@ -4,6 +4,7 @@
 <FILE>ges-common</FILE>
 <TITLE>Initialization</TITLE>
 ges_init
+ges_version
 <SUBSECTION Standard>
 GES_PADDING
 </SECTION>
diff --git a/ges/ges.c b/ges/ges.c
index 237e579..73374f9 100644
--- a/ges/ges.c
+++ b/ges/ges.c
@@ -83,3 +83,27 @@ ges_init (void)
 
   return TRUE;
 }
+
+
+/**
+ * ges_version:
+ * @major: (out): pointer to a guint to store the major version number
+ * @minor: (out): pointer to a guint to store the minor version number
+ * @micro: (out): pointer to a guint to store the micro version number
+ * @nano:  (out): pointer to a guint to store the nano version number
+ *
+ * Gets the version number of the GStreamer Editing Services library.
+ */
+void
+ges_version (guint * major, guint * minor, guint * micro, guint * nano)
+{
+  g_return_if_fail (major);
+  g_return_if_fail (minor);
+  g_return_if_fail (micro);
+  g_return_if_fail (nano);
+
+  *major = GES_VERSION_MAJOR;
+  *minor = GES_VERSION_MINOR;
+  *micro = GES_VERSION_MICRO;
+  *nano = GES_VERSION_NANO;
+}
diff --git a/ges/ges.h b/ges/ges.h
index 123da7a..5e0214d 100644
--- a/ges/ges.h
+++ b/ges/ges.h
@@ -69,7 +69,15 @@
 
 G_BEGIN_DECLS
 
-gboolean ges_init (void);
+#define GES_VERSION_MAJOR (0)
+#define GES_VERSION_MINOR (10)
+#define GES_VERSION_MICRO (1)
+#define GES_VERSION_NANO (1)
+
+gboolean ges_init    (void);
+
+void     ges_version (guint * major, guint * minor, guint * micro,
+                      guint * nano);
 
 G_END_DECLS
 



More information about the gstreamer-commits mailing list