1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
%%
headers
#include <pygobject.h>
#include <gst/gst.h>
#include <telepathy-farstream/telepathy-farstream.h>
#include <telepathy-glib/dbus.h>
#include <telepathy-glib/channel.h>
#include "pygstminiobject.h"
static void
async_result_callback_marshal(GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
PyObject *callback = user_data;
PyObject *ret;
PyGILState_STATE state;
state = pyg_gil_state_ensure();
ret = PyObject_CallFunction(callback, "NN",
pygobject_new(source_object),
pygobject_new((GObject *)result));
if (ret == NULL) {
PyErr_Print();
PyErr_Clear();
}
Py_XDECREF(callback);
Py_XDECREF(ret);
pyg_gil_state_release(state);
}
%%
modulename tf
%%
import gobject.GObject as PyGObject_Type
import gst.Message as PyGstMessage_Type
%%
ignore-glob
*_get_type
%%
headers
%%
override tf_channel_new_async kwargs
static PyObject *
_wrap_tf_channel_new_async(PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "connection_busname", "connection_path",
"channel_path", "callback", NULL };
char *busname, *connection_path, *channel_path;
TpChannel *proxy = NULL;
TpConnection *connection = NULL;
TpDBusDaemon *dbus = NULL;
GError *error = NULL;
PyObject *callback;
PyObject *ret = NULL;
if (!PyArg_ParseTupleAndKeywords (args, kwargs, "sssO:tf_channel_new_async",
kwlist, &busname, &connection_path, &channel_path, &callback))
goto out;
dbus = tp_dbus_daemon_dup (&error);
if (dbus == NULL)
{
pyg_error_check (&error);
goto out;
}
connection = tp_connection_new (dbus, busname, connection_path, &error);
if (connection == NULL)
{
pyg_error_check (&error);
goto out;
}
proxy = tp_channel_new (connection, channel_path, NULL,
TP_UNKNOWN_HANDLE_TYPE, 0, &error);
if (proxy == NULL)
{
pyg_error_check (&error);
goto out;
}
ret = Py_None;
Py_XINCREF (callback);
tf_channel_new_async (proxy, async_result_callback_marshal, callback);
out:
if (dbus != NULL)
g_object_unref (dbus);
if (connection != NULL)
g_object_unref (connection);
if (proxy != NULL)
g_object_unref (proxy);
return ret;
}
|