After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 585213 - Patch to wrap GValueArray
Patch to wrap GValueArray
Status: RESOLVED FIXED
Product: glibmm
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2009-06-09 04:31 UTC by José Alburquerque
Modified: 2009-06-22 22:25 UTC
See Also:
GNOME target: ---
GNOME version: 2.25/2.26


Attachments
Patch wrapping GValueArray (6.66 KB, patch)
2009-06-09 04:32 UTC, José Alburquerque
none Details | Review
Patch using an output parameter ValueBase instead of a return for get_nth() (7.15 KB, patch)
2009-06-16 17:43 UTC, José Alburquerque
none Details | Review
make value parameter name of get_nth() consistent with doxygen docs. (7.14 KB, patch)
2009-06-16 17:56 UTC, José Alburquerque
committed Details | Review

Description José Alburquerque 2009-06-09 04:31:22 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.
Comment 1 José Alburquerque 2009-06-09 04:32:17 UTC
Created attachment 136186 [details] [review]
Patch wrapping GValueArray
Comment 2 Murray Cumming 2009-06-15 14:34:36 UTC
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.
Comment 3 José Alburquerque 2009-06-15 18:37:23 UTC
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/
Comment 4 José Alburquerque 2009-06-16 17:43:42 UTC
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.
Comment 5 José Alburquerque 2009-06-16 17:56:05 UTC
Created attachment 136754 [details] [review]
make value parameter name of get_nth() consistent with doxygen docs.
Comment 6 Murray Cumming 2009-06-22 13:19:10 UTC
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/



Comment 7 José Alburquerque 2009-06-22 22:25:43 UTC
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}.