mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
create an Element constructor
Original commit message from CVS: create an Element constructor
This commit is contained in:
parent
aadd62a79d
commit
7a7a6d1ca9
6 changed files with 84 additions and 4 deletions
|
@ -7,6 +7,7 @@ pygstreamer_PYTHON = __init__.py
|
|||
pygstreamerexecdir = $(pyexecdir)/gstreamer
|
||||
|
||||
# gstreamer binding
|
||||
OVERRIDES = gstreamer.override
|
||||
|
||||
pyexec_LTLIBRARIES = _gstreamermodule.la
|
||||
_gstreamermodule_la_SOURCES = gstreamermodule.c gstreamer-fixes.c gstreamer-fixes.h
|
||||
|
@ -15,8 +16,8 @@ _gstreamermodule_la_LIBADD = $(GST_LIBS)
|
|||
_gstreamermodule_la_LDFLAGS = -module -avoid-version -export-symbols-regex initgstreamer
|
||||
nodist__gstreamermodule_la_SOURCES = gstreamer.c
|
||||
CLEANFILES = gstreamer.c gstreamer-base.defs gstreamer.defs
|
||||
EXTRA_DIST = gstreamer-extra.defs gstreamer.override gstreamer-arg-types.py
|
||||
gstreamer.c: gstreamer.defs gstreamer.override
|
||||
EXTRA_DIST = gstreamer-extra.defs $(OVERRIDES) gstreamer-arg-types.py
|
||||
gstreamer.c: gstreamer.defs $(OVERRIDES)
|
||||
|
||||
GST_EXCLUDE_INCLUDES=\
|
||||
$(GST_INCLUDEDIR)/gst/gstatomic_impl.h \
|
||||
|
|
|
@ -104,3 +104,17 @@
|
|||
'("char*" "data")
|
||||
)
|
||||
)
|
||||
|
||||
;;
|
||||
;; Element constructor override; uses a nonexistant make_element
|
||||
;; which is defined in gstreamer.overrides
|
||||
;;
|
||||
(define-function gst_element_factory_make_element
|
||||
(is-constructor-of "GstElement")
|
||||
(c-name "gst_element_factory_make_element")
|
||||
(return-type "GstElement*")
|
||||
(parameters
|
||||
'("const-gchar*" "elementname")
|
||||
'("const-gchar*" "name")
|
||||
)
|
||||
)
|
||||
|
|
|
@ -437,6 +437,8 @@ _wrap_gst_props_entry_get_float_range(PyObject *self)
|
|||
%%
|
||||
override gst_props_entry_get_list
|
||||
|
||||
|
||||
|
||||
static PyObject *
|
||||
_wrap_gst_props_entry_get_list(PyObject *self)
|
||||
{
|
||||
|
@ -491,3 +493,26 @@ _wrap_gst_props_get_list(PyObject *self)
|
|||
}
|
||||
return Py_BuildValue("(bO)", ret, tuple);
|
||||
}
|
||||
|
||||
|
||||
%%
|
||||
override gst_element_factory_make_element
|
||||
|
||||
/* we create this function to serve as a constructor for Element */
|
||||
static int
|
||||
_wrap_gst_element_factory_make_element(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = { "factoryname", "name", NULL };
|
||||
char *factoryname, *name;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ss:GstElement.__init__", kwlist, &factoryname, &name))
|
||||
return -1;
|
||||
self->obj = (GObject *)gst_element_factory_make(factoryname, name);
|
||||
|
||||
if (!self->obj) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "could not create GstElement object");
|
||||
return -1;
|
||||
}
|
||||
pygobject_register_wrapper((PyObject *)self);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ pygstreamer_PYTHON = __init__.py
|
|||
pygstreamerexecdir = $(pyexecdir)/gstreamer
|
||||
|
||||
# gstreamer binding
|
||||
OVERRIDES = gstreamer.override
|
||||
|
||||
pyexec_LTLIBRARIES = _gstreamermodule.la
|
||||
_gstreamermodule_la_SOURCES = gstreamermodule.c gstreamer-fixes.c gstreamer-fixes.h
|
||||
|
@ -15,8 +16,8 @@ _gstreamermodule_la_LIBADD = $(GST_LIBS)
|
|||
_gstreamermodule_la_LDFLAGS = -module -avoid-version -export-symbols-regex initgstreamer
|
||||
nodist__gstreamermodule_la_SOURCES = gstreamer.c
|
||||
CLEANFILES = gstreamer.c gstreamer-base.defs gstreamer.defs
|
||||
EXTRA_DIST = gstreamer-extra.defs gstreamer.override gstreamer-arg-types.py
|
||||
gstreamer.c: gstreamer.defs gstreamer.override
|
||||
EXTRA_DIST = gstreamer-extra.defs $(OVERRIDES) gstreamer-arg-types.py
|
||||
gstreamer.c: gstreamer.defs $(OVERRIDES)
|
||||
|
||||
GST_EXCLUDE_INCLUDES=\
|
||||
$(GST_INCLUDEDIR)/gst/gstatomic_impl.h \
|
||||
|
|
|
@ -104,3 +104,17 @@
|
|||
'("char*" "data")
|
||||
)
|
||||
)
|
||||
|
||||
;;
|
||||
;; Element constructor override; uses a nonexistant make_element
|
||||
;; which is defined in gstreamer.overrides
|
||||
;;
|
||||
(define-function gst_element_factory_make_element
|
||||
(is-constructor-of "GstElement")
|
||||
(c-name "gst_element_factory_make_element")
|
||||
(return-type "GstElement*")
|
||||
(parameters
|
||||
'("const-gchar*" "elementname")
|
||||
'("const-gchar*" "name")
|
||||
)
|
||||
)
|
||||
|
|
|
@ -437,6 +437,8 @@ _wrap_gst_props_entry_get_float_range(PyObject *self)
|
|||
%%
|
||||
override gst_props_entry_get_list
|
||||
|
||||
|
||||
|
||||
static PyObject *
|
||||
_wrap_gst_props_entry_get_list(PyObject *self)
|
||||
{
|
||||
|
@ -491,3 +493,26 @@ _wrap_gst_props_get_list(PyObject *self)
|
|||
}
|
||||
return Py_BuildValue("(bO)", ret, tuple);
|
||||
}
|
||||
|
||||
|
||||
%%
|
||||
override gst_element_factory_make_element
|
||||
|
||||
/* we create this function to serve as a constructor for Element */
|
||||
static int
|
||||
_wrap_gst_element_factory_make_element(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = { "factoryname", "name", NULL };
|
||||
char *factoryname, *name;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ss:GstElement.__init__", kwlist, &factoryname, &name))
|
||||
return -1;
|
||||
self->obj = (GObject *)gst_element_factory_make(factoryname, name);
|
||||
|
||||
if (!self->obj) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "could not create GstElement object");
|
||||
return -1;
|
||||
}
|
||||
pygobject_register_wrapper((PyObject *)self);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue