add boxed types adapt to boxed types remove obsoleted code

Original commit message from CVS:
add boxed types
adapt to boxed types
remove obsoleted code
This commit is contained in:
David I. Lehn 2002-10-04 05:40:37 +00:00
parent c6737f6a93
commit a8a9c7e9d5
7 changed files with 124 additions and 182 deletions

View file

@ -1,3 +1,21 @@
2002-10-04 David I. Lehn <dlehn@vt.edu>
* README: basic info.
* COPYING: remove the literal "^L" strings.
* configure.ac: require GStreamer core 0.4.1.
* gstreamer/gstreamer-extra.defs: add boxed type defs, convert buffer
get/set_data to methods vs functions.
* gstreamer/gstreamer.overrides: remove boxed type generated code,
adapt rest to boxed types.
* examples/gstreamer/*: set interpreter to "python" vs "python2.2",
adapt to newer generated code (Pipeline vs gst_pipeline_new()), adapt
to newer api.
2002-05-09 David I. Lehn <dlehn@vt.edu>
* examples/gstreamer/dvdplay.py: adjust state changes,

View file

@ -23,7 +23,7 @@ GST_INCLUDES=$(wildcard $(GST_INCLUDEDIR)/gst/*.h)
gstreamer-base.defs: $(GST_INCLUDES)
$(PYTHON) $(PYGTK_H2DEF) $(GST_INCLUDES) > gstreamer-base.defs
gstreamer.defs: gstreamer-base.defs gstreamer-extra.defs
gstreamer.defs: gstreamer-base.defs gstreamer-extra.defs $(top_srcdir)/gstreamer/gstreamer-arg-types.py
cat gstreamer-base.defs gstreamer-extra.defs > gstreamer.defs
.defs.c:

View file

@ -1,20 +1,52 @@
;;
;; Boxed types
;;
(define-boxed Buffer
(in-module "Gst")
(c-name "GstBuffer")
(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")
(gtype-id "GST_TYPE_CAPS")
)
(define-boxed Event
(in-module "Gst")
(c-name "GstEvent")
(gtype-id "GST_TYPE_EVENT")
)
(define-boxed Props
(in-module "Gst")
(c-name "GstProps")
(gtype-id "GST_TYPE_PROPS")
)
;;
;; HACK
;;
(define-function gst_buffer_get_data
(define-method get_data
(of-object "GstBuffer")
(c-name "gst_buffer_get_data")
(return-type "char*")
(parameters
'("GstBuffer*" "buf")
)
)
(define-function gst_buffer_set_data
(define-method set_data
(of-object "GstBuffer")
(c-name "gst_buffer_set_data")
(return-type "none")
(parameters
'("GstBuffer*" "buf")
'("char*" "data")
)
)

View file

@ -81,7 +81,7 @@ call_connect_function (GstPad *pad, GstCaps *caps)
retval = (PyObject*)PyObject_CallFunction (function,
"OO",
pad_private(pad)->pad,
PyCObject_FromVoidPtr (caps, NULL));
pyg_boxed_new(GST_TYPE_CAPS, caps, TRUE, TRUE));
if (PyErr_Occurred ()) {
PyErr_Print ();
@ -133,7 +133,7 @@ call_chain_function (GstPad *pad, GstBuffer *buf)
PyObject_CallFunction (function,
"OO",
pad_private(pad)->pad,
PyCObject_FromVoidPtr (buf, NULL));
pyg_boxed_new(GST_TYPE_BUFFER, buf, TRUE, TRUE));
if (PyErr_Occurred ()) {
PyErr_Print ();
@ -171,95 +171,41 @@ _wrap_gst_pad_set_chain_function (PyGObject *self,
return Py_None;
}
%%
override gst_pad_push kwargs
static PyObject*
_wrap_gst_pad_push (PyGObject *self,
PyObject *args,
PyObject *kwargs)
{
static char *kwlist[] = { "buffer", NULL };
PyObject *pybuf;
GstBuffer *buf;
GstPad *pad;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"O:GstPad.push",
kwlist,
&pybuf)) {
return NULL;
}
if (!PyCObject_Check(pybuf)) {
PyErr_SetString(PyExc_TypeError, "push expecting a PyCObject");
return NULL;
}
pad = (GstPad*)pygobject_get(self);
buf = (GstBuffer*)PyCObject_AsVoidPtr(pybuf);
gst_pad_push(pad, buf);
Py_INCREF(Py_None);
return Py_None;
}
%%
override gst_buffer_get_data
static PyObject*
_wrap_gst_buffer_get_data (PyObject *self,
PyObject *args)
_wrap_gst_buffer_get_data(PyObject *self)
{
PyObject *pybuf;
GstBuffer *buf;
if (!PyArg_ParseTuple(args,
"O:GstBuffer:get_data",
&pybuf)) {
return NULL;
}
if (!PyCObject_Check(pybuf)) {
PyErr_SetString(PyExc_TypeError, "get_data expecting a PyCObject");
return NULL;
}
buf = (GstBuffer*)PyCObject_AsVoidPtr(pybuf);
buf = pyg_boxed_get(self, GstBuffer);
return PyString_FromStringAndSize(
GST_BUFFER_DATA(buf),
GST_BUFFER_SIZE(buf));
}
%%
override gst_buffer_set_data
override gst_buffer_set_data kwargs
static PyObject*
_wrap_gst_buffer_set_data (PyObject *self,
PyObject *args)
_wrap_gst_buffer_set_data(PyObject *self, PyObject *args, PyObject *kwargs)
{
PyObject *pybuf;
static char *kwlist[] = {"data", NULL};
PyObject *data;
GstBuffer *buf;
if (!PyArg_ParseTuple(args,
"OO:GstBuffer:set_data",
&pybuf, &data)) {
return NULL;
}
if (!PyCObject_Check(pybuf)) {
PyErr_SetString(PyExc_TypeError, "set_data expecting a PyCObject");
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:GstBuffer:set_data", kwlist, &data)) {
return NULL;
}
if (!PyString_Check(data)) {
PyErr_SetString(PyExc_TypeError, "set_data expecting a string");
PyErr_SetString(PyExc_TypeError, "data should be a string");
return NULL;
}
buf = pyg_boxed_get(self, GstBuffer);
if (GST_BUFFER_FLAGS(buf) & GST_BUFFER_READONLY) {
PyErr_SetString(PyExc_TypeError, "set_data can't use a READONLY buffer");
return NULL;
}
buf = (GstBuffer*)PyCObject_AsVoidPtr(pybuf);
GST_BUFFER_SIZE(buf) = PyString_Size(data);
GST_BUFFER_DATA(buf) = g_new0(char, GST_BUFFER_SIZE(buf));
@ -270,19 +216,3 @@ _wrap_gst_buffer_set_data (PyObject *self,
Py_INCREF(Py_None);
return Py_None;
}
%%
override gst_buffer_new
static PyObject*
_wrap_gst_buffer_new (PyObject *self,
PyObject *args)
{
GstBuffer *newbuf;
if (!PyArg_ParseTuple(args, ":GstBuffer:set_data")) {
return NULL;
}
newbuf = gst_buffer_new();
return PyCObject_FromVoidPtr (newbuf, NULL);
}

View file

@ -23,7 +23,7 @@ GST_INCLUDES=$(wildcard $(GST_INCLUDEDIR)/gst/*.h)
gstreamer-base.defs: $(GST_INCLUDES)
$(PYTHON) $(PYGTK_H2DEF) $(GST_INCLUDES) > gstreamer-base.defs
gstreamer.defs: gstreamer-base.defs gstreamer-extra.defs
gstreamer.defs: gstreamer-base.defs gstreamer-extra.defs $(top_srcdir)/gstreamer/gstreamer-arg-types.py
cat gstreamer-base.defs gstreamer-extra.defs > gstreamer.defs
.defs.c:

View file

@ -1,20 +1,52 @@
;;
;; Boxed types
;;
(define-boxed Buffer
(in-module "Gst")
(c-name "GstBuffer")
(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")
(gtype-id "GST_TYPE_CAPS")
)
(define-boxed Event
(in-module "Gst")
(c-name "GstEvent")
(gtype-id "GST_TYPE_EVENT")
)
(define-boxed Props
(in-module "Gst")
(c-name "GstProps")
(gtype-id "GST_TYPE_PROPS")
)
;;
;; HACK
;;
(define-function gst_buffer_get_data
(define-method get_data
(of-object "GstBuffer")
(c-name "gst_buffer_get_data")
(return-type "char*")
(parameters
'("GstBuffer*" "buf")
)
)
(define-function gst_buffer_set_data
(define-method set_data
(of-object "GstBuffer")
(c-name "gst_buffer_set_data")
(return-type "none")
(parameters
'("GstBuffer*" "buf")
'("char*" "data")
)
)

View file

@ -81,7 +81,7 @@ call_connect_function (GstPad *pad, GstCaps *caps)
retval = (PyObject*)PyObject_CallFunction (function,
"OO",
pad_private(pad)->pad,
PyCObject_FromVoidPtr (caps, NULL));
pyg_boxed_new(GST_TYPE_CAPS, caps, TRUE, TRUE));
if (PyErr_Occurred ()) {
PyErr_Print ();
@ -133,7 +133,7 @@ call_chain_function (GstPad *pad, GstBuffer *buf)
PyObject_CallFunction (function,
"OO",
pad_private(pad)->pad,
PyCObject_FromVoidPtr (buf, NULL));
pyg_boxed_new(GST_TYPE_BUFFER, buf, TRUE, TRUE));
if (PyErr_Occurred ()) {
PyErr_Print ();
@ -171,95 +171,41 @@ _wrap_gst_pad_set_chain_function (PyGObject *self,
return Py_None;
}
%%
override gst_pad_push kwargs
static PyObject*
_wrap_gst_pad_push (PyGObject *self,
PyObject *args,
PyObject *kwargs)
{
static char *kwlist[] = { "buffer", NULL };
PyObject *pybuf;
GstBuffer *buf;
GstPad *pad;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"O:GstPad.push",
kwlist,
&pybuf)) {
return NULL;
}
if (!PyCObject_Check(pybuf)) {
PyErr_SetString(PyExc_TypeError, "push expecting a PyCObject");
return NULL;
}
pad = (GstPad*)pygobject_get(self);
buf = (GstBuffer*)PyCObject_AsVoidPtr(pybuf);
gst_pad_push(pad, buf);
Py_INCREF(Py_None);
return Py_None;
}
%%
override gst_buffer_get_data
static PyObject*
_wrap_gst_buffer_get_data (PyObject *self,
PyObject *args)
_wrap_gst_buffer_get_data(PyObject *self)
{
PyObject *pybuf;
GstBuffer *buf;
if (!PyArg_ParseTuple(args,
"O:GstBuffer:get_data",
&pybuf)) {
return NULL;
}
if (!PyCObject_Check(pybuf)) {
PyErr_SetString(PyExc_TypeError, "get_data expecting a PyCObject");
return NULL;
}
buf = (GstBuffer*)PyCObject_AsVoidPtr(pybuf);
buf = pyg_boxed_get(self, GstBuffer);
return PyString_FromStringAndSize(
GST_BUFFER_DATA(buf),
GST_BUFFER_SIZE(buf));
}
%%
override gst_buffer_set_data
override gst_buffer_set_data kwargs
static PyObject*
_wrap_gst_buffer_set_data (PyObject *self,
PyObject *args)
_wrap_gst_buffer_set_data(PyObject *self, PyObject *args, PyObject *kwargs)
{
PyObject *pybuf;
static char *kwlist[] = {"data", NULL};
PyObject *data;
GstBuffer *buf;
if (!PyArg_ParseTuple(args,
"OO:GstBuffer:set_data",
&pybuf, &data)) {
return NULL;
}
if (!PyCObject_Check(pybuf)) {
PyErr_SetString(PyExc_TypeError, "set_data expecting a PyCObject");
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:GstBuffer:set_data", kwlist, &data)) {
return NULL;
}
if (!PyString_Check(data)) {
PyErr_SetString(PyExc_TypeError, "set_data expecting a string");
PyErr_SetString(PyExc_TypeError, "data should be a string");
return NULL;
}
buf = pyg_boxed_get(self, GstBuffer);
if (GST_BUFFER_FLAGS(buf) & GST_BUFFER_READONLY) {
PyErr_SetString(PyExc_TypeError, "set_data can't use a READONLY buffer");
return NULL;
}
buf = (GstBuffer*)PyCObject_AsVoidPtr(pybuf);
GST_BUFFER_SIZE(buf) = PyString_Size(data);
GST_BUFFER_DATA(buf) = g_new0(char, GST_BUFFER_SIZE(buf));
@ -270,19 +216,3 @@ _wrap_gst_buffer_set_data (PyObject *self,
Py_INCREF(Py_None);
return Py_None;
}
%%
override gst_buffer_new
static PyObject*
_wrap_gst_buffer_new (PyObject *self,
PyObject *args)
{
GstBuffer *newbuf;
if (!PyArg_ParseTuple(args, ":GstBuffer:set_data")) {
return NULL;
}
newbuf = gst_buffer_new();
return PyCObject_FromVoidPtr (newbuf, NULL);
}