gst/gst.override (_wrap_gst_structure_ass_subscript): Some more fixes, doesn't quite...
authorJohan Dahlin <johan@gnome.org>
Mon, 30 Aug 2004 10:42:36 +0000 (10:42 +0000)
committerJohan Dahlin <johan@gnome.org>
Mon, 30 Aug 2004 10:42:36 +0000 (10:42 +0000)
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

ChangeLog
gst/gst.defs
gst/gst.override
gst/interfaces.defs
testsuite/element.py
testsuite/struct.py
testsuite/test_element.py
testsuite/test_struct.py

index 803baed..adbbfed 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * gst/interfaces.defs (TunerNorm, TunerChannel): Add fields.
index 21cc1df..e0c3e47 100644 (file)
     '("GstObject*" "parent")
   )
 )
+
index e5e6df9..a2346fb 100644 (file)
@@ -1,5 +1,5 @@
 /* -*- Mode: C; c-basic-offset: 4 -*- */
-so/* gst-python
+/* gst-python
  * Copyright (C) 2002 David I. Lehn
  * Copyright (C) 2004 Johan Dahlin
  *
@@ -73,7 +73,7 @@ include
 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
@@ -90,7 +90,6 @@ ignore-glob
   *_thyself
   *_valist
   gst_class_*
-  gst_debug_*
   gst_init*
   gst_interface_*
   gst_tag_list_get_*
@@ -487,7 +486,14 @@ override-slot GstCaps.tp_str
 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
@@ -766,14 +772,28 @@ _wrap_gst_structure_ass_subscript(PyGObject *self,
 {
        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);
index 08c940e..c759440 100644 (file)
    (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
index 47bd5e6..d71486a 100644 (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_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()
index e51e2b3..f12cf44 100644 (file)
@@ -37,6 +37,13 @@ class StructureTest(unittest.TestCase):
         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
index 47bd5e6..d71486a 100644 (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_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()
index e51e2b3..f12cf44 100644 (file)
@@ -37,6 +37,13 @@ class StructureTest(unittest.TestCase):
         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