wrap gst_plugin_get_version so it returns a tuple
authorThomas Vander Stichele <thomas@apestaart.org>
Tue, 12 Apr 2005 16:29:49 +0000 (16:29 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Tue, 12 Apr 2005 16:29:49 +0000 (16:29 +0000)
Original commit message from CVS:
wrap gst_plugin_get_version so it returns a tuple

ChangeLog
gst/gst.defs
gst/gst.override

index b39c444..4157820 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2005-04-12  Thomas Vander Stichele  <thomas at apestaart dot org>
 
+       * gst/gst.defs:
+       * gst/gst.override:
+         wrap gst_plugin_get_version so it returns a tuple
+
+2005-04-12  Thomas Vander Stichele  <thomas at apestaart dot org>
+
        * testsuite/test_probe.py:
          add test for probes
 
index 0a89792..99a5fc7 100644 (file)
   (return-type "const-gchar*")
 )
 
+(define-method get_version
+  (of-object "GstPlugin")
+  (c-name "gst_plugin_get_version")
+  (return-type "const-gchar*")
+)
+
 (define-method get_module
   (of-object "GstPlugin")
   (c-name "gst_plugin_get_module")
index cdc2d48..88291a6 100644 (file)
@@ -99,7 +99,6 @@ ignore
   gst_alloc_trace_list
   gst_alloc_trace_get
   gst_error_get_message
-  gst_object_default_deep_notify
   gst_object_check_uniqueness
   gst_object_replace
   gst_parse_launchv
@@ -739,3 +738,29 @@ _wrap_gst_probe_perform(PyGBoxed *self, PyObject *args, PyObject *kwargs)
 
        return PyBool_FromLong(gst_probe_perform(self->boxed, &data));
 }
+%%
+override gst_plugin_get_version
+static PyObject *
+_wrap_gst_plugin_get_version(PyGObject *self)
+{
+        PyObject *tuple;
+        const gchar *version;
+        gchar **items, **p;
+        gint i = 0;
+        gint count = 0;
+        
+        version = gst_plugin_get_version((GstPlugin *) self->obj);
+        items = g_strsplit(version, ".", 4);
+        for (p = items; *p; ++p) ++count;
+
+       tuple = PyTuple_New(count);
+        for (p = items; *p; ++p) {
+                PyObject *item;
+                item = PyInt_FromString(*p, NULL, 10);
+                PyTuple_SetItem(tuple, i, item);
+                i++;
+        }
+
+        g_strfreev(items);
+        return tuple;
+}