gst/: Fix the build for x86_64 when compiling against Python 2.5.

Original commit message from CVS:
* gst/common.h:
* gst/gst.override:
* gst/gstbuffer.override:
* gst/gstcaps.override:
* gst/gststructure.override:
* gst/gsttaglist.override:
* gst/interfaces.override:
Fix the build for x86_64 when compiling against Python 2.5.
Keeps backwards compatibility with Python 2.4. Tested on Ubuntu
Edgy 32-bit with python 2.4 & Feisty 64-bit with Python 2.4 & 2.5
Fixes #415003.
This commit is contained in:
Jan Schmidt 2007-04-04 12:22:03 +00:00
parent 6baee7881d
commit c0f3f0d55f
8 changed files with 84 additions and 48 deletions

View file

@ -1,3 +1,18 @@
2007-04-04 Jan Schmidt <thaytan@mad.scientist.com>
* gst/common.h:
* gst/gst.override:
* gst/gstbuffer.override:
* gst/gstcaps.override:
* gst/gststructure.override:
* gst/gsttaglist.override:
* gst/interfaces.override:
Fix the build for x86_64 when compiling against Python 2.5.
Keeps backwards compatibility with Python 2.4. Tested on Ubuntu
Edgy 32-bit with python 2.4 & Feisty 64-bit with Python 2.4 & 2.5
Fixes #415003.
2007-03-25 Tim-Philipp Müller <tim at centricular dot net>
* gst/interfaces.defs:

View file

@ -36,8 +36,11 @@
#endif
#if PY_VERSION_HEX < 0x02050000
#define lenfunc inquiry
#define ssizeargfunc intargfunc
#define ssizessizeargfunc intintargfunc
#define ssizeobjargproc intobjargproc
#define ssizessizeobjargproc intintobjargproc
#endif
typedef struct {

View file

@ -58,6 +58,11 @@ headers
#include <compile.h>
#include <frameobject.h>
/* Boonky define that allows for backwards compatibility with Python 2.4 */
#if PY_VERSION_HEX < 0x02050000
#define Py_ssize_t int
#endif
GST_DEBUG_CATEGORY_EXTERN (python_debug);
GST_DEBUG_CATEGORY_EXTERN (pygst_debug);
#define GST_CAT_DEFAULT pygst_debug
@ -1030,7 +1035,7 @@ gst_type_find_peek_handler (gpointer data, gint64 offset, guint size)
goto beach;
} else {
gchar *str;
int len;
Py_ssize_t len;
if ((PyString_AsStringAndSize(py_ret, &str, &len)) == -1) {
Py_DECREF (py_ret);

View file

@ -23,17 +23,20 @@
%%
headers
static int gst_buffer_getreadbuffer (PyGstMiniObject *self,
int index,
const void **ptr);
static int gst_buffer_getwritebuf (PyGstMiniObject *self,
int index,
const void **ptr);
static int gst_buffer_getsegcount (PyGstMiniObject *self,
int *lenp);
static int gst_buffer_getcharbuf (PyGstMiniObject *self,
int index,
const char **ptr);
static Py_ssize_t gst_buffer_getreadbuffer (PyObject *self,
Py_ssize_t index, void **ptr);
static Py_ssize_t gst_buffer_getwritebuf (PyObject *self,
Py_ssize_t index, void **ptr);
static Py_ssize_t gst_buffer_getsegcount (PyObject *self,
Py_ssize_t *lenp);
#if PY_VERSION_HEX >= 0x02050000
static Py_ssize_t gst_buffer_getcharbuf (PyObject *self,
Py_ssize_t index, char **ptr);
#else
static Py_ssize_t gst_buffer_getcharbuf (PyObject *self,
Py_ssize_t index, const char **ptr);
#endif
%%
override gst_buffer_new kwargs
static int
@ -130,14 +133,15 @@ _wrap_gst_buffer_tp_repr (PyGstMiniObject *self)
%%
override-slot GstBuffer.tp_as_buffer
static PyBufferProcs _wrap_gst_buffer_tp_as_buffer = {
(getreadbufferproc)gst_buffer_getreadbuffer, /* bf_getreadbuffer */
(getwritebufferproc)gst_buffer_getwritebuf, /* bf_getwritebuffer */
(getsegcountproc)gst_buffer_getsegcount, /* bf_getsegcount */
(getcharbufferproc)gst_buffer_getcharbuf, /* bf_getcharbuffer */
gst_buffer_getreadbuffer, /* bf_getreadbuffer */
gst_buffer_getwritebuf, /* bf_getwritebuffer */
gst_buffer_getsegcount, /* bf_getsegcount */
gst_buffer_getcharbuf, /* bf_getcharbuffer */
};
static int
gst_buffer_getreadbuffer(PyGstMiniObject *self, int index, const void **ptr)
static Py_ssize_t
gst_buffer_getreadbuffer(PyObject *self, Py_ssize_t index,
void **ptr)
{
GstBuffer *buf = pyg_boxed_get(self, GstBuffer);
@ -151,8 +155,8 @@ gst_buffer_getreadbuffer(PyGstMiniObject *self, int index, const void **ptr)
return GST_BUFFER_SIZE(buf);
}
static int
gst_buffer_getsegcount(PyGstMiniObject *self, int *lenp)
static Py_ssize_t
gst_buffer_getsegcount(PyObject *self, Py_ssize_t *lenp)
{
GstBuffer *buf = pyg_boxed_get(self, GstBuffer);
@ -161,14 +165,20 @@ gst_buffer_getsegcount(PyGstMiniObject *self, int *lenp)
return 1;
}
static int
gst_buffer_getcharbuf(PyGstMiniObject *self, int index, const char **ptr)
/* Need a version that has const char ** for Python 2.4 */
#if PY_VERSION_HEX >= 0x02050000
static Py_ssize_t gst_buffer_getcharbuf (PyObject *self,
Py_ssize_t index, char **ptr)
#else
static Py_ssize_t gst_buffer_getcharbuf (PyObject *self,
Py_ssize_t index, const char **ptr)
#endif
{
return gst_buffer_getreadbuffer (self, index, (const void **) ptr);
return gst_buffer_getreadbuffer (self, index, (void **) ptr);
}
static int
gst_buffer_getwritebuf(PyGstMiniObject *self, int index, const void **ptr)
static Py_ssize_t
gst_buffer_getwritebuf(PyObject *self, Py_ssize_t index, void **ptr)
{
GstBuffer *buf = pyg_boxed_get(self, GstBuffer);
@ -192,14 +202,14 @@ gst_buffer_getwritebuf(PyGstMiniObject *self, int index, const void **ptr)
override-slot GstBuffer.tp_as_sequence
/* FIXME: should buffer parts be buffers or strings? */
static int
static Py_ssize_t
pygst_buffer_length(PyObject *self)
{
return GST_BUFFER_SIZE(pygobject_get (self));
}
static PyObject *
pygst_buffer_slice(PyObject *self, int start, int end)
pygst_buffer_slice(PyObject *self, Py_ssize_t start, Py_ssize_t end)
{
GstBuffer *buf = GST_BUFFER (pygobject_get (self));
if (start < 0)
@ -217,17 +227,18 @@ pygst_buffer_slice(PyObject *self, int start, int end)
}
static PyObject *
pygst_buffer_item(PyObject *self, int index)
pygst_buffer_item(PyObject *self, Py_ssize_t index)
{
return pygst_buffer_slice (self, index, index + 1);
}
static int
pygst_buffer_ass_slice (PyObject *self, int start, int end, PyObject *val)
pygst_buffer_ass_slice (PyObject *self, Py_ssize_t start,
Py_ssize_t end, PyObject *val)
{
GstBuffer *buf = GST_BUFFER (pygobject_get (self));
const void *data;
int len;
Py_ssize_t len;
if (!gst_buffer_is_writable (buf)) {
PyErr_SetString(PyExc_TypeError, "buffer is not writable");
@ -248,11 +259,11 @@ pygst_buffer_ass_slice (PyObject *self, int start, int end, PyObject *val)
}
static int
pygst_buffer_ass_item (PyObject *self, int index, PyObject *val)
pygst_buffer_ass_item (PyObject *self, Py_ssize_t index, PyObject *val)
{
GstBuffer *buf = GST_BUFFER (pygobject_get (self));
const void *data;
int len;
Py_ssize_t len;
if (!gst_buffer_is_writable (buf)) {
PyErr_SetString(PyExc_TypeError, "buffer is not writable");

View file

@ -77,7 +77,7 @@ ignore
gst_caps_set_simple
%%
override gst_caps_get_structure kwargs
static PyObject *pygst_caps_sq_item(PyObject *self, int i);
static PyObject *pygst_caps_sq_item(PyObject *self, Py_ssize_t i);
static PyObject *
_wrap_gst_caps_get_structure(PyObject *self, PyObject *args, PyObject *kwargs)
{
@ -349,7 +349,7 @@ static PyNumberMethods _wrap_gst_caps_tp_as_number = {
};
%%
override-slot GstCaps.tp_as_sequence
static int
static Py_ssize_t
pygst_caps_sq_length(PyObject *self)
{
GstCaps *caps = pyg_boxed_get (self, GstCaps);
@ -357,7 +357,7 @@ pygst_caps_sq_length(PyObject *self)
}
static PyObject *
pygst_caps_sq_item(PyObject *self, int i)
pygst_caps_sq_item(PyObject *self, Py_ssize_t i)
{
GstCaps *caps = pyg_boxed_get (self, GstCaps);
GstStructure *structure;
@ -381,7 +381,7 @@ pygst_caps_sq_item(PyObject *self, int i)
/* FIXME: This syntax sucks */
static PyObject *
pygst_caps_sq_slice(PyObject *self, int start, int end)
pygst_caps_sq_slice(PyObject *self, Py_ssize_t start, Py_ssize_t end)
{
GstCaps *caps = pyg_boxed_get (self, GstCaps);
GstCaps *ret = gst_caps_new_empty ();

View file

@ -172,10 +172,11 @@ _wrap_gst_structure_keys (PyObject *self)
%%
override-slot GstStructure.tp_as_mapping
static int
_wrap_gst_structure_length(PyGObject *self)
static Py_ssize_t
_wrap_gst_structure_length(PyObject *self)
{
return gst_structure_n_fields((GstStructure*)self->obj);
PyGObject *gself = (PyGObject *)self;
return gst_structure_n_fields((GstStructure*)gself->obj);
}
static PyObject *
@ -222,7 +223,7 @@ _wrap_gst_structure_ass_subscript(PyGObject *self,
}
static PyMappingMethods _wrap_gst_structure_tp_as_mapping = {
(inquiry)_wrap_gst_structure_length, /* mp_length */
_wrap_gst_structure_length, /* mp_length */
(binaryfunc)_wrap_gst_structure_subscript, /* mp_subscript */
(objobjargproc)_wrap_gst_structure_ass_subscript /* mp_ass_subscript */
};

View file

@ -63,10 +63,11 @@ _wrap_gst_tag_list_keys(PyGObject *self)
}
%%
override-slot GstTagList.tp_as_mapping
static int
_wrap_gst_tag_list_length(PyGObject *self)
static Py_ssize_t
_wrap_gst_tag_list_length(PyObject *self)
{
return gst_structure_n_fields((GstStructure*)self->obj);
PyGObject *gself = (PyGObject *)self;
return gst_structure_n_fields((GstStructure*)gself->obj);
}
static PyObject *
@ -113,7 +114,7 @@ _wrap_gst_tag_list_ass_subscript(PyGObject *self,
}
static PyMappingMethods _wrap_gst_tag_list_tp_as_mapping = {
(inquiry)_wrap_gst_tag_list_length, /* mp_length */
_wrap_gst_tag_list_length, /* mp_length */
(binaryfunc)_wrap_gst_tag_list_subscript, /* mp_subscript */
(objobjargproc)_wrap_gst_tag_list_ass_subscript /* mp_ass_subscript */
};
@ -127,13 +128,13 @@ _wrap_gst_tag_list_contains(PyGObject *self, PyObject *py_key)
}
static PySequenceMethods _wrap_gst_tag_list_tp_as_sequence = {
(inquiry)NULL,
(lenfunc)NULL,
(binaryfunc)NULL,
(ssizeargfunc)NULL,
(ssizeargfunc)NULL,
(ssizessizeargfunc)NULL,
(intobjargproc)NULL,
(intintobjargproc)NULL,
(ssizeobjargproc)NULL,
(ssizessizeobjargproc)NULL,
(objobjproc)_wrap_gst_tag_list_contains,
(binaryfunc)NULL,
(ssizeargfunc)NULL,

View file

@ -188,7 +188,7 @@ _wrap_gst_mixer_set_volume (PyGObject *self, PyObject *args, PyObject *kwargs)
if (channels != PyTuple_Size (py_tuple)) {
PyErr_Format (PyExc_TypeError,
"Track channel count %d != volume tuple size %d",
channels, PyTuple_Size (py_tuple));
channels, (gint) PyTuple_Size (py_tuple));
return NULL;
}