GNOME Bugzilla – Bug 585213
Patch to wrap GValueArray
Last modified: 2009-06-22 22:25:43 UTC
Some classes/plug-ins in gstreamermm use GValueArray as return values and parameters to methods so I thought it might be necessary to wrap it. I'm not sure it makes sense, but I'm submitting a patch in case it does. If it is accepted, the new class will be used where necessary in gstreamermm. Thanks.
Created attachment 136186 [details] [review] Patch wrapping GValueArray
The GValueArray API reference, for me: http://library.gnome.org/devel/gobject/unstable/gobject-Value-arrays.html#gobject-Value-arrays.description Where do you want to expose this in the gstreammer API? I wonder if a std::list<Glib::ValueBase> would work, though we have not done that before. + _WRAP_METHOD(const Glib::ValueBase& get_nth(guint index_) const, g_value_array_get_nth, constversion) Glib::ValueBase should generally not be used as a return type. It can be used as an output parameter, with some checks that it is of the correct type.
I was just trying to wrap the decodebin2 plug-in[1]. Its "autoplug-sort" signal[2] works with GValueArray (both parameters and return). [1] http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-decodebin2.html [2] http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-decodebin2.html#GstDecodeBin2-autoplug-sort In Gst::PropertyProbe, I tried using Glib::ArrayHandle<Glib::ValueBase> wrapping one method and it looks like it worked. With the decodebin2 plug-in I thought of using the conversion from GValueArray* to Glib::ArrayHandle<Glib::ValueBase> in Gst::PropertyProbe but I'm not sure what sort of conversion to use going the other way (from the Glib::ArrayHandle<> to a GValueArray*). For now, decodebin2 does not need to be wrapped, but there are other base plug-ins[3] that work with GValueArray also (multifdsink, theoraparse, uridecodebin) so they probably wont be wrapped either. [3] http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/
Created attachment 136751 [details] [review] Patch using an output parameter ValueBase instead of a return for get_nth() Updated patch if GValueArray will be exposed.
Created attachment 136754 [details] [review] make value parameter name of get_nth() consistent with doxygen docs.
Approved, because I can't think of a way to do this with a regular std::list, though I wish I could. Please commmit However, please put a newline between the blocks here, before the _WRAP_METHOD_DOCS_ONLY() lines: + _WRAP_METHOD_DOCS_ONLY(g_value_array_append) + Glib::ValueArray& append(const Glib::ValueBase& value); + _WRAP_METHOD_DOCS_ONLY(g_value_array_prepend) + Glib::ValueArray& prepend(const Glib::ValueBase& value); Please also add a small test case in tests/
Thanks. Committed with changes: 2009-06-22 José Alburquerque <jaalburqu@svn.gnome.org> * configure.ac: * glib/glibmm.h: * glib/src/Makefile_list_of_hg.am_fragment: * glib/src/valuearray.ccg: * glib/src/valuearray.hg: Add Glib::ValueArray. * tests/Makefile.am: * tests/glibmm_valuearray/Makefile.am: * tests/glibmm_valuearray/main.cc: Add test for Glib::ValueArray. * .gitignore: Include valuearray.{h,cc}.