gst/gst.override (_wrap_gst_structure_ass_subscript): Some more fixes, doesn't quite work as it should yet though.x

Original commit message from CVS:
* gst/gst.override (_wrap_gst_structure_ass_subscript): Some more
fixes, doesn't quite work as it should yet though.x
(_wrap_gst_caps_tp_str): Plug leak

* gst/interfaces.defs (Mixer, MixerTrack): Add mixer fields here.

* testsuite/element.py (QueueTest.testConstruct): Some basic test,
one disabled for the moment
This commit is contained in:
Johan Dahlin 2004-08-30 10:42:36 +00:00
parent 78e7f604ad
commit 02f72cd028
8 changed files with 84 additions and 8 deletions

View file

@ -1,3 +1,14 @@
2004-08-30 Johan Dahlin <johan@gnome.org>
* gst/gst.override (_wrap_gst_structure_ass_subscript): Some more
fixes, doesn't quite work as it should yet though.x
(_wrap_gst_caps_tp_str): Plug leak
* gst/interfaces.defs (Mixer, MixerTrack): Add mixer fields here.
* testsuite/element.py (QueueTest.testConstruct): Some basic test,
one disabled for the moment
2004-08-12 Johan Dahlin <johan@gnome.org> 2004-08-12 Johan Dahlin <johan@gnome.org>
* gst/interfaces.defs (TunerNorm, TunerChannel): Add fields. * gst/interfaces.defs (TunerNorm, TunerChannel): Add fields.

View file

@ -6082,3 +6082,4 @@
'("GstObject*" "parent") '("GstObject*" "parent")
) )
) )

View file

@ -1,5 +1,5 @@
/* -*- Mode: C; c-basic-offset: 4 -*- */ /* -*- Mode: C; c-basic-offset: 4 -*- */
so/* gst-python /* gst-python
* Copyright (C) 2002 David I. Lehn * Copyright (C) 2002 David I. Lehn
* Copyright (C) 2004 Johan Dahlin * Copyright (C) 2004 Johan Dahlin
* *
@ -73,7 +73,7 @@ include
init init
PyGstPipeline_Type.tp_new = PyType_GenericNew; PyGstPipeline_Type.tp_new = PyType_GenericNew;
PyGstThread_Type.tp_new = PyType_GenericNew; PyGstThread_Type.tp_new = PyType_GenericNew;
PyGstQueue_Type.tp_new = PyType_GenericNew; //PyGstQueue_Type.tp_new = PyType_GenericNew;
PyGstBin_Type.tp_new = PyType_GenericNew; // Shouldn't this be enough? PyGstBin_Type.tp_new = PyType_GenericNew; // Shouldn't this be enough?
%% %%
modulename gst modulename gst
@ -90,7 +90,6 @@ ignore-glob
*_thyself *_thyself
*_valist *_valist
gst_class_* gst_class_*
gst_debug_*
gst_init* gst_init*
gst_interface_* gst_interface_*
gst_tag_list_get_* gst_tag_list_get_*
@ -487,7 +486,14 @@ override-slot GstCaps.tp_str
static PyObject * static PyObject *
_wrap_gst_caps_tp_str(PyGObject *self) _wrap_gst_caps_tp_str(PyGObject *self)
{ {
return PyString_FromString(gst_caps_to_string((GstCaps*)self->obj)); gchar *tmp;
PyObject *retval;
tmp = gst_caps_to_string((GstCaps*)self->obj);
retval = PyString_FromString(tmp);
g_free(tmp);
return retval;
} }
%% %%
define GstTagList.keys noargs define GstTagList.keys noargs
@ -766,14 +772,28 @@ _wrap_gst_structure_ass_subscript(PyGObject *self,
{ {
const char *key; const char *key;
GstStructure* structure; GstStructure* structure;
GValue value = { 0, };
structure = (GstStructure*)self->obj; structure = (GstStructure*)self->obj;
key = PyString_AsString(py_key); key = PyString_AsString(py_key);
if (py_value != NULL) { if (py_value != NULL) {
if (PyString_Check(py_value)) if (PyString_Check(py_value)) {
gst_structure_set(structure, key, G_TYPE_STRING, PyString_AsString(py_value), NULL); #if 0
else if (PyInt_Check(py_value)) GValue *value = NULL;
gst_structure_field_from_string(PyString_AsString(py_value), value);
g_print ("gvalue: %s %s %s\n",
PyString_AsString(py_value),
gst_value_serialize(value),
G_VALUE_TYPE_NAME(value));
gst_structure_set_value(structure, key, value);
#else
GValue value = { 0, };
g_value_init (&value, G_TYPE_STRING);
gst_value_deserialize(&value, PyString_AsString(py_value));
gst_structure_set_value(structure, key, &value);
g_value_unset(&value);
#endif
// gst_structure_set(structure, key, G_TYPE_STRING, PyString_AsString(py_value), NULL);
} else if (PyInt_Check(py_value))
gst_structure_set(structure, key, G_TYPE_INT, PyInt_AsLong(py_value), NULL); gst_structure_set(structure, key, G_TYPE_INT, PyInt_AsLong(py_value), NULL);
else if (PyFloat_Check(py_value)) else if (PyFloat_Check(py_value))
gst_structure_set(structure, key, G_TYPE_DOUBLE, PyFloat_AsDouble(py_value), NULL); gst_structure_set(structure, key, G_TYPE_DOUBLE, PyFloat_AsDouble(py_value), NULL);

View file

@ -484,6 +484,9 @@
(in-module "Gst") (in-module "Gst")
(c-name "GstMixer") (c-name "GstMixer")
(gtype-id "GST_TYPE_MIXER") (gtype-id "GST_TYPE_MIXER")
(fields
'("GstMixerType" "mixer_type")
)
) )
(define-object MixerTrack (define-object MixerTrack
@ -491,6 +494,13 @@
(parent "GstObject") (parent "GstObject")
(c-name "GstMixerTrack") (c-name "GstMixerTrack")
(gtype-id "GST_TYPE_MIXER_TRACK") (gtype-id "GST_TYPE_MIXER_TRACK")
(fields
'("gchar*" "label")
'("GstMixerTrackFlags" "flags")
'("gint" "num_channels")
'("gint" "min_volume")
'("gint" "max_volume")
)
) )
(define-interface Navigation (define-interface Navigation

View file

@ -158,5 +158,15 @@ class QueryTest(unittest.TestCase):
assert self.element.query(gst.QUERY_POSITION, gst.FORMAT_BYTES) == 0 assert self.element.query(gst.QUERY_POSITION, gst.FORMAT_BYTES) == 0
assert self.element.query(gst.QUERY_POSITION, gst.FORMAT_TIME) == 0 assert self.element.query(gst.QUERY_POSITION, gst.FORMAT_TIME) == 0
class QueueTest(unittest.TestCase):
def testConstruct(self):
queue = gst.element_factory_make('queue')
assert isinstance(queue, gst.Queue)
assert queue.get_name() == 'queue0'
#queue = gst.Element('queue')
#assert isinstance(queue, gst.Queue)
#assert queue.get_name() == 'queue0'
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()

View file

@ -37,6 +37,13 @@ class StructureTest(unittest.TestCase):
assert isinstance(self.struct['integer'], int) assert isinstance(self.struct['integer'], int)
assert self.struct['integer'] == 5, self.struct['integer'] assert self.struct['integer'] == 5, self.struct['integer']
def testCreateFourCC(self):
self.struct['fourcc'] = "(fourcc)XVID"
#assert self.struct.has_key('fourcc')
#print self.struct.to_string()
#assert isinstance(self.struct['fourcc'], int)
#assert self.struct['integer'] == 5, self.struct['integer']
def testStructureChange(self): def testStructureChange(self):
#assert structure['pixel-aspect-ratio'].numerator == 1 #assert structure['pixel-aspect-ratio'].numerator == 1
#assert structure['pixel-aspect-ratio'].denominator == 2 #assert structure['pixel-aspect-ratio'].denominator == 2

View file

@ -158,5 +158,15 @@ class QueryTest(unittest.TestCase):
assert self.element.query(gst.QUERY_POSITION, gst.FORMAT_BYTES) == 0 assert self.element.query(gst.QUERY_POSITION, gst.FORMAT_BYTES) == 0
assert self.element.query(gst.QUERY_POSITION, gst.FORMAT_TIME) == 0 assert self.element.query(gst.QUERY_POSITION, gst.FORMAT_TIME) == 0
class QueueTest(unittest.TestCase):
def testConstruct(self):
queue = gst.element_factory_make('queue')
assert isinstance(queue, gst.Queue)
assert queue.get_name() == 'queue0'
#queue = gst.Element('queue')
#assert isinstance(queue, gst.Queue)
#assert queue.get_name() == 'queue0'
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()

View file

@ -37,6 +37,13 @@ class StructureTest(unittest.TestCase):
assert isinstance(self.struct['integer'], int) assert isinstance(self.struct['integer'], int)
assert self.struct['integer'] == 5, self.struct['integer'] assert self.struct['integer'] == 5, self.struct['integer']
def testCreateFourCC(self):
self.struct['fourcc'] = "(fourcc)XVID"
#assert self.struct.has_key('fourcc')
#print self.struct.to_string()
#assert isinstance(self.struct['fourcc'], int)
#assert self.struct['integer'] == 5, self.struct['integer']
def testStructureChange(self): def testStructureChange(self):
#assert structure['pixel-aspect-ratio'].numerator == 1 #assert structure['pixel-aspect-ratio'].numerator == 1
#assert structure['pixel-aspect-ratio'].denominator == 2 #assert structure['pixel-aspect-ratio'].denominator == 2