[farsight2/master] Add python wrapping for fs_codec_list_are_equal()

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:22:22 PST 2008


---
 python/pyfarsight.defs     |    9 +++++++++
 python/pyfarsight.override |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/python/pyfarsight.defs b/python/pyfarsight.defs
index dfb2724..d91152a 100644
--- a/python/pyfarsight.defs
+++ b/python/pyfarsight.defs
@@ -119,6 +119,15 @@
   (return-type "GstCaps*")
 )
 
+(define-function fs_codec_list_are_equal
+  (c-name "fs_codec_list_are_equal")
+  (return-type "gboolean")
+  (parameters
+    '("GList*" "list1")
+    '("GList*" "list2")
+  )
+)
+
 (define-method to_string
   (of-object "FsMediaType")
   (c-name "fs_media_type_to_string")
diff --git a/python/pyfarsight.override b/python/pyfarsight.override
index fd723d0..cbae2b3 100644
--- a/python/pyfarsight.override
+++ b/python/pyfarsight.override
@@ -668,3 +668,39 @@ _wrap_fs_session_set_local_codecs_config (PyGObject *self, PyObject *arg)
   return PyBool_FromLong (ret);
 }
 %%
+override fs_codec_list_are_equal kwargs
+static PyObject *
+_wrap_fs_codec_list_are_equal(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+  static char *kwlist[] = {"list1", "list2", NULL};
+  PyObject *pylist1 = NULL, *pylist2 = NULL;
+  GList *list1 = NULL, *list2 = NULL;
+  gboolean ret;
+
+  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO",
+          kwlist,
+	  &pylist1,
+	  &pylist2))
+    return NULL;
+
+  if (pylist1 == pylist2)
+    return PyBool_FromLong (TRUE);
+
+  list1 = _fs_codec_list_from_pysequence (pylist1);
+  if (!list1)
+    return NULL;
+
+  list2 = _fs_codec_list_from_pysequence (pylist2);
+  if (!list2)
+  {
+    g_list_free (list1);
+    return NULL;
+  }
+
+  ret = fs_codec_list_are_equal (list1, list2);
+
+  g_list_free (list1);
+  g_list_free (list2);
+
+  return PyBool_FromLong (ret);
+}
-- 
1.5.6.5




More information about the farsight-commits mailing list