mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +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
|
pygstreamerexecdir = $(pyexecdir)/gstreamer
|
||||||
|
|
||||||
# gstreamer binding
|
# gstreamer binding
|
||||||
|
OVERRIDES = gstreamer.override
|
||||||
|
|
||||||
pyexec_LTLIBRARIES = _gstreamermodule.la
|
pyexec_LTLIBRARIES = _gstreamermodule.la
|
||||||
_gstreamermodule_la_SOURCES = gstreamermodule.c gstreamer-fixes.c gstreamer-fixes.h
|
_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
|
_gstreamermodule_la_LDFLAGS = -module -avoid-version -export-symbols-regex initgstreamer
|
||||||
nodist__gstreamermodule_la_SOURCES = gstreamer.c
|
nodist__gstreamermodule_la_SOURCES = gstreamer.c
|
||||||
CLEANFILES = gstreamer.c gstreamer-base.defs gstreamer.defs
|
CLEANFILES = gstreamer.c gstreamer-base.defs gstreamer.defs
|
||||||
EXTRA_DIST = gstreamer-extra.defs gstreamer.override gstreamer-arg-types.py
|
EXTRA_DIST = gstreamer-extra.defs $(OVERRIDES) gstreamer-arg-types.py
|
||||||
gstreamer.c: gstreamer.defs gstreamer.override
|
gstreamer.c: gstreamer.defs $(OVERRIDES)
|
||||||
|
|
||||||
GST_EXCLUDE_INCLUDES=\
|
GST_EXCLUDE_INCLUDES=\
|
||||||
$(GST_INCLUDEDIR)/gst/gstatomic_impl.h \
|
$(GST_INCLUDEDIR)/gst/gstatomic_impl.h \
|
||||||
|
|
|
@ -104,3 +104,17 @@
|
||||||
'("char*" "data")
|
'("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
|
override gst_props_entry_get_list
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_wrap_gst_props_entry_get_list(PyObject *self)
|
_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);
|
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
|
pygstreamerexecdir = $(pyexecdir)/gstreamer
|
||||||
|
|
||||||
# gstreamer binding
|
# gstreamer binding
|
||||||
|
OVERRIDES = gstreamer.override
|
||||||
|
|
||||||
pyexec_LTLIBRARIES = _gstreamermodule.la
|
pyexec_LTLIBRARIES = _gstreamermodule.la
|
||||||
_gstreamermodule_la_SOURCES = gstreamermodule.c gstreamer-fixes.c gstreamer-fixes.h
|
_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
|
_gstreamermodule_la_LDFLAGS = -module -avoid-version -export-symbols-regex initgstreamer
|
||||||
nodist__gstreamermodule_la_SOURCES = gstreamer.c
|
nodist__gstreamermodule_la_SOURCES = gstreamer.c
|
||||||
CLEANFILES = gstreamer.c gstreamer-base.defs gstreamer.defs
|
CLEANFILES = gstreamer.c gstreamer-base.defs gstreamer.defs
|
||||||
EXTRA_DIST = gstreamer-extra.defs gstreamer.override gstreamer-arg-types.py
|
EXTRA_DIST = gstreamer-extra.defs $(OVERRIDES) gstreamer-arg-types.py
|
||||||
gstreamer.c: gstreamer.defs gstreamer.override
|
gstreamer.c: gstreamer.defs $(OVERRIDES)
|
||||||
|
|
||||||
GST_EXCLUDE_INCLUDES=\
|
GST_EXCLUDE_INCLUDES=\
|
||||||
$(GST_INCLUDEDIR)/gst/gstatomic_impl.h \
|
$(GST_INCLUDEDIR)/gst/gstatomic_impl.h \
|
||||||
|
|
|
@ -104,3 +104,17 @@
|
||||||
'("char*" "data")
|
'("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
|
override gst_props_entry_get_list
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_wrap_gst_props_entry_get_list(PyObject *self)
|
_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);
|
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