gst/gsttaglist.override: put the gst.TagList.keys() method back.
authorEdward Hervey <bilboed@bilboed.com>
Thu, 10 Nov 2005 13:03:14 +0000 (13:03 +0000)
committerEdward Hervey <bilboed@bilboed.com>
Thu, 10 Nov 2005 13:03:14 +0000 (13:03 +0000)
Original commit message from CVS:
* gst/gsttaglist.override:
put the gst.TagList.keys() method back.

ChangeLog
gst/gsttaglist.override

index 13cb73d..80a0be0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2005-11-10  Edward Hervey  <edward@fluendo.com>
 
+       * gst/gsttaglist.override:
+       put the gst.TagList.keys() method back.
+
+2005-11-10  Edward Hervey  <edward@fluendo.com>
+
        * gst/gstmodule.c: (init_gst):
        Added GST_TAG_* string constants
        * gst/gstpad.override:
index 2c0ca14..0df2706 100644 (file)
@@ -33,6 +33,34 @@ ignore
   gst_tag_list_remove_tag
   gst_tag_list_foreach
 %%
+define GstTagList.keys noargs
+static void
+tag_foreach_func_list (const GstTagList *list,
+                      const gchar      *tag,
+                      PyObject         *py_list)
+{
+       int count;
+    
+       count = gst_tag_list_get_tag_size(GST_TAG_LIST(list), tag);
+       if (count == 0)
+               PyErr_SetString(PyExc_KeyError, tag);
+       else if (count == 1)
+               PyList_Append(py_list, PyString_FromString(tag));
+}
+
+static PyObject*
+_wrap_gst_tag_list_keys(PyGObject *self)
+{
+       PyObject *dict;
+
+       dict = PyList_New(0);
+    
+       gst_tag_list_foreach(GST_TAG_LIST(self->obj),
+                            (GstTagForeachFunc)tag_foreach_func_list,
+                            (gpointer)dict);
+       return dict;
+}
+%%
 override-slot GstTagList.tp_as_mapping
 static int
 _wrap_gst_tag_list_length(PyGObject *self)