+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>
* gst/interfaces.defs (TunerNorm, TunerChannel): Add fields.
'("GstObject*" "parent")
)
)
+
/* -*- Mode: C; c-basic-offset: 4 -*- */
-so/* gst-python
+/* gst-python
* Copyright (C) 2002 David I. Lehn
* Copyright (C) 2004 Johan Dahlin
*
init
PyGstPipeline_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?
%%
modulename gst
*_thyself
*_valist
gst_class_*
- gst_debug_*
gst_init*
gst_interface_*
gst_tag_list_get_*
static PyObject *
_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
{
const char *key;
GstStructure* structure;
- GValue value = { 0, };
structure = (GstStructure*)self->obj;
key = PyString_AsString(py_key);
if (py_value != NULL) {
- if (PyString_Check(py_value))
- gst_structure_set(structure, key, G_TYPE_STRING, PyString_AsString(py_value), NULL);
- else if (PyInt_Check(py_value))
+ if (PyString_Check(py_value)) {
+#if 0
+ 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);
else if (PyFloat_Check(py_value))
gst_structure_set(structure, key, G_TYPE_DOUBLE, PyFloat_AsDouble(py_value), NULL);
(in-module "Gst")
(c-name "GstMixer")
(gtype-id "GST_TYPE_MIXER")
+ (fields
+ '("GstMixerType" "mixer_type")
+ )
)
(define-object MixerTrack
(parent "GstObject")
(c-name "GstMixerTrack")
(gtype-id "GST_TYPE_MIXER_TRACK")
+ (fields
+ '("gchar*" "label")
+ '("GstMixerTrackFlags" "flags")
+ '("gint" "num_channels")
+ '("gint" "min_volume")
+ '("gint" "max_volume")
+ )
)
(define-interface Navigation
assert self.element.query(gst.QUERY_POSITION, gst.FORMAT_BYTES) == 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__":
unittest.main()
assert isinstance(self.struct['integer'], int)
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):
#assert structure['pixel-aspect-ratio'].numerator == 1
#assert structure['pixel-aspect-ratio'].denominator == 2
assert self.element.query(gst.QUERY_POSITION, gst.FORMAT_BYTES) == 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__":
unittest.main()
assert isinstance(self.struct['integer'], int)
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):
#assert structure['pixel-aspect-ratio'].numerator == 1
#assert structure['pixel-aspect-ratio'].denominator == 2