gst/: commented-out deprecated code, compiles at last, and works for pipeline creation and state change

Original commit message from CVS:
* gst/arg-types.py:
* gst/common.h:
* gst/gst-argtypes.c:
* gst/gst-types.defs:
* gst/gst.defs:
* gst/gst.override:
* gst/gstelement.override:
* gst/gstmodule.c:
* gst/gstpad.override:
* gst/gststructure.override:
commented-out deprecated code,
compiles at last, and works for pipeline creation and state change
* configure.ac:
updated requirement of GStream (0.9.0), pygtk (2.6.1)
bumped version number (0.9.0.1)
This commit is contained in:
Edward Hervey 2005-06-20 21:39:34 +00:00
parent c68afb5f53
commit d33dd2f565
12 changed files with 375 additions and 340 deletions

View file

@ -1,3 +1,22 @@
2005-06-20 Edward Hervey <edward@fluendo.com>
* gst/arg-types.py:
* gst/common.h:
* gst/gst-argtypes.c:
* gst/gst-types.defs:
* gst/gst.defs:
* gst/gst.override:
* gst/gstelement.override:
* gst/gstmodule.c:
* gst/gstpad.override:
* gst/gststructure.override:
commented-out deprecated code,
compiles at last, and works for pipeline creation and state change
* configure.ac:
updated requirement of GStream (0.9.0), pygtk (2.6.1)
bumped version number (0.9.0.1)
2005-06-17 Edward Hervey <bilboed@bilboed.com>
* Backport of bugfixes/new features from 0.8 branch to HEAD

View file

@ -8,7 +8,7 @@ dnl AM_MAINTAINER_MODE only provides the option to configure to enable it
AM_MAINTAINER_MODE
dnl when going to/from release please set the nano (fourth number) right !
AS_VERSION(gst-python, PYGST_VERSION, 0, 8, 1, 1, GST_CVS="no", GST_CVS="yes")
AS_VERSION(gst-python, PYGST_VERSION, 0, 9, 0, 1, GST_CVS="no", GST_CVS="yes")
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
@ -23,10 +23,10 @@ dnl Add parameters for aclocal
ACLOCAL="$ACLOCAL -I common/m4 $ACLOCAL_FLAGS"
dnl required versions of other packages
AC_SUBST(PYGTK_REQ, 2.4.0)
AC_SUBST(PYGTK_REQ, 2.6.1)
AC_SUBST(GLIB_REQ, 2.0.0)
AC_SUBST(GTK_REQ, 2.0.0)
AC_SUBST(GST_REQ, 0.8.9)
AC_SUBST(GST_REQ, 0.9.0)
AC_DISABLE_STATIC
@ -52,7 +52,7 @@ fi
AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])
dnl check for GStreamer
GST_MAJORMINOR=0.8
GST_MAJORMINOR=0.9
AC_SUBST(GST_MAJORMINOR)
PKG_CHECK_MODULES(GST, gstreamer-$GST_MAJORMINOR >= $GST_REQ)
AC_SUBST(GST_CFLAGS)

View file

@ -114,7 +114,7 @@ class GstCapsArg(ArgType):
' else\n'
' ' + before)
after = (' if (%(name)s && %(name)s_is_copy)\n'
' gst_caps_free (%(name)s);\n')
' gst_caps_unref (%(name)s);\n')
def write_param(self, ptype, pname, pdflt, pnull, info):
if ptype == 'const-GstCaps*':

View file

@ -45,8 +45,8 @@ typedef struct {
} PyGstCustomNotify;
/* from gst-types.c */
gboolean pygst_data_from_pyobject(PyObject *object, GstData **data);
PyObject *pygst_data_to_pyobject(GstData *data);
/* gboolean pygst_data_from_pyobject(PyObject *object, GstData **data); */
/* PyObject *pygst_data_to_pyobject(GstData *data); */
GstCaps *pygst_caps_from_pyobject (PyObject *object, gboolean *copy);

View file

@ -26,44 +26,44 @@
#include <gst/gst.h>
#include "common.h"
gboolean
pygst_data_from_pyobject(PyObject *object, GstData **data)
{
if (pyg_boxed_check(object, GST_TYPE_DATA)) {
*data = pyg_boxed_get(object, GstData);
return TRUE;
} else if (pyg_boxed_check(object, GST_TYPE_BUFFER)) {
*data = GST_DATA (pyg_boxed_get(object, GstBuffer));
return TRUE;
} else if (pyg_boxed_check(object, GST_TYPE_EVENT)) {
*data = GST_DATA (pyg_boxed_get(object, GstEvent));
return TRUE;
}
/* gboolean */
/* pygst_data_from_pyobject(PyObject *object, GstData **data) */
/* { */
/* if (pyg_boxed_check(object, GST_TYPE_DATA)) { */
/* *data = pyg_boxed_get(object, GstData); */
/* return TRUE; */
/* } else if (pyg_boxed_check(object, GST_TYPE_BUFFER)) { */
/* *data = GST_DATA (pyg_boxed_get(object, GstBuffer)); */
/* return TRUE; */
/* } else if (pyg_boxed_check(object, GST_TYPE_EVENT)) { */
/* *data = GST_DATA (pyg_boxed_get(object, GstEvent)); */
/* return TRUE; */
/* } */
PyErr_Clear();
PyErr_SetString(PyExc_TypeError, "could not convert to GstData");
return FALSE;
}
/* PyErr_Clear(); */
/* PyErr_SetString(PyExc_TypeError, "could not convert to GstData"); */
/* return FALSE; */
/* } */
static PyObject *
PyGstData_from_value(const GValue *value)
{
GstData *data = (GstData *)g_value_get_boxed(value);
/* static PyObject * */
/* PyGstData_from_value(const GValue *value) */
/* { */
/* GstData *data = (GstData *)g_value_get_boxed(value); */
return pyg_boxed_new(GST_TYPE_DATA, data, TRUE, TRUE);
}
/* return pyg_boxed_new(GST_TYPE_DATA, data, TRUE, TRUE); */
/* } */
static int
PyGstData_to_value(GValue *value, PyObject *object)
{
GstData* data;
/* static int */
/* PyGstData_to_value(GValue *value, PyObject *object) */
/* { */
/* GstData* data; */
if (!pygst_data_from_pyobject(object, &data))
return -1;
/* if (!pygst_data_from_pyobject(object, &data)) */
/* return -1; */
g_value_set_boxed(value, data);
return 0;
}
/* g_value_set_boxed(value, data); */
/* return 0; */
/* } */
/* This function will return a copy, unless the following is all TRUE:
* - The given PyObject contains a GstCaps already
@ -103,10 +103,10 @@ pygst_caps_from_pyobject (PyObject *object, gboolean *copy)
return NULL;
}
void
_pygst_register_boxed_types(PyObject *moddict)
{
pyg_register_boxed_custom(GST_TYPE_DATA,
PyGstData_from_value,
PyGstData_to_value);
}
/* void */
/* _pygst_register_boxed_types(PyObject *moddict) */
/* { */
/* pyg_register_boxed_custom(GST_TYPE_DATA, */
/* PyGstData_from_value, */
/* PyGstData_to_value); */
/* } */

View file

@ -1,6 +1,7 @@
;; -*- scheme -*-
; object definitions ...
(define-object Object
(in-module "Gst")
(parent "GObject")
@ -141,9 +142,15 @@
(gtype-id "GST_TYPE_XML")
)
::
:: MiniObject types
::
;;
;; MiniObject types
;;
(define-boxed MiniObject
(in-module "Gst")
(c-name "GstMiniObject")
(gtype-id "GST_TYPE_MINI_OBJECT")
)
(define-object Buffer
(in-module "Gst")

File diff suppressed because it is too large Load diff

View file

@ -101,7 +101,8 @@ _pygst_element_check_error (GstElement *element)
msg = PyObject_Str (value);
typemsg = PyObject_Str (type);
if (msg && PyString_Check (msg)) {
gst_element_error_full (element, GST_LIBRARY_ERROR,
gst_element_message_full (element, GST_MESSAGE_ERROR,
GST_LIBRARY_ERROR,
GST_LIBRARY_ERROR_FAILED,
g_strdup (PyString_AsString (msg)),
typemsg ? g_strconcat (PyString_AsString (typemsg),
@ -111,7 +112,8 @@ _pygst_element_check_error (GstElement *element)
frame ? PyString_AsString(frame->f_code->co_name) : "???",
lineno ? PyInt_AsLong (lineno) : 0);
} else {
gst_element_error_full (element, GST_LIBRARY_ERROR,
gst_element_message_full (element, GST_MESSAGE_ERROR,
GST_LIBRARY_ERROR,
GST_LIBRARY_ERROR_TOO_LAZY,
NULL, NULL,
frame ? PyString_AsString(frame->f_code->co_filename) : "???",

View file

@ -85,25 +85,25 @@ _wrap_gst_element_set_state(PyGObject *self, PyObject *args, PyObject *kwargs)
return PyInt_FromLong(ret);
}
%%
override gst_element_query kwargs
static PyObject *
_wrap_gst_element_query(PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "type", "format", NULL };
GstQueryType type;
GstFormat format;
gint64 value = 0;
gboolean ret;
/* override gst_element_query kwargs */
/* static PyObject * */
/* _wrap_gst_element_query(PyGObject *self, PyObject *args, PyObject *kwargs) */
/* { */
/* static char *kwlist[] = { "type", "format", NULL }; */
/* GstQueryType type; */
/* GstFormat format; */
/* gint64 value = 0; */
/* gboolean ret; */
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"ii:GstElement.query", kwlist,
&type, &format))
return NULL;
/* if (!PyArg_ParseTupleAndKeywords(args, kwargs, */
/* "ii:GstElement.query", kwlist, */
/* &type, &format)) */
/* return NULL; */
ret = gst_element_query(GST_ELEMENT(self->obj), type, &format, &value);
return PyLong_FromLongLong(value);
}
%%
/* ret = gst_element_query(GST_ELEMENT(self->obj), type, &format, &value); */
/* return PyLong_FromLongLong(value); */
/* } */
/* %% */
override gst_element_convert kwargs
static PyObject *
_wrap_gst_element_convert(PyGObject *self, PyObject *args, PyObject *kwargs)
@ -183,48 +183,48 @@ _wrap_gst_element_link_many(PyObject *self, PyObject *args)
}
%%
override gst_element_link kwargs
static PyObject *
_wrap_gst_element_link(PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "dest", "filtercaps", NULL };
PyGObject *dest;
PyObject *py_caps = NULL;
int ret;
GstCaps *caps = NULL;
gboolean caps_is_copy;
/* %% */
/* override gst_element_link kwargs */
/* static PyObject * */
/* _wrap_gst_element_link(PyGObject *self, PyObject *args, PyObject *kwargs) */
/* { */
/* static char *kwlist[] = { "dest", "filtercaps", NULL }; */
/* PyGObject *dest; */
/* PyObject *py_caps = NULL; */
/* int ret; */
/* GstCaps *caps = NULL; */
/* gboolean caps_is_copy; */
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!|O:GstElement.link",
kwlist, &PyGstElement_Type, &dest, &py_caps))
return NULL;
if (py_caps == NULL)
caps = NULL;
else
caps = pygst_caps_from_pyobject (py_caps, &caps_is_copy);
ret = gst_element_link_filtered(GST_ELEMENT(self->obj), GST_ELEMENT(dest->obj), caps);
if (caps && caps_is_copy)
gst_caps_free (caps);
if (!ret) {
PyErr_Format(PyGstExc_LinkError,
"failed to link %s with %s",
GST_ELEMENT_NAME(self->obj),
GST_ELEMENT_NAME(dest->obj));
return NULL;
}
return PyBool_FromLong(ret);
}
/* if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!|O:GstElement.link", */
/* kwlist, &PyGstElement_Type, &dest, &py_caps)) */
/* return NULL; */
/* if (py_caps == NULL) */
/* caps = NULL; */
/* else */
/* caps = pygst_caps_from_pyobject (py_caps, &caps_is_copy); */
/* ret = gst_element_link_filtered(GST_ELEMENT(self->obj), GST_ELEMENT(dest->obj), caps); */
/* if (caps && caps_is_copy) */
/* gst_caps_unref (caps); */
/* if (!ret) { */
/* PyErr_Format(PyGstExc_LinkError, */
/* "failed to link %s with %s", */
/* GST_ELEMENT_NAME(self->obj), */
/* GST_ELEMENT_NAME(dest->obj)); */
/* return NULL; */
/* } */
/* return PyBool_FromLong(ret); */
/* } */
%%
override gst_element_link_filtered kwargs
static PyObject *
_wrap_gst_element_link_filtered(PyGObject *self, PyObject *args,
PyObject *kwargs)
{
if (PyErr_Warn(PyExc_DeprecationWarning, "element.link_filtered is deprecated, use element.link") < 0)
return NULL;
return _wrap_gst_element_link (self, args, kwargs);
}
/* %% */
/* override gst_element_link_filtered kwargs */
/* static PyObject * */
/* _wrap_gst_element_link_filtered(PyGObject *self, PyObject *args, */
/* PyObject *kwargs) */
/* { */
/* if (PyErr_Warn(PyExc_DeprecationWarning, "element.link_filtered is deprecated, use element.link") < 0) */
/* return NULL; */
/* return _wrap_gst_element_link (self, args, kwargs); */
/* } */
%%
override gst_element_link_pads kwargs

View file

@ -64,14 +64,14 @@ python_do_pending_calls(gpointer data)
return TRUE;
}
static void
sink_gstobject(GObject *object)
{
if (GST_OBJECT_FLOATING(object)) {
g_object_ref(object);
gst_object_sink(GST_OBJECT(object));
}
}
/* static void */
/* sink_gstobject(GObject *object) */
/* { */
/* if (GST_OBJECT_FLOATING(object)) { */
/* g_object_ref(object); */
/* gst_object_sink(GST_OBJECT(object)); */
/* } */
/* } */
DL_EXPORT(void)
init_gst (void)
@ -115,8 +115,8 @@ init_gst (void)
g_free (argv);
}
_pygst_register_boxed_types (NULL);
pygobject_register_sinkfunc(GST_TYPE_OBJECT, sink_gstobject);
/* _pygst_register_boxed_types (NULL); */
/* pygobject_register_sinkfunc(GST_TYPE_OBJECT, sink_gstobject); */
m = Py_InitModule ("_gst", pygst_functions);
d = PyModule_GetDict (m);

View file

@ -131,7 +131,7 @@ call_getcaps_function (GstPad *pad)
GstCaps *caps;
g_value_init (&ret, GST_TYPE_CAPS);
g_value_init (&args, GST_TYPE_REAL_PAD);
g_value_init (&args, GST_TYPE_PAD);
g_value_set_object (&args, pad);
closure = pad_private(pad)->getcaps_function;
@ -163,7 +163,7 @@ handle_link_function_exception (GValue *ret, guint n, const GValue *params)
}
static GstPadLinkReturn
call_link_function (GstPad *pad, const GstCaps *caps)
call_link_function (GstPad *pad, GstPad *peer)
{
GClosure *closure;
GValue ret = { 0, };
@ -171,10 +171,10 @@ call_link_function (GstPad *pad, const GstCaps *caps)
GstPadLinkReturn i;
g_value_init (&ret, GST_TYPE_PAD_LINK_RETURN);
g_value_init (&args[0], GST_TYPE_REAL_PAD);
g_value_init (&args[1], GST_TYPE_CAPS);
g_value_init (&args[0], GST_TYPE_PAD);
g_value_init (&args[1], GST_TYPE_PAD);
g_value_set_object (&args[0], pad);
g_value_set_boxed (&args[1], caps);
g_value_set_boxed (&args[1], peer);
closure = pad_private(pad)->link_function;
@ -207,28 +207,35 @@ handle_chain_function_exception (GValue *ret, guint n, const GValue *params)
g_assert_not_reached (); /* only returns FALSE when there's no error */
}
static void
call_chain_function(GstPad *pad, GstData *data)
static GstFlowReturn
call_chain_function(GstPad *pad, GstBuffer *data)
{
GClosure *closure;
GValue ret = { 0, };
GValue args[2] = { { 0, }, { 0, } };
GstFlowReturn flow;
g_value_init (&args[0], GST_TYPE_REAL_PAD);
g_value_init (&ret, G_TYPE_ENUM);
g_value_set_enum (&ret, GST_FLOW_ERROR);
g_value_init (&args[0], GST_TYPE_PAD);
if (GST_IS_BUFFER (data)) {
g_value_init (&args[1], GST_TYPE_BUFFER);
} else if (GST_IS_EVENT (data)) {
g_value_init (&args[1], GST_TYPE_EVENT);
} else {
g_value_init (&args[1], GST_TYPE_DATA);
}
g_value_set_object (&args[0], pad);
g_value_take_boxed (&args[1], data);
closure = pad_private(pad)->chain_function;
g_closure_invoke (closure, NULL, 2, args, NULL);
g_closure_invoke (closure, &ret, 2, args, NULL);
flow = g_value_get_enum (&ret);
g_value_unset (&ret);
g_value_unset (&args[0]);
g_value_unset (&args[1]);
return flow;
}
static PyObject*
@ -260,7 +267,7 @@ call_event_function (GstPad *pad, GstEvent *event)
g_value_init (&ret, G_TYPE_BOOLEAN);
g_value_set_boolean (&ret, FALSE);
g_value_init (&args[0], GST_TYPE_REAL_PAD);
g_value_init (&args[0], GST_TYPE_PAD);
g_value_init (&args[1], GST_TYPE_EVENT);
g_value_set_object (&args[0], pad);
g_value_set_boxed (&args[1], event);
@ -349,25 +356,25 @@ _wrap_gst_pad_tp_repr (PyGObject *self)
}
%%
override gst_pad_query kwargs
static PyObject *
_wrap_gst_pad_query(PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "type", "format", NULL };
GstQueryType type;
GstFormat format;
gint64 value = 0;
gboolean ret;
/* override gst_pad_query kwargs */
/* static PyObject * */
/* _wrap_gst_pad_query(PyGObject *self, PyObject *args, PyObject *kwargs) */
/* { */
/* static char *kwlist[] = { "type", "format", NULL }; */
/* GstQueryType type; */
/* GstFormat format; */
/* gint64 value = 0; */
/* gboolean ret; */
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"ii:GstPad.query", kwlist,
&type, &format))
return NULL;
/* if (!PyArg_ParseTupleAndKeywords(args, kwargs, */
/* "ii:GstPad.query", kwlist, */
/* &type, &format)) */
/* return NULL; */
ret = gst_pad_query(GST_PAD(self->obj), type, &format, &value);
return PyLong_FromLongLong(value);
}
%%
/* ret = gst_pad_query(GST_PAD(self->obj), type, &format, &value); */
/* return PyLong_FromLongLong(value); */
/* } */
/* %% */
override gst_pad_convert kwargs
static PyObject *
_wrap_gst_pad_convert(PyGObject *self, PyObject *args, PyObject *kwargs)

View file

@ -229,7 +229,7 @@ static PyMappingMethods _wrap_gst_structure_tp_as_mapping = {
override gst_structure_foreach kwargs
static gboolean
pygst_structure_foreach_marshal(GQuark field_id,
GValue *value,
const GValue *value,
gpointer user_data)
{
PyGstCustomNotify *cunote = user_data;