gstreamer/gst/pbutils.override
Edward Hervey f6bd62ac46 gst/Makefile.am: gst.pbutils also needs to handle miniobjects
Original commit message from CVS:
* gst/Makefile.am:
gst.pbutils also needs to handle miniobjects
* gst/pbutils.defs:
Add new InstallPluginsContext boxed definition.
All the *_new() functions should be accessible (and not act as
constructors).
* gst/pbutils.override:
Add override for install_plugins_sync().
* gst/pbutilsmodule.c:
Add pygst_debug debug category in this module too.
* testsuite/test_pbutils.py:
Test existence of new API. Needs more tests.
2008-01-11 16:30:45 +00:00

112 lines
3.1 KiB
C

/* -*- Mode: C; c-basic-offset: 4 -*- */
/* gst-python
* Copyright (C) 2008 <edward.hervey@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
%%
headers
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "common.h"
#include <gst/gst.h>
#include <gst/pbutils/pbutils.h>
#include "pygstminiobject.h"
GST_DEBUG_CATEGORY_EXTERN (pygst_debug);
#define GST_CAT_DEFAULT pygst_debug
%%
modulename gst.pbutils
%%
import gobject.GObject as PyGObject_Type
import gst.Object as PyGstObject_Type
import gst.Structure as PyGstStructure_Type
import gst.Element as PyGstElement_Type
import gst.Message as PyGstMessage_Type
%%
include
gstversion.override
%%
ignore-glob
_*
*init
*_free
*_get_type
%%
override gst_install_plugins_sync kwargs
static PyObject *
_wrap_gst_install_plugins_sync(PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "details", "context", NULL };
PyObject *py_ctx;
GstInstallPluginsContext *ctx;
GstInstallPluginsReturn ret;
gchar **details;
gint len;
PyObject *py_ret;
PyObject *py_details;
Py_ssize_t i;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:install_plugins_async",
kwlist, &py_details, &py_ctx))
return NULL;
if (!pyg_boxed_check(py_ctx, GST_TYPE_INSTALL_PLUGINS_CONTEXT)) {
PyErr_SetString(PyExc_TypeError, "Argument 2 must be a gst.pbutils.InstallPluginsContext");
return NULL;
}
len = PySequence_Size(py_details);
if ((!PySequence_Check(py_details)) || (len < 1)) {
PyErr_SetString(PyExc_TypeError, "Details need to be a non-empty list or tuple of strings");
Py_DECREF(py_details);
return NULL;
}
details = g_new0(gchar*, len+1);
/* Check all items in py_details are strings */
for (i = 0; i < len; i++) {
PyObject *py_str = PySequence_GetItem(py_details, i);
gchar *str;
if (!PyString_Check(py_str)) {
PyErr_SetString(PyExc_TypeError, "Details need to be a non-empty list or tuple of strings");
Py_DECREF(py_str);
Py_DECREF(py_details);
return NULL;
}
if (!(str = PyString_AsString(py_str))) {
Py_DECREF(py_str);
Py_DECREF(py_details);
return NULL;
}
details[i] = g_strdup(str);
Py_DECREF(py_str);
}
ctx = (GstInstallPluginsContext *) pyg_boxed_get(py_ctx, GstInstallPluginsContext);
ret = gst_install_plugins_sync(details, ctx);
g_strfreev(details);
py_ret = pyg_enum_from_gtype(GST_TYPE_INSTALL_PLUGINS_RETURN, ret);
return py_ret;
}