diff --git a/ChangeLog b/ChangeLog index 052412bb3f..7d497b9b0a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,32 @@ +2004-01-27 David I. Lehn + + * Makefile.am: add gstinterfaces dir + * configure.ac: get interfaces include dirs + * gstreamer/.cvsignore: add .py[co] + * gstreamer/0.6.defs: + * gstreamer/0.6.override: + * gstreamer/0.7.defs: + * gstreamer/0.7.override: + * gstreamer/common.defs: + * gstreamer/common.override: rearrange code for both 0.6 and 0.7 + support + * gstreamer/Makefile.am: add -fno-strict-aliasing due to python + issues + * gstinterfaces/.cvsignore: + * gstinterfaces/0.7.c: + * gstinterfaces/0.7.defs: + * gstinterfaces/0.7.h: + * gstinterfaces/0.7.override: + * gstinterfaces/Makefile.am: + * gstinterfaces/__init__.py: + * gstinterfaces/arg-types.py: + * gstinterfaces/common.c: + * gstinterfaces/common.defs: + * gstinterfaces/common.h: + * gstinterfaces/common.override: + * gstinterfaces/gstinterfacesmodule.c: messy start of interfaces + handling + 2003-12-07 Gustavo J. A. M. Carneiro * gstreamer/common.override diff --git a/Makefile.am b/Makefile.am index c0c9a38b74..5126195fb5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,9 +4,15 @@ else SUBDIRS_DOCS = endif -SUBDIRS = gstreamer pkgconfig examples $(SUBDIRS_DOCS) testsuite +if GST_0_6 +INTERFACESDIR = +else +INTERFACESDIR = gstinterfaces +endif -DIST_SUBDIRS = gstreamer pkgconfig examples docs testsuite +UNCONDDIRS = gstreamer pkgconfig examples testsuite +SUBDIRS = $(UNCONDDIRS) $(SUBDIRS_DOCS) $(INTERFACESDIR) +DIST_SUBDIRS = $(UNCONDDIRS) docs gstinterfaces EXTRA_DIST = \ gst-python.spec.in gst-python.spec README-docs diff --git a/common b/common index cd5507ae3d..0bcde34201 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit cd5507ae3df8dc48c07df9e37878846b6b79faa1 +Subproject commit 0bcde342015b96d9a6ba3b9d9102e2a543399d96 diff --git a/configure.ac b/configure.ac index 99f12d1545..ebc9d6ef1b 100644 --- a/configure.ac +++ b/configure.ac @@ -88,13 +88,22 @@ AC_MSG_RESULT($PYGTK_H2DEF) #dnl check to make sure we can find gtk #AM_PATH_GTK_2_0(gtk_required_version,,[AC_MSG_ERROR(maybe you want the gtk-gnome-1-2 branch?)],$extra_mods) -AC_MSG_CHECKING(for gstreamer include dir) +AC_MSG_CHECKING(for GStreamer include dir) GST_INCLUDEDIR=`$PKG_CONFIG --variable=includedir gstreamer-$GST_MAJORMINOR` - -AC_SUBST(GST_INCLUDEDIR) AC_MSG_RESULT($GST_INCLUDEDIR) if test "x$GST_INCLUDEDIR" = "x"; then - AC_MSG_ERROR(no gstreamer include dir found) + AC_MSG_ERROR(no GStreamer include dir found) +fi +AC_SUBST(GST_INCLUDEDIR) + +if test "x$GST_MAJORMINOR" != "x0.6"; then + AC_MSG_CHECKING(for GStreamer interfaces include dir) + GST_INTERFACES_INCLUDEDIR=`$PKG_CONFIG --variable=includedir gstreamer-interfaces-$GST_MAJORMINOR` + AC_MSG_RESULT($GST_INTERFACES_INCLUDEDIR) + if test "x$GST_INTERFACES_INCLUDEDIR" = "x"; then + AC_MSG_ERROR(no GStreamer interfaces include dir found) + fi + AC_SUBST(GST_INTERFACES_INCLUDEDIR) fi @@ -143,6 +152,7 @@ changequote([,])dnl AC_OUTPUT([ Makefile gstreamer/Makefile + gstinterfaces/Makefile pkgconfig/Makefile pkgconfig/gst-python.pc pkgconfig/gst-python-uninstalled.pc diff --git a/gst/.gitignore b/gst/.gitignore index ca93df14ba..0a7f3c6c8b 100644 --- a/gst/.gitignore +++ b/gst/.gitignore @@ -4,7 +4,7 @@ Makefile.in *.lo *.la *.so -*.pyc +*.py[co] .libs .deps gstreamer.c diff --git a/gst/0.6.defs b/gst/0.6.defs index e0ed8ee847..d76da3c93b 100644 --- a/gst/0.6.defs +++ b/gst/0.6.defs @@ -7,3 +7,36 @@ (c-name "gst_props_entry_get_props_type") (return-type "GstPropsType") ) + +;; +;; Access GstProps properties list +;; + +(define-method get_list + (of-object "GstProps") + (c-name "gst_props_get_list") + (return-type "const-GList*") +) + +;; +;; 0.6 Boxed types +;; + +(define-boxed BufferPool + (in-module "Gst") + (c-name "GstBufferPool") + (gtype-id "GST_TYPE_BUFFER_POOL") +) + +(define-boxed Props + (in-module "Gst") + (c-name "GstProps") + (gtype-id "GST_TYPE_PROPS") +) + +(define-boxed PropsEntry + (in-module "Gst") + (c-name "GstPropsEntry") + (gtype-id "GST_TYPE_PROPS_ENTRY") +) + diff --git a/gst/0.6.override b/gst/0.6.override index 213ab276a2..829b64c918 100644 --- a/gst/0.6.override +++ b/gst/0.6.override @@ -27,3 +27,162 @@ headers #include #include "0.6.h" +%% +override gst_props_entry_get_int + +static PyObject * +_wrap_gst_props_entry_get_int(PyObject *self) +{ + gboolean ret; + gint val; + + val = 0; + ret = gst_props_entry_get_int(pyg_boxed_get(self, GstPropsEntry), &val); + return Py_BuildValue("(bi)", ret, val); +} +%% +override gst_props_entry_get_float + +static PyObject * +_wrap_gst_props_entry_get_float(PyObject *self) +{ + gboolean ret; + gfloat val; + + val = 0.0f; + ret = gst_props_entry_get_float(pyg_boxed_get(self, GstPropsEntry), &val); + return Py_BuildValue("(bf)", ret, val); +} +%% +override gst_props_entry_get_fourcc_int + +static PyObject * +_wrap_gst_props_entry_get_fourcc_int(PyObject *self) +{ + gboolean ret; + gint32 val; + + val = 0; + ret = gst_props_entry_get_fourcc_int(pyg_boxed_get(self, GstPropsEntry), &val); + return Py_BuildValue("(bi)", ret, val); +} +%% +override gst_props_entry_get_boolean + +static PyObject * +_wrap_gst_props_entry_get_boolean(PyObject *self) +{ + gboolean ret; + gboolean val; + PyObject *py_val; + + val = FALSE; + ret = gst_props_entry_get_boolean(pyg_boxed_get(self, GstPropsEntry), &val); + + py_val = val ? Py_True : Py_False; + return Py_BuildValue("(bO)", ret, py_val); +} +%% +override gst_props_entry_get_string + +static PyObject * +_wrap_gst_props_entry_get_string(PyObject *self) +{ + gboolean ret; + const gchar *val; + + val = NULL; + ret = gst_props_entry_get_string(pyg_boxed_get(self, GstPropsEntry), &val); + if (ret) { + return Py_BuildValue("(bs)", ret, val); + } else { + return Py_BuildValue("(bO)", ret, Py_None); + } +} +%% +override gst_props_entry_get_int_range + +static PyObject * +_wrap_gst_props_entry_get_int_range(PyObject *self) +{ + gboolean ret; + gint min, max; + + min = max = 0; + ret = gst_props_entry_get_int_range(pyg_boxed_get(self, GstPropsEntry), &min, &max); + return Py_BuildValue("(bii)", ret, min, max); +} +%% +override gst_props_entry_get_float_range + +static PyObject * +_wrap_gst_props_entry_get_float_range(PyObject *self) +{ + gboolean ret; + gfloat min, max; + + min = max = 0.0f; + ret = gst_props_entry_get_float_range(pyg_boxed_get(self, GstPropsEntry), &min, &max); + return Py_BuildValue("(bff)", ret, min, max); +} +%% +override gst_props_entry_get_list + + + +static PyObject * +_wrap_gst_props_entry_get_list(PyObject *self) +{ + gboolean ret; + const GList *list; + PyObject *tuple, *obj; + int i; + + list = NULL; + ret = gst_props_entry_get_list(pyg_boxed_get(self, GstPropsEntry), &list); + if (ret == TRUE) { + tuple = PyTuple_New(g_list_length((GList *) list)); + for (i = 0; list != NULL; i++, list = g_list_next(list)) { + obj = pyg_boxed_new(GST_TYPE_PROPS_ENTRY, list->data, TRUE, TRUE); + PyTuple_SET_ITEM(tuple, i, obj); + } + } else { + tuple = Py_None; + Py_INCREF(tuple); + } + return Py_BuildValue("(bO)", ret, tuple); +} +%% +override gst_props_get_list + +static gboolean +gst_props_get_list(GstProps *props, GList **list) +{ + *list = GST_PROPS_PROPERTIES(props); + return TRUE; +} + +static PyObject * +_wrap_gst_props_get_list(PyObject *self) +{ + gboolean ret; + GList *list; + PyObject *tuple, *obj; + int i; + + list = NULL; + ret = gst_props_get_list(pyg_boxed_get(self, GstProps), &list); + if (ret == TRUE) { + tuple = PyTuple_New(g_list_length(list)); + for (i = 0; list != NULL; i++, list = g_list_next(list)) { + obj = pyg_boxed_new(GST_TYPE_PROPS_ENTRY, list->data, TRUE, TRUE); + PyTuple_SET_ITEM(tuple, i, obj); + } + } else { + tuple = Py_None; + Py_INCREF(tuple); + } + return Py_BuildValue("(bO)", ret, tuple); +} + + diff --git a/gst/0.7.defs b/gst/0.7.defs index e69de29bb2..bc3eb62f71 100644 --- a/gst/0.7.defs +++ b/gst/0.7.defs @@ -0,0 +1,9 @@ +;; +;; 0.7 Boxed types +;; + +(define-boxed Structure + (in-module "Gst") + (c-name "GstStructure") + (gtype-id "GST_TYPE_STRUCTURE") +) diff --git a/gst/0.7.override b/gst/0.7.override index cd5308182e..776b82f4bd 100644 --- a/gst/0.7.override +++ b/gst/0.7.override @@ -27,3 +27,47 @@ headers #include #include "0.7.h" +%% +override gst_structure_new kwargs + +static int +_wrap_gst_structure_new(PyGBoxed *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "name", NULL }; + char *name; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:GstStructure.__init__", kwlist, &name)) + return -1; + self->gtype = GST_TYPE_STRUCTURE; + self->free_on_dealloc = FALSE; + self->boxed = gst_structure_new(name, NULL); + + if (!self->boxed) { + PyErr_SetString(PyExc_RuntimeError, "could not create GstStructure object"); + return -1; + } + self->free_on_dealloc = TRUE; + return 0; +} +%% +override gst_structure_set_value kwargs + +static PyObject * +_wrap_gst_structure_set_value(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "field", "value", NULL }; + char *field; + PyObject *py_value = NULL; + GValue value = { 0 }; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sO:GstStructure.set_value", kwlist, &field, &py_value)) + return NULL; + g_value_init(&value, G_TYPE_STRING); + if (pyg_value_from_pyobject(&value, py_value) != 0) { + return NULL; + } + gst_structure_set_value(pyg_boxed_get(self, GstStructure), field, &value); + + Py_INCREF(Py_None); + return Py_None; +} diff --git a/gst/Makefile.am b/gst/Makefile.am index 18b43a147a..3f80aeea41 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -30,7 +30,7 @@ _gstreamermodule_la_SOURCES = \ gstreamermodule.c \ common.c common.h \ $(VERSOURCES) -_gstreamermodule_la_CFLAGS = $(GST_CFLAGS) +_gstreamermodule_la_CFLAGS = $(GST_CFLAGS) -fno-strict-aliasing _gstreamermodule_la_LIBADD = $(GST_LIBS) _gstreamermodule_la_LDFLAGS = -module -avoid-version -export-symbols-regex init_gstreamer nodist__gstreamermodule_la_SOURCES = gstreamer.c diff --git a/gst/common.defs b/gst/common.defs index 02527b031f..11117cd603 100644 --- a/gst/common.defs +++ b/gst/common.defs @@ -8,12 +8,6 @@ (gtype-id "GST_TYPE_BUFFER") ) -(define-boxed BufferPool - (in-module "Gst") - (c-name "GstBufferPool") - (gtype-id "GST_TYPE_BUFFER_POOL") -) - (define-boxed Caps (in-module "Gst") (c-name "GstCaps") @@ -26,28 +20,6 @@ (gtype-id "GST_TYPE_EVENT") ) -(define-boxed Props - (in-module "Gst") - (c-name "GstProps") - (gtype-id "GST_TYPE_PROPS") -) - -(define-boxed PropsEntry - (in-module "Gst") - (c-name "GstPropsEntry") - (gtype-id "GST_TYPE_PROPS_ENTRY") -) - -;; -;; Access GstProps properties list -;; - -(define-method get_list - (of-object "GstProps") - (c-name "gst_props_get_list") - (return-type "const-GList*") -) - ;; ;; Accelerate common GstBin iterate loop ;; diff --git a/gst/common.override b/gst/common.override index 4453bd902d..bff4e89fa1 100644 --- a/gst/common.override +++ b/gst/common.override @@ -336,165 +336,6 @@ _wrap_gst_element_convert(PyGObject *self, PyObject *args, PyObject *kwargs) ret = gst_element_convert(GST_ELEMENT(self->obj), src_format, src_value, &dest_format, &dest_value); return Py_BuildValue("(bL)", ret, dest_value); } -%% -override gst_props_entry_get_int - -static PyObject * -_wrap_gst_props_entry_get_int(PyObject *self) -{ - gboolean ret; - gint val; - - val = 0; - ret = gst_props_entry_get_int(pyg_boxed_get(self, GstPropsEntry), &val); - return Py_BuildValue("(bi)", ret, val); -} -%% -override gst_props_entry_get_float - -static PyObject * -_wrap_gst_props_entry_get_float(PyObject *self) -{ - gboolean ret; - gfloat val; - - val = 0.0f; - ret = gst_props_entry_get_float(pyg_boxed_get(self, GstPropsEntry), &val); - return Py_BuildValue("(bf)", ret, val); -} -%% -override gst_props_entry_get_fourcc_int - -static PyObject * -_wrap_gst_props_entry_get_fourcc_int(PyObject *self) -{ - gboolean ret; - gint32 val; - - val = 0; - ret = gst_props_entry_get_fourcc_int(pyg_boxed_get(self, GstPropsEntry), &val); - return Py_BuildValue("(bi)", ret, val); -} -%% -override gst_props_entry_get_boolean - -static PyObject * -_wrap_gst_props_entry_get_boolean(PyObject *self) -{ - gboolean ret; - gboolean val; - PyObject *py_val; - - val = FALSE; - ret = gst_props_entry_get_boolean(pyg_boxed_get(self, GstPropsEntry), &val); - - py_val = val ? Py_True : Py_False; - return Py_BuildValue("(bO)", ret, py_val); -} -%% -override gst_props_entry_get_string - -static PyObject * -_wrap_gst_props_entry_get_string(PyObject *self) -{ - gboolean ret; - const gchar *val; - - val = NULL; - ret = gst_props_entry_get_string(pyg_boxed_get(self, GstPropsEntry), &val); - if (ret) { - return Py_BuildValue("(bs)", ret, val); - } else { - return Py_BuildValue("(bO)", ret, Py_None); - } -} -%% -override gst_props_entry_get_int_range - -static PyObject * -_wrap_gst_props_entry_get_int_range(PyObject *self) -{ - gboolean ret; - gint min, max; - - min = max = 0; - ret = gst_props_entry_get_int_range(pyg_boxed_get(self, GstPropsEntry), &min, &max); - return Py_BuildValue("(bii)", ret, min, max); -} -%% -override gst_props_entry_get_float_range - -static PyObject * -_wrap_gst_props_entry_get_float_range(PyObject *self) -{ - gboolean ret; - gfloat min, max; - - min = max = 0.0f; - ret = gst_props_entry_get_float_range(pyg_boxed_get(self, GstPropsEntry), &min, &max); - return Py_BuildValue("(bff)", ret, min, max); -} -%% -override gst_props_entry_get_list - - - -static PyObject * -_wrap_gst_props_entry_get_list(PyObject *self) -{ - gboolean ret; - const GList *list; - PyObject *tuple, *obj; - int i; - - list = NULL; - ret = gst_props_entry_get_list(pyg_boxed_get(self, GstPropsEntry), &list); - if (ret == TRUE) { - tuple = PyTuple_New(g_list_length((GList *) list)); - for (i = 0; list != NULL; i++, list = g_list_next(list)) { - obj = pyg_boxed_new(GST_TYPE_PROPS_ENTRY, list->data, TRUE, TRUE); - PyTuple_SET_ITEM(tuple, i, obj); - } - } else { - tuple = Py_None; - Py_INCREF(tuple); - } - return Py_BuildValue("(bO)", ret, tuple); -} -%% -override gst_props_get_list - -static gboolean -gst_props_get_list(GstProps *props, GList **list) -{ - *list = GST_PROPS_PROPERTIES(props); - return TRUE; -} - -static PyObject * -_wrap_gst_props_get_list(PyObject *self) -{ - gboolean ret; - GList *list; - PyObject *tuple, *obj; - int i; - - list = NULL; - ret = gst_props_get_list(pyg_boxed_get(self, GstProps), &list); - if (ret == TRUE) { - tuple = PyTuple_New(g_list_length(list)); - for (i = 0; list != NULL; i++, list = g_list_next(list)) { - obj = pyg_boxed_new(GST_TYPE_PROPS_ENTRY, list->data, TRUE, TRUE); - PyTuple_SET_ITEM(tuple, i, obj); - } - } else { - tuple = Py_None; - Py_INCREF(tuple); - } - return Py_BuildValue("(bO)", ret, tuple); -} - - %% override gst_element_factory_make_element diff --git a/gstreamer/.gitignore b/gstreamer/.gitignore index ca93df14ba..0a7f3c6c8b 100644 --- a/gstreamer/.gitignore +++ b/gstreamer/.gitignore @@ -4,7 +4,7 @@ Makefile.in *.lo *.la *.so -*.pyc +*.py[co] .libs .deps gstreamer.c diff --git a/gstreamer/0.6.defs b/gstreamer/0.6.defs index e0ed8ee847..d76da3c93b 100644 --- a/gstreamer/0.6.defs +++ b/gstreamer/0.6.defs @@ -7,3 +7,36 @@ (c-name "gst_props_entry_get_props_type") (return-type "GstPropsType") ) + +;; +;; Access GstProps properties list +;; + +(define-method get_list + (of-object "GstProps") + (c-name "gst_props_get_list") + (return-type "const-GList*") +) + +;; +;; 0.6 Boxed types +;; + +(define-boxed BufferPool + (in-module "Gst") + (c-name "GstBufferPool") + (gtype-id "GST_TYPE_BUFFER_POOL") +) + +(define-boxed Props + (in-module "Gst") + (c-name "GstProps") + (gtype-id "GST_TYPE_PROPS") +) + +(define-boxed PropsEntry + (in-module "Gst") + (c-name "GstPropsEntry") + (gtype-id "GST_TYPE_PROPS_ENTRY") +) + diff --git a/gstreamer/0.6.override b/gstreamer/0.6.override index 213ab276a2..829b64c918 100644 --- a/gstreamer/0.6.override +++ b/gstreamer/0.6.override @@ -27,3 +27,162 @@ headers #include #include "0.6.h" +%% +override gst_props_entry_get_int + +static PyObject * +_wrap_gst_props_entry_get_int(PyObject *self) +{ + gboolean ret; + gint val; + + val = 0; + ret = gst_props_entry_get_int(pyg_boxed_get(self, GstPropsEntry), &val); + return Py_BuildValue("(bi)", ret, val); +} +%% +override gst_props_entry_get_float + +static PyObject * +_wrap_gst_props_entry_get_float(PyObject *self) +{ + gboolean ret; + gfloat val; + + val = 0.0f; + ret = gst_props_entry_get_float(pyg_boxed_get(self, GstPropsEntry), &val); + return Py_BuildValue("(bf)", ret, val); +} +%% +override gst_props_entry_get_fourcc_int + +static PyObject * +_wrap_gst_props_entry_get_fourcc_int(PyObject *self) +{ + gboolean ret; + gint32 val; + + val = 0; + ret = gst_props_entry_get_fourcc_int(pyg_boxed_get(self, GstPropsEntry), &val); + return Py_BuildValue("(bi)", ret, val); +} +%% +override gst_props_entry_get_boolean + +static PyObject * +_wrap_gst_props_entry_get_boolean(PyObject *self) +{ + gboolean ret; + gboolean val; + PyObject *py_val; + + val = FALSE; + ret = gst_props_entry_get_boolean(pyg_boxed_get(self, GstPropsEntry), &val); + + py_val = val ? Py_True : Py_False; + return Py_BuildValue("(bO)", ret, py_val); +} +%% +override gst_props_entry_get_string + +static PyObject * +_wrap_gst_props_entry_get_string(PyObject *self) +{ + gboolean ret; + const gchar *val; + + val = NULL; + ret = gst_props_entry_get_string(pyg_boxed_get(self, GstPropsEntry), &val); + if (ret) { + return Py_BuildValue("(bs)", ret, val); + } else { + return Py_BuildValue("(bO)", ret, Py_None); + } +} +%% +override gst_props_entry_get_int_range + +static PyObject * +_wrap_gst_props_entry_get_int_range(PyObject *self) +{ + gboolean ret; + gint min, max; + + min = max = 0; + ret = gst_props_entry_get_int_range(pyg_boxed_get(self, GstPropsEntry), &min, &max); + return Py_BuildValue("(bii)", ret, min, max); +} +%% +override gst_props_entry_get_float_range + +static PyObject * +_wrap_gst_props_entry_get_float_range(PyObject *self) +{ + gboolean ret; + gfloat min, max; + + min = max = 0.0f; + ret = gst_props_entry_get_float_range(pyg_boxed_get(self, GstPropsEntry), &min, &max); + return Py_BuildValue("(bff)", ret, min, max); +} +%% +override gst_props_entry_get_list + + + +static PyObject * +_wrap_gst_props_entry_get_list(PyObject *self) +{ + gboolean ret; + const GList *list; + PyObject *tuple, *obj; + int i; + + list = NULL; + ret = gst_props_entry_get_list(pyg_boxed_get(self, GstPropsEntry), &list); + if (ret == TRUE) { + tuple = PyTuple_New(g_list_length((GList *) list)); + for (i = 0; list != NULL; i++, list = g_list_next(list)) { + obj = pyg_boxed_new(GST_TYPE_PROPS_ENTRY, list->data, TRUE, TRUE); + PyTuple_SET_ITEM(tuple, i, obj); + } + } else { + tuple = Py_None; + Py_INCREF(tuple); + } + return Py_BuildValue("(bO)", ret, tuple); +} +%% +override gst_props_get_list + +static gboolean +gst_props_get_list(GstProps *props, GList **list) +{ + *list = GST_PROPS_PROPERTIES(props); + return TRUE; +} + +static PyObject * +_wrap_gst_props_get_list(PyObject *self) +{ + gboolean ret; + GList *list; + PyObject *tuple, *obj; + int i; + + list = NULL; + ret = gst_props_get_list(pyg_boxed_get(self, GstProps), &list); + if (ret == TRUE) { + tuple = PyTuple_New(g_list_length(list)); + for (i = 0; list != NULL; i++, list = g_list_next(list)) { + obj = pyg_boxed_new(GST_TYPE_PROPS_ENTRY, list->data, TRUE, TRUE); + PyTuple_SET_ITEM(tuple, i, obj); + } + } else { + tuple = Py_None; + Py_INCREF(tuple); + } + return Py_BuildValue("(bO)", ret, tuple); +} + + diff --git a/gstreamer/0.7.defs b/gstreamer/0.7.defs index e69de29bb2..bc3eb62f71 100644 --- a/gstreamer/0.7.defs +++ b/gstreamer/0.7.defs @@ -0,0 +1,9 @@ +;; +;; 0.7 Boxed types +;; + +(define-boxed Structure + (in-module "Gst") + (c-name "GstStructure") + (gtype-id "GST_TYPE_STRUCTURE") +) diff --git a/gstreamer/0.7.override b/gstreamer/0.7.override index cd5308182e..776b82f4bd 100644 --- a/gstreamer/0.7.override +++ b/gstreamer/0.7.override @@ -27,3 +27,47 @@ headers #include #include "0.7.h" +%% +override gst_structure_new kwargs + +static int +_wrap_gst_structure_new(PyGBoxed *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "name", NULL }; + char *name; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:GstStructure.__init__", kwlist, &name)) + return -1; + self->gtype = GST_TYPE_STRUCTURE; + self->free_on_dealloc = FALSE; + self->boxed = gst_structure_new(name, NULL); + + if (!self->boxed) { + PyErr_SetString(PyExc_RuntimeError, "could not create GstStructure object"); + return -1; + } + self->free_on_dealloc = TRUE; + return 0; +} +%% +override gst_structure_set_value kwargs + +static PyObject * +_wrap_gst_structure_set_value(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "field", "value", NULL }; + char *field; + PyObject *py_value = NULL; + GValue value = { 0 }; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sO:GstStructure.set_value", kwlist, &field, &py_value)) + return NULL; + g_value_init(&value, G_TYPE_STRING); + if (pyg_value_from_pyobject(&value, py_value) != 0) { + return NULL; + } + gst_structure_set_value(pyg_boxed_get(self, GstStructure), field, &value); + + Py_INCREF(Py_None); + return Py_None; +} diff --git a/gstreamer/Makefile.am b/gstreamer/Makefile.am index 18b43a147a..3f80aeea41 100644 --- a/gstreamer/Makefile.am +++ b/gstreamer/Makefile.am @@ -30,7 +30,7 @@ _gstreamermodule_la_SOURCES = \ gstreamermodule.c \ common.c common.h \ $(VERSOURCES) -_gstreamermodule_la_CFLAGS = $(GST_CFLAGS) +_gstreamermodule_la_CFLAGS = $(GST_CFLAGS) -fno-strict-aliasing _gstreamermodule_la_LIBADD = $(GST_LIBS) _gstreamermodule_la_LDFLAGS = -module -avoid-version -export-symbols-regex init_gstreamer nodist__gstreamermodule_la_SOURCES = gstreamer.c diff --git a/gstreamer/common.defs b/gstreamer/common.defs index 02527b031f..11117cd603 100644 --- a/gstreamer/common.defs +++ b/gstreamer/common.defs @@ -8,12 +8,6 @@ (gtype-id "GST_TYPE_BUFFER") ) -(define-boxed BufferPool - (in-module "Gst") - (c-name "GstBufferPool") - (gtype-id "GST_TYPE_BUFFER_POOL") -) - (define-boxed Caps (in-module "Gst") (c-name "GstCaps") @@ -26,28 +20,6 @@ (gtype-id "GST_TYPE_EVENT") ) -(define-boxed Props - (in-module "Gst") - (c-name "GstProps") - (gtype-id "GST_TYPE_PROPS") -) - -(define-boxed PropsEntry - (in-module "Gst") - (c-name "GstPropsEntry") - (gtype-id "GST_TYPE_PROPS_ENTRY") -) - -;; -;; Access GstProps properties list -;; - -(define-method get_list - (of-object "GstProps") - (c-name "gst_props_get_list") - (return-type "const-GList*") -) - ;; ;; Accelerate common GstBin iterate loop ;; diff --git a/gstreamer/common.override b/gstreamer/common.override index 4453bd902d..bff4e89fa1 100644 --- a/gstreamer/common.override +++ b/gstreamer/common.override @@ -336,165 +336,6 @@ _wrap_gst_element_convert(PyGObject *self, PyObject *args, PyObject *kwargs) ret = gst_element_convert(GST_ELEMENT(self->obj), src_format, src_value, &dest_format, &dest_value); return Py_BuildValue("(bL)", ret, dest_value); } -%% -override gst_props_entry_get_int - -static PyObject * -_wrap_gst_props_entry_get_int(PyObject *self) -{ - gboolean ret; - gint val; - - val = 0; - ret = gst_props_entry_get_int(pyg_boxed_get(self, GstPropsEntry), &val); - return Py_BuildValue("(bi)", ret, val); -} -%% -override gst_props_entry_get_float - -static PyObject * -_wrap_gst_props_entry_get_float(PyObject *self) -{ - gboolean ret; - gfloat val; - - val = 0.0f; - ret = gst_props_entry_get_float(pyg_boxed_get(self, GstPropsEntry), &val); - return Py_BuildValue("(bf)", ret, val); -} -%% -override gst_props_entry_get_fourcc_int - -static PyObject * -_wrap_gst_props_entry_get_fourcc_int(PyObject *self) -{ - gboolean ret; - gint32 val; - - val = 0; - ret = gst_props_entry_get_fourcc_int(pyg_boxed_get(self, GstPropsEntry), &val); - return Py_BuildValue("(bi)", ret, val); -} -%% -override gst_props_entry_get_boolean - -static PyObject * -_wrap_gst_props_entry_get_boolean(PyObject *self) -{ - gboolean ret; - gboolean val; - PyObject *py_val; - - val = FALSE; - ret = gst_props_entry_get_boolean(pyg_boxed_get(self, GstPropsEntry), &val); - - py_val = val ? Py_True : Py_False; - return Py_BuildValue("(bO)", ret, py_val); -} -%% -override gst_props_entry_get_string - -static PyObject * -_wrap_gst_props_entry_get_string(PyObject *self) -{ - gboolean ret; - const gchar *val; - - val = NULL; - ret = gst_props_entry_get_string(pyg_boxed_get(self, GstPropsEntry), &val); - if (ret) { - return Py_BuildValue("(bs)", ret, val); - } else { - return Py_BuildValue("(bO)", ret, Py_None); - } -} -%% -override gst_props_entry_get_int_range - -static PyObject * -_wrap_gst_props_entry_get_int_range(PyObject *self) -{ - gboolean ret; - gint min, max; - - min = max = 0; - ret = gst_props_entry_get_int_range(pyg_boxed_get(self, GstPropsEntry), &min, &max); - return Py_BuildValue("(bii)", ret, min, max); -} -%% -override gst_props_entry_get_float_range - -static PyObject * -_wrap_gst_props_entry_get_float_range(PyObject *self) -{ - gboolean ret; - gfloat min, max; - - min = max = 0.0f; - ret = gst_props_entry_get_float_range(pyg_boxed_get(self, GstPropsEntry), &min, &max); - return Py_BuildValue("(bff)", ret, min, max); -} -%% -override gst_props_entry_get_list - - - -static PyObject * -_wrap_gst_props_entry_get_list(PyObject *self) -{ - gboolean ret; - const GList *list; - PyObject *tuple, *obj; - int i; - - list = NULL; - ret = gst_props_entry_get_list(pyg_boxed_get(self, GstPropsEntry), &list); - if (ret == TRUE) { - tuple = PyTuple_New(g_list_length((GList *) list)); - for (i = 0; list != NULL; i++, list = g_list_next(list)) { - obj = pyg_boxed_new(GST_TYPE_PROPS_ENTRY, list->data, TRUE, TRUE); - PyTuple_SET_ITEM(tuple, i, obj); - } - } else { - tuple = Py_None; - Py_INCREF(tuple); - } - return Py_BuildValue("(bO)", ret, tuple); -} -%% -override gst_props_get_list - -static gboolean -gst_props_get_list(GstProps *props, GList **list) -{ - *list = GST_PROPS_PROPERTIES(props); - return TRUE; -} - -static PyObject * -_wrap_gst_props_get_list(PyObject *self) -{ - gboolean ret; - GList *list; - PyObject *tuple, *obj; - int i; - - list = NULL; - ret = gst_props_get_list(pyg_boxed_get(self, GstProps), &list); - if (ret == TRUE) { - tuple = PyTuple_New(g_list_length(list)); - for (i = 0; list != NULL; i++, list = g_list_next(list)) { - obj = pyg_boxed_new(GST_TYPE_PROPS_ENTRY, list->data, TRUE, TRUE); - PyTuple_SET_ITEM(tuple, i, obj); - } - } else { - tuple = Py_None; - Py_INCREF(tuple); - } - return Py_BuildValue("(bO)", ret, tuple); -} - - %% override gst_element_factory_make_element