diff --git a/ChangeLog b/ChangeLog index 6b2a651346..b5937d388d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-02-25 Michael Smith + + * gst/pygstvalue.c: (pygst_value_init_for_pyobject), + (pygst_value_from_pyobject): + Make buffers-in-gvalues more generic: handle all miniobjects + * testsuite/test_caps.py: + Add a bit to one the test for buffers in caps. + 2007-02-24 Michael Smith * testsuite/test_caps.py: diff --git a/gst/pygstvalue.c b/gst/pygstvalue.c index 625f77ddc9..59e2e1dddb 100644 --- a/gst/pygstvalue.c +++ b/gst/pygstvalue.c @@ -32,8 +32,6 @@ static PyObject *gstdoublerange_class = NULL; static PyObject *gstfraction_class = NULL; static PyObject *gstfractionrange_class = NULL; -extern PyTypeObject PyGstBuffer_Type; - /** * pygst_value_as_pyobject: * @value: the GValue object. @@ -147,9 +145,9 @@ pygst_value_init_for_pyobject (GValue *value, PyObject *obj) PyErr_SetString(PyExc_TypeError, "Unexpected gst.Value instance"); return FALSE; } - } else if (PyObject_IsInstance (obj, (PyObject *)&PyGstBuffer_Type)) { + } else if (PyObject_IsInstance (obj, (PyObject *)&PyGstMiniObject_Type)) { PyErr_Clear (); - t = GST_TYPE_BUFFER; + t = GST_TYPE_MINI_OBJECT; } else if (PyTuple_Check (obj)) { PyErr_Clear (); t = GST_TYPE_ARRAY; @@ -266,9 +264,9 @@ pygst_value_from_pyobject (GValue *value, PyObject *obj) return -1; } return 0; - } else if (PyObject_IsInstance (obj, (PyObject *)&PyGstBuffer_Type)) { - VALUE_TYPE_CHECK (value, GST_TYPE_BUFFER); - gst_value_set_buffer (value, pygstminiobject_get(obj)); + } else if (PyObject_IsInstance (obj, (PyObject *)&PyGstMiniObject_Type)) { + VALUE_TYPE_CHECK (value, GST_TYPE_MINI_OBJECT); + gst_value_set_mini_object (value, pygstminiobject_get(obj)); return 0; } else if (PyTuple_Check (obj)) { gint i, len; diff --git a/testsuite/test_caps.py b/testsuite/test_caps.py index 2eb33d0b89..60360c52e6 100644 --- a/testsuite/test_caps.py +++ b/testsuite/test_caps.py @@ -50,14 +50,15 @@ class CapsTest(TestCase): def testCapsContainingMiniObjects(self): # buffer contains hex encoding of ascii 'abcd' caps = gst.Caps("video/x-raw-yuv, buf=(buffer)61626364") - assert isinstance(caps[0]['buf'], gst.Buffer) + buf = caps[0]['buf'] + assert isinstance(buf, gst.Buffer) + assert buf.data == "abcd" buf = gst.Buffer("1234") caps[0]['buf2'] = buf buf2 = caps[0]['buf2'] assert buf2 == buf - def testCapsConstructEmpty(self): caps = gst.Caps() assert isinstance(caps, gst.Caps)