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> 2005-06-17 Edward Hervey <bilboed@bilboed.com>
* Backport of bugfixes/new features from 0.8 branch to HEAD * 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 AM_MAINTAINER_MODE
dnl when going to/from release please set the nano (fourth number) right ! 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) AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
@ -23,10 +23,10 @@ dnl Add parameters for aclocal
ACLOCAL="$ACLOCAL -I common/m4 $ACLOCAL_FLAGS" ACLOCAL="$ACLOCAL -I common/m4 $ACLOCAL_FLAGS"
dnl required versions of other packages 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(GLIB_REQ, 2.0.0)
AC_SUBST(GTK_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 AC_DISABLE_STATIC
@ -52,7 +52,7 @@ fi
AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)]) AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])
dnl check for GStreamer dnl check for GStreamer
GST_MAJORMINOR=0.8 GST_MAJORMINOR=0.9
AC_SUBST(GST_MAJORMINOR) AC_SUBST(GST_MAJORMINOR)
PKG_CHECK_MODULES(GST, gstreamer-$GST_MAJORMINOR >= $GST_REQ) PKG_CHECK_MODULES(GST, gstreamer-$GST_MAJORMINOR >= $GST_REQ)
AC_SUBST(GST_CFLAGS) AC_SUBST(GST_CFLAGS)

View file

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

View file

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

View file

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

View file

@ -1,6 +1,7 @@
;; -*- scheme -*- ;; -*- scheme -*-
; object definitions ... ; object definitions ...
(define-object Object (define-object Object
(in-module "Gst") (in-module "Gst")
(parent "GObject") (parent "GObject")
@ -141,9 +142,15 @@
(gtype-id "GST_TYPE_XML") (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 (define-object Buffer
(in-module "Gst") (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); msg = PyObject_Str (value);
typemsg = PyObject_Str (type); typemsg = PyObject_Str (type);
if (msg && PyString_Check (msg)) { 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, GST_LIBRARY_ERROR_FAILED,
g_strdup (PyString_AsString (msg)), g_strdup (PyString_AsString (msg)),
typemsg ? g_strconcat (PyString_AsString (typemsg), typemsg ? g_strconcat (PyString_AsString (typemsg),
@ -111,7 +112,8 @@ _pygst_element_check_error (GstElement *element)
frame ? PyString_AsString(frame->f_code->co_name) : "???", frame ? PyString_AsString(frame->f_code->co_name) : "???",
lineno ? PyInt_AsLong (lineno) : 0); lineno ? PyInt_AsLong (lineno) : 0);
} else { } 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, GST_LIBRARY_ERROR_TOO_LAZY,
NULL, NULL, NULL, NULL,
frame ? PyString_AsString(frame->f_code->co_filename) : "???", 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); return PyInt_FromLong(ret);
} }
%% %%
override gst_element_query kwargs /* override gst_element_query kwargs */
static PyObject * /* static PyObject * */
_wrap_gst_element_query(PyGObject *self, PyObject *args, PyObject *kwargs) /* _wrap_gst_element_query(PyGObject *self, PyObject *args, PyObject *kwargs) */
{ /* { */
static char *kwlist[] = { "type", "format", NULL }; /* static char *kwlist[] = { "type", "format", NULL }; */
GstQueryType type; /* GstQueryType type; */
GstFormat format; /* GstFormat format; */
gint64 value = 0; /* gint64 value = 0; */
gboolean ret; /* gboolean ret; */
if (!PyArg_ParseTupleAndKeywords(args, kwargs, /* if (!PyArg_ParseTupleAndKeywords(args, kwargs, */
"ii:GstElement.query", kwlist, /* "ii:GstElement.query", kwlist, */
&type, &format)) /* &type, &format)) */
return NULL; /* return NULL; */
ret = gst_element_query(GST_ELEMENT(self->obj), type, &format, &value); /* ret = gst_element_query(GST_ELEMENT(self->obj), type, &format, &value); */
return PyLong_FromLongLong(value); /* return PyLong_FromLongLong(value); */
} /* } */
%% /* %% */
override gst_element_convert kwargs override gst_element_convert kwargs
static PyObject * static PyObject *
_wrap_gst_element_convert(PyGObject *self, PyObject *args, PyObject *kwargs) _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 /* override gst_element_link kwargs */
static PyObject * /* static PyObject * */
_wrap_gst_element_link(PyGObject *self, PyObject *args, PyObject *kwargs) /* _wrap_gst_element_link(PyGObject *self, PyObject *args, PyObject *kwargs) */
{ /* { */
static char *kwlist[] = { "dest", "filtercaps", NULL }; /* static char *kwlist[] = { "dest", "filtercaps", NULL }; */
PyGObject *dest; /* PyGObject *dest; */
PyObject *py_caps = NULL; /* PyObject *py_caps = NULL; */
int ret; /* int ret; */
GstCaps *caps = NULL; /* GstCaps *caps = NULL; */
gboolean caps_is_copy; /* gboolean caps_is_copy; */
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!|O:GstElement.link", /* if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!|O:GstElement.link", */
kwlist, &PyGstElement_Type, &dest, &py_caps)) /* kwlist, &PyGstElement_Type, &dest, &py_caps)) */
return NULL; /* return NULL; */
if (py_caps == NULL) /* if (py_caps == NULL) */
caps = NULL; /* caps = NULL; */
else /* else */
caps = pygst_caps_from_pyobject (py_caps, &caps_is_copy); /* caps = pygst_caps_from_pyobject (py_caps, &caps_is_copy); */
ret = gst_element_link_filtered(GST_ELEMENT(self->obj), GST_ELEMENT(dest->obj), caps); /* ret = gst_element_link_filtered(GST_ELEMENT(self->obj), GST_ELEMENT(dest->obj), caps); */
if (caps && caps_is_copy) /* if (caps && caps_is_copy) */
gst_caps_free (caps); /* gst_caps_unref (caps); */
if (!ret) { /* if (!ret) { */
PyErr_Format(PyGstExc_LinkError, /* PyErr_Format(PyGstExc_LinkError, */
"failed to link %s with %s", /* "failed to link %s with %s", */
GST_ELEMENT_NAME(self->obj), /* GST_ELEMENT_NAME(self->obj), */
GST_ELEMENT_NAME(dest->obj)); /* GST_ELEMENT_NAME(dest->obj)); */
return NULL; /* return NULL; */
} /* } */
return PyBool_FromLong(ret); /* return PyBool_FromLong(ret); */
} /* } */
%% /* %% */
override gst_element_link_filtered kwargs /* override gst_element_link_filtered kwargs */
static PyObject * /* static PyObject * */
_wrap_gst_element_link_filtered(PyGObject *self, PyObject *args, /* _wrap_gst_element_link_filtered(PyGObject *self, PyObject *args, */
PyObject *kwargs) /* PyObject *kwargs) */
{ /* { */
if (PyErr_Warn(PyExc_DeprecationWarning, "element.link_filtered is deprecated, use element.link") < 0) /* if (PyErr_Warn(PyExc_DeprecationWarning, "element.link_filtered is deprecated, use element.link") < 0) */
return NULL; /* return NULL; */
return _wrap_gst_element_link (self, args, kwargs); /* return _wrap_gst_element_link (self, args, kwargs); */
} /* } */
%% %%
override gst_element_link_pads kwargs override gst_element_link_pads kwargs

View file

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

View file

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