mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
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
This commit is contained in:
parent
28b45522be
commit
112f72dabc
5 changed files with 25 additions and 7 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
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>
|
2006-01-05 Edward Hervey <edward@fluendo.com>
|
||||||
|
|
||||||
* gst/base.defs:
|
* gst/base.defs:
|
||||||
|
|
2
common
2
common
|
@ -1 +1 @@
|
||||||
Subproject commit 5f10c872cafb3eb8058d63e438cae029ed9e8d73
|
Subproject commit e0b121388ece524c0b7035a72bddd191d122d8bf
|
|
@ -113,14 +113,16 @@ _wrap_gst_structure_set_value(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||||
} else {
|
} else {
|
||||||
/* Let PyGTK guess a GType for the object. */
|
/* Let PyGTK guess a GType for the object. */
|
||||||
type = pyg_type_from_object((PyObject *) py_value->ob_type);
|
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) {
|
if (pygst_value_from_pyobject(&value, py_value) != 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
gst_structure_set_value(pyg_boxed_get(self, GstStructure), field,
|
gst_structure_set_value(pyg_boxed_get(self, GstStructure), field,
|
||||||
&value);
|
&value);
|
||||||
|
|
|
@ -61,7 +61,7 @@ class CapsTest(TestCase):
|
||||||
assert caps[0]['width'] == 10
|
assert caps[0]['width'] == 10
|
||||||
|
|
||||||
def testCapsConstructFromStructure(self):
|
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)
|
caps = gst.Caps(struct)
|
||||||
assert isinstance(caps, gst.Caps)
|
assert isinstance(caps, gst.Caps)
|
||||||
assert len(caps) == 1
|
assert len(caps) == 1
|
||||||
|
@ -69,6 +69,7 @@ class CapsTest(TestCase):
|
||||||
assert caps[0].get_name() == 'video/x-raw-yuv'
|
assert caps[0].get_name() == 'video/x-raw-yuv'
|
||||||
assert isinstance(caps[0]['width'], int)
|
assert isinstance(caps[0]['width'], int)
|
||||||
assert caps[0]['width'] == 10
|
assert caps[0]['width'] == 10
|
||||||
|
assert isinstance(caps[0]['framerate'], gst.FractionRange)
|
||||||
|
|
||||||
def testCapsConstructFromStructures(self):
|
def testCapsConstructFromStructures(self):
|
||||||
struct1 = gst.structure_from_string('video/x-raw-yuv,width=10')
|
struct1 = gst.structure_from_string('video/x-raw-yuv,width=10')
|
||||||
|
|
|
@ -73,6 +73,12 @@ class StructureTest(TestCase):
|
||||||
s['frac'] = gst.Fraction(3,4)
|
s['frac'] = gst.Fraction(3,4)
|
||||||
assert s['frac'].num == 3
|
assert s['frac'].num == 3
|
||||||
assert s['frac'].denom == 4
|
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)
|
s['intrange'] = gst.IntRange(5,21)
|
||||||
assert s['intrange'].low == 5
|
assert s['intrange'].low == 5
|
||||||
assert s['intrange'].high == 21
|
assert s['intrange'].high == 21
|
||||||
|
|
Loading…
Reference in a new issue