diff options
author | Olivier Aubert <olivier.aubert@liris.cnrs.fr> | 2009-07-24 17:36:18 +0200 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2010-04-29 16:10:20 +0200 |
commit | f01b950a4cfd8e38836fc51daf63158a71999ead (patch) | |
tree | ab2c58e3cbe304f38aa739aafe5b258d4e68e44f /gst | |
parent | 697c8e73f7bed536f3a3222bb4b374287ea4b747 (diff) |
Implement setter for gst.Buffer.size
https://bugzilla.gnome.org/show_bug.cgi?id=589582
Diffstat (limited to 'gst')
-rw-r--r-- | gst/gstbuffer.override | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/gst/gstbuffer.override b/gst/gstbuffer.override index 7a9eb94..c3c6ffe 100644 --- a/gst/gstbuffer.override +++ b/gst/gstbuffer.override @@ -383,6 +383,44 @@ _wrap_gst_buffer__get_data(PyObject *self, void *closure) } %% +override-attr GstBuffer.size +static PyObject * +_wrap_gst_buffer__get_size(PyObject *self, void *closure) +{ + return PyLong_FromUnsignedLongLong((guint) GST_BUFFER_SIZE(GST_BUFFER(pygstminiobject_get(self)))); +} +static int +_wrap_gst_buffer__set_size(PyGstMiniObject *self, PyObject *value, void *closure) +{ + guint val; + GstBuffer *buf; + void* ptr; + + if (PyInt_CheckExact(value)) + val = PyInt_AsUnsignedLongLongMask(value); + else + val = PyLong_AsUnsignedLongLong(value); + if (PyErr_Occurred()) + return -1; + + g_assert (self); + buf = GST_BUFFER(pygstminiobject_get(self)); + g_assert (buf); + + ptr = realloc( GST_BUFFER_DATA(buf), val ); + if (ptr) + { + GST_BUFFER_DATA(buf) = ptr; + GST_BUFFER_SIZE(buf) = val; + } + else + { + /* Raise an error */ + PyErr_SetString( PyExc_RuntimeError, "Unable to realloc Buffer" ); + } + return 0; +} +%% override-attr GstBuffer.timestamp static PyObject * _wrap_gst_buffer__get_timestamp(PyObject *self, void *closure) |