GNOME Bugzilla – Bug 756950
Error raised when calling get_value method
Last modified: 2018-11-03 12:30:07 UTC
In http://cgit.freedesktop.org/gstreamer/gstreamer/tree/gst/gstcontrolsource.c#n92 there is a method called gst_control_source_get_value: /** * gst_control_source_get_value_and_work_please: * @self: the #GstControlSource object * @timestamp: the time for which the value should be returned * @value: (out): the value * * Gets the value for this #GstControlSource at a given timestamp. * * Returns: %FALSE if the value couldn't be returned, %TRUE otherwise. */ gboolean gst_control_source_get_value_and_work_please (GstControlSource * self, GstClockTime timestamp, gdouble * value) { ... } In Python it ends up in gi.repository.GstController.GstControlSource.get_value. When the method is called, it raises a "RuntimeError: unable to get the value". When creating a duplicate method with the name changed: /** * gst_control_source_get_value_and_work_please: * @self: the #GstControlSource object * @timestamp: the time for which the value should be returned * @value: (out): the value * * Gets the value for this #GstControlSource at a given timestamp. * * Returns: %FALSE if the value couldn't be returned, %TRUE otherwise. */ gboolean gst_control_source_get_value_and_work_please (GstControlSource * self, GstClockTime timestamp, gdouble * value) { return gst_control_source_get_value(self, timestamp, value); } ... it is mapped to Gst.ControlSource.get_value_and_work_please() and this one works, so it seems it's a pygobject binding problem causing get_value to fail.
Full error is : ** (python3:9984): WARNING **: Field get_value: Interface type 2 should have is_pointer set Traceback (most recent call last):
+ Trace 235609
print (source.get_value(41))
btw
Can someone provide simple Python steps to reproduce this? One potential issue I see is when the C APIs are being translated into GI namespaces. gst_object_get_value() will be masked by gst_control_source_get_value(), GstControlSource being a subclass of GstObject. The typelib may be confused... [1] http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html#gst-object-get-value [2] http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstControlSource.html#gst-control-source-get-value
$ python3 -c "import gi; gi.require_version('GstController', '1.0'); from gi.repository import GstController; GstController.InterpolationControlSource().get_value(1111111111)" ** (process:1827): WARNING **: Field get_value: Interface type 2 should have is_pointer set Traceback (most recent call last):
+ Trace 235757
Note that even when is_pointer is set, it behaves the same.
It looks like the get_value field is masking the method [1]. I wonder if gst_control_source_get_value() needs to be marked virtual [2] ? Although it seems to be setup a bit differently than that example (the field is on the object not the class). [1] http://cgit.freedesktop.org/gstreamer/gstreamer/tree/gst/gstcontrolsource.h#n106 [2] https://git.gnome.org/browse/gobject-introspection/tree/tests/scanner/regress.c?h=1.47.1#n3001
Created attachment 316560 [details] [review] controlsource: Annotate get_value[_array] as a (method) As the names clash with gst_object_get_value[_array]
commit 3737466563fcba618e88c3534869429b2e0c839a Author: Thibault Saunier <tsaunier@gnome.org> Date: Mon Nov 30 23:08:50 2015 +0100 controlsource: Annotate get_value[_array] as (method) As the names clash with gst_object_get_value[_array] https://bugzilla.gnome.org/show_bug.cgi?id=756950
By annotating with (method), the generated name changed from get_value to control_source_get_value. This makes gst_control_source_get_value usable. Thanks! I'm reopening the bug because there is another similar clash. This time between the _GstControlSource.get_value field and gst_object_get_value: http://lazka.github.io/pgi-docs/Gst-1.0/classes/Object.html#Gst.Object.get_value (click "source" there to see details) Exactly as before: $ python3 -c "import gi; gi.require_version('GstController', '1.0'); from gi.repository import GstController; GstController.InterpolationControlSource().get_value('propname', 1111111111)" ** (process:15868): WARNING **: Field get_value: Interface type 2 should have is_pointer set Traceback (most recent call last):
+ Trace 235777
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/132.