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 756950 - Error raised when calling get_value method
Error raised when calling get_value method
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
unspecified
Other Linux
: Normal normal
: 1.6.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-10-22 08:09 UTC by Alex Băluț
Modified: 2018-11-03 12:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
controlsource: Annotate get_value[_array] as a (method) (1.16 KB, patch)
2015-11-30 22:12 UTC, Thibault Saunier
committed Details | Review

Description Alex Băluț 2015-10-22 08:09:59 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.
Comment 1 Mathieu Duponchelle 2015-10-22 08:19:07 UTC
Full error is :

** (python3:9984): WARNING **: Field get_value: Interface type 2 should have is_pointer set
Traceback (most recent call last):
  • File "plop.py", line 10 in <module>
    print (source.get_value(41))
RuntimeError: unable to get the value

btw
Comment 2 Simon Feltman 2015-11-24 04:30:21 UTC
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
Comment 3 Alex Băluț 2015-11-24 07:14:06 UTC
$ 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):
  • File "<string>", line 1 in <module>
RuntimeError: unable to get the value


Note that even when is_pointer is set, it behaves the same.
Comment 4 Simon Feltman 2015-11-25 08:50:21 UTC
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
Comment 5 Thibault Saunier 2015-11-30 22:12:54 UTC
Created attachment 316560 [details] [review]
controlsource: Annotate get_value[_array] as a (method)

As the names clash with gst_object_get_value[_array]
Comment 6 Thibault Saunier 2015-11-30 22:19:48 UTC
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
Comment 7 Alex Băluț 2015-11-30 23:14:10 UTC
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):
  • File "<string>", line 1 in <module>
RuntimeError: unable to get the value

Comment 8 GStreamer system administrator 2018-11-03 12:30:07 UTC
-- 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.