[farsight2/master] python: Use fs_session_get_stream_transmitter_type

Olivier Crête olivier.crete at collabora.co.uk
Tue Jul 14 09:50:53 PDT 2009


---
 python/pyfarsight.override |   27 ++++++++-------------------
 1 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/python/pyfarsight.override b/python/pyfarsight.override
index 930fd34..a09a696 100644
--- a/python/pyfarsight.override
+++ b/python/pyfarsight.override
@@ -7,7 +7,6 @@ headers
 
 #include <gst/farsight/fs-conference-iface.h>
 
-#include <gst/farsight/fs-transmitter.h>
 #include <gst/farsight/fs-element-added-notifier.h>
 
 /* This is new in python 2.5 */
@@ -184,7 +183,6 @@ _wrap_fs_session_new_stream(PyGObject *self, PyObject *args, PyObject *kwargs)
   PyObject *st_params = NULL;
   Py_ssize_t pos = 0, i = 0;
   PyObject *key, *value;
-  FsTransmitter *transmitter = NULL;
   GObjectClass *st_class  = NULL;
   GError *error = NULL;
   FsStream *stream = NULL;
@@ -201,26 +199,20 @@ _wrap_fs_session_new_stream(PyGObject *self, PyObject *args, PyObject *kwargs)
 
   if (transmitter_name && st_params)
   {
-    n_parameters = PyDict_Size (st_params);
-
-    parameters = g_new0 (GParameter, n_parameters);
+    GType st_type = 0;
 
     Py_BEGIN_ALLOW_THREADS
-    transmitter = fs_transmitter_new (transmitter_name, 2, &error);
+    st_type = fs_session_get_stream_transmitter_type (
+        FS_SESSION (pygobject_get (self)), transmitter_name);
     Py_END_ALLOW_THREADS
-    if (!transmitter)
+
+    if (!st_type)
       goto error;
 
-    Py_BEGIN_ALLOW_THREADS
-    st_class = g_type_class_ref (
-        fs_transmitter_get_stream_transmitter_type (transmitter));
-    Py_END_ALLOW_THREADS
+    st_class = g_type_class_ref (st_type);
 
-    if (!FS_IS_STREAM_TRANSMITTER_CLASS (st_class))
-    {
-      PyErr_SetString (PyExc_TypeError, "Invalid transmitter name passed");
-      goto error;
-    }
+    n_parameters = PyDict_Size (st_params);
+    parameters = g_new0 (GParameter, n_parameters);
 
     while (PyDict_Next(st_params, &pos, &key, &value))
     {
@@ -273,7 +265,6 @@ _wrap_fs_session_new_stream(PyGObject *self, PyObject *args, PyObject *kwargs)
   {
     g_type_class_unref (st_class);
     g_free (parameters);
-    g_object_unref (transmitter);
   }
 
   py_ret = pygobject_new (G_OBJECT (stream));
@@ -289,8 +280,6 @@ _wrap_fs_session_new_stream(PyGObject *self, PyObject *args, PyObject *kwargs)
     g_type_class_unref (st_class);
   if (parameters)
     g_free (parameters);
-  if (transmitter)
-    g_object_unref (transmitter);
 
   return NULL;
 }
-- 
1.5.6.5




More information about the farsight-commits mailing list