Commit 112f72da authored by Edward Hervey's avatar Edward Hervey 🤘

gst/gststructure.override: Properly check for gstvalue data types. This makes...

gst/gststructure.override: Properly check for gstvalue data types. This makes it possible to set fields with fractions.

Original commit message from CVS:
* gst/gststructure.override: (_wrap_gst_structure_set_value):
Properly check for gstvalue data types. This makes it possible to
set fields with fractions.
* testsuite/test_caps.py:
* testsuite/test_struct.py:
Test for above modifications
parent 28b45522
2006-01-08 Martin Soto <martinsoto@users.sourceforge.net>
* gst/gststructure.override: (_wrap_gst_structure_set_value):
Properly check for gstvalue data types. This makes it possible to
set fields with fractions.
* testsuite/test_caps.py:
* testsuite/test_struct.py:
Test for above modifications
2006-01-05 Edward Hervey <edward@fluendo.com>
* gst/base.defs:
......
common @ e0b12138
Subproject commit 5f10c872cafb3eb8058d63e438cae029ed9e8d73
Subproject commit e0b121388ece524c0b7035a72bddd191d122d8bf
......@@ -113,14 +113,16 @@ _wrap_gst_structure_set_value(PyObject *self, PyObject *args, PyObject *kwargs)
} else {
/* Let PyGTK guess a GType for the object. */
type = pyg_type_from_object((PyObject *) py_value->ob_type);
if (type == 0) {
return NULL;
}
}
g_value_init(&value, type);
if (type != G_TYPE_INVALID) {
g_value_init(&value, type);
} else if (!pygst_value_init_for_pyobject(&value, py_value)) {
return NULL;
}
if (pygst_value_from_pyobject(&value, py_value) != 0) {
return NULL;
return NULL;
}
gst_structure_set_value(pyg_boxed_get(self, GstStructure), field,
&value);
......
......@@ -61,7 +61,7 @@ class CapsTest(TestCase):
assert caps[0]['width'] == 10
def testCapsConstructFromStructure(self):
struct = gst.structure_from_string('video/x-raw-yuv,width=10')
struct = gst.structure_from_string('video/x-raw-yuv,width=10,framerate=[0/1, 25/3]')
caps = gst.Caps(struct)
assert isinstance(caps, gst.Caps)
assert len(caps) == 1
......@@ -69,6 +69,7 @@ class CapsTest(TestCase):
assert caps[0].get_name() == 'video/x-raw-yuv'
assert isinstance(caps[0]['width'], int)
assert caps[0]['width'] == 10
assert isinstance(caps[0]['framerate'], gst.FractionRange)
def testCapsConstructFromStructures(self):
struct1 = gst.structure_from_string('video/x-raw-yuv,width=10')
......
......@@ -73,6 +73,12 @@ class StructureTest(TestCase):
s['frac'] = gst.Fraction(3,4)
assert s['frac'].num == 3
assert s['frac'].denom == 4
s['fracrange'] = gst.FractionRange(gst.Fraction(0,1),
gst.Fraction(25,3))
assert s['fracrange'].low.num == 0
assert s['fracrange'].low.denom == 1
assert s['fracrange'].high.num == 25
assert s['fracrange'].high.denom == 3
s['intrange'] = gst.IntRange(5,21)
assert s['intrange'].low == 5
assert s['intrange'].high == 21
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment