~ubuntu-branches/ubuntu/precise/gst0.10-python/precise

« back to all changes in this revision

Viewing changes to gst/gstelementfactory.override

  • Committer: Bazaar Package Importer
  • Author(s): Loic Minier
  • Date: 2006-06-25 19:37:45 UTC
  • Revision ID: james.westby@ubuntu.com-20060625193745-9yeg0wq56r24n57x
Tags: upstream-0.10.4
ImportĀ upstreamĀ versionĀ 0.10.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; c-basic-offset: 4 -*- */
 
2
/*
 
3
 * gstelementfactory.override - gstreamer element factory override
 
4
 * Copyright (C) 2005 Alessandro Decina
 
5
 * 
 
6
 * Authors:
 
7
 *   Alessandro Decina <alessandro@nnva.org>
 
8
 *
 
9
 * This library is free software; you can redistribute it and/or
 
10
 * modify it under the terms of the GNU Library General Public
 
11
 * License as published by the Free Software Foundation; either
 
12
 * version 2 of the License, or (at your option) any later version.
 
13
 *
 
14
 * This library is distributed in the hope that it will be useful,
 
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
17
 * Library General Public License for more details.
 
18
 *
 
19
 * You should have received a copy of the GNU Library General Public
 
20
 * License along with this library; if not, write to the
 
21
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
22
 * Boston, MA 02111-1307, USA.
 
23
 */
 
24
 
 
25
%%
 
26
override gst_element_factory_make kwargs
 
27
static PyObject *
 
28
_wrap_gst_element_factory_make(PyObject *self, PyObject *args, PyObject *kwargs){
 
29
    static char *kwlist[] = { "factoryname", "name", NULL };
 
30
    char *factoryname, *name = NULL;
 
31
    PyObject *py_ret;
 
32
    GstElement *ret;
 
33
 
 
34
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|z:element_factory_make", kwlist, &factoryname, &name))
 
35
        return NULL;
 
36
    ret = gst_element_factory_make(factoryname, name);
 
37
    if (ret == NULL) {
 
38
        PyErr_SetString(PyGstExc_PluginNotFoundError, factoryname);
 
39
        return NULL;
 
40
    }
 
41
    py_ret = pygstobject_new((GObject *)ret);
 
42
    pygst_object_unref((GObject *)ret);
 
43
    return py_ret;
 
44
}
 
45
%%
 
46
override gst_element_factory_get_static_pad_templates noargs
 
47
static PyObject *
 
48
_wrap_gst_element_factory_get_static_pad_templates(PyGObject *self)
 
49
{
 
50
  const GList *list;
 
51
  GList *l;
 
52
  PyObject *py_list;
 
53
  int i = 0;
 
54
 
 
55
  list = gst_element_factory_get_static_pad_templates (GST_ELEMENT_FACTORY (self->obj));
 
56
 
 
57
  py_list = PyList_New(g_list_length ((GList*) list));
 
58
 
 
59
  for (l = (GList*) list; l ; l = g_list_next(l), i++) {
 
60
    GstStaticPadTemplate *templ = (GstStaticPadTemplate*) l->data;
 
61
    PyList_SetItem(py_list, i, pyg_pointer_new(GST_TYPE_STATIC_PAD_TEMPLATE, (gpointer) templ));
 
62
  }
 
63
  return py_list;
 
64
}