gstreamer/bindings/python/rtspserver.override

87 lines
2.2 KiB
C

/* -*- Mode: C; c-basic-offset: 4 -*- */
%%
headers
/* include any required headers here */
#define NO_IMPORT_PYGOBJECT
#include <pygobject.h>
#include <gst/gst.h>
#include <gst/rtsp-server/rtsp-server.h>
#include <glib.h>
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
/* Boonky define that allows for backwards compatibility with Python 2.4 */
#if PY_VERSION_HEX < 0x02050000
#define Py_ssize_t int
#endif
#include <gst/rtsp-server/rtsp-server.h>
typedef struct {
PyObject_HEAD
GMainContext *context;
} PyGMainContext;
%%
import gobject.GObject as PyGObject_Type
import gobject.MainContext as PyGMainContext_Type
%%
override gst_rtsp_server_attach kwargs
static PyObject *
_wrap_gst_rtsp_server_attach (PyGObject *self,
PyObject *args, PyObject *keywords)
{
static char *kwlist[] = {"context", NULL};
PyGMainContext *py_context = NULL;
GMainContext *context = NULL;
guint res;
if (!PyArg_ParseTupleAndKeywords (args, keywords,
"|O!:GstRTSPServer.__init__", kwlist,
&PyGMainContext_Type, &py_context))
return NULL;
if (py_context)
context = py_context->context;
pyg_begin_allow_threads;
res = gst_rtsp_server_attach (GST_RTSP_SERVER (self->obj), context);
pyg_end_allow_threads;
return PyLong_FromLong (res);
}
%%
override gst_rtsp_server_create_watch kwargs
static PyObject *
_wrap_gst_rtsp_server_create_watch(PyGObject *self, PyObject *args, PyObject *keywords)
{
GSource *ret;
pyg_begin_allow_threads;
ret = gst_rtsp_server_create_watch(GST_RTSP_SERVER(self->obj));
pyg_end_allow_threads;
return pygobject_new((GObject *)ret);
}
%%
override gst_rtsp_media_mapping_add_factory kwargs
static PyObject *
_wrap_gst_rtsp_media_mapping_add_factory(PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "path", "factory", NULL };
char *path;
PyGObject *factory;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,"sO!:GstRTSPMediaMapping.add_factory", kwlist, &path, &PyGstRTSPMediaFactory_Type, &factory))
return NULL;
pyg_begin_allow_threads;
gst_rtsp_media_mapping_add_factory(GST_RTSP_MEDIA_MAPPING(self->obj), path,
g_object_ref (GST_RTSP_MEDIA_FACTORY(factory->obj)));
pyg_end_allow_threads;
Py_INCREF(Py_None);
return Py_None;
}