[Bug 753754] Add GstValueList and GstValueArray support to gst-python

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Sat Mar 18 01:37:08 UTC 2017


https://bugzilla.gnome.org/show_bug.cgi?id=753754

--- Comment #7 from Nicolas Dufresne (stormer) <nicolas at ndufresne.ca> ---
While it would be interesting to have python specific bindings (even though not
that trivial), I made a experiment today of a new API that would address this
issue.

What I did, and it was conclusive, is to implement GValueArray to/from
GST_TYPE_ARRAY/LIST conversion (though g_value_transform). Then I implement
those new function in GstStructure:

  gboolean gst_structure_get_array (s, fieldname, GValueArray ** array)
  gboolean gst_structure_get_list (s, fieldname, GValueArray **array)
  void gst_structure_set_array (s, fieldname, GValueArray * array)
  void gst_structure_set_list (s, fieldname, GValueArray * array)

Then in Python, you can use it as follow:

  s = Gst.Structure.new_empty("test")
  arr = GObject.ValueArray()
  arr.append(1)
  arr.append(2)
  s.set_array("array", arr)
  ret, arr = s.get_array("array")

I'll add similar helpers to get/set GST_TYPE_ARRAY/LIST object properties. The
reason I went this way is that it's language agnostic, and representing those
in an override seems more complex then just a Fraction.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list