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 678928 - video_event_new_upstream_force_key_unit doesn't accept GST_CLOCK_TIME_NONE
video_event_new_upstream_force_key_unit doesn't accept GST_CLOCK_TIME_NONE
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
1.32.x
Other Linux
: Normal major
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
: 677925 705154 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-06-26 21:13 UTC by Stefano
Modified: 2015-02-07 16:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fix the lexer to not think typedef in macro are identifiers (3.49 KB, patch)
2012-06-29 03:04 UTC, Alban Browaeys
none Details | Review
properly handle signed to unsigned conversion at least for type we know the size (1.68 KB, patch)
2012-06-29 03:05 UTC, Alban Browaeys
none Details | Review
giscanner: special case G_GINT64_CONSTANT and G_GUINT64_CONSTANT + misc (4.66 KB, patch)
2012-07-24 13:18 UTC, Alban Browaeys
committed Details | Review
properly handle signed to unsigned conversion at least for type we know the size (2.94 KB, patch)
2012-07-24 13:20 UTC, Alban Browaeys
committed Details | Review
regression test for "alias" (typedef) in #define (2.20 KB, patch)
2012-07-24 13:39 UTC, Alban Browaeys
committed Details | Review

Description Stefano 2012-06-26 21:13:23 UTC
GstVideo.video_event_new_upstream_force_key_unit doesn't seems to accept  GST_CLOCK_TIME_NONE.



Traceback (most recent call last):
  • File "test.py", line 85 in file_splitter
    GstVideo.video_event_new_upstream_force_key_unit(Gst.CLOCK_TIME_NONE,True,1)
  • File "/usr/lib/python3/dist-packages/gi/types.py", line 43 in function
    return info.invoke(*args, **kwargs)
ValueError: -1 not in range 0 to 4294967295

Comment 1 Tim-Philipp Müller 2012-06-27 14:11:54 UTC
I think this is a problem with gobject-introspection not picking up the right type for GST_CLOCK_TIME_NONE - it thinks it's gint for some reason:

   <constant name="CLOCK_TIME_NONE"
              value="18446744073709551615"
              c:type="GST_CLOCK_TIME_NONE">
      <type name="gint" c:type="gint"/>
    </constant>

Can't seem to override the type via a Type: annotations either.

Moving to gobject-introspection for now:

<tpm> pitti, talking of -1: any idea how I can force g-i to accept #define GST_CLOCK_TIME_NONE ((GstClockTime)-1) as GstClockTime or guint64 type? I can annotate a Value: , which is picked up in the gir file, but it still thinks the type is gint.
<pitti> tpm: you mean the .gir picks up the uint64 type, or the .gir erroneously says it's an int?
<pitti> tpm: no off-hand idea, would need to investigate
<tpm> it picks up the uint64 value that I set with Value:  but still has <type name="gint" c:type="gint"/>
<tpm> alright, thanks
<pitti> that's a bug then indeed

This is a fairly big issue for pygi-based GStreamer-applications, since there are many functions that take a GstClockTime argument where one would typically pass GST_CLOCK_TIME_NONE.
Comment 2 Tim-Philipp Müller 2012-06-27 14:13:19 UTC
I should note that GstClockTime is typedefed to guint64 and GST_TYPE_CLOCK_TIME is typedefed to G_TYPE_UINT64:

http://cgit.freedesktop.org/gstreamer/gstreamer/tree/gst/gstclock.h#n65
http://cgit.freedesktop.org/gstreamer/gstreamer/tree/gst/gstclock.h#n38
Comment 3 Tim-Philipp Müller 2012-06-27 15:42:32 UTC
*** Bug 677925 has been marked as a duplicate of this bug. ***
Comment 4 Alban Browaeys 2012-06-29 03:04:36 UTC
Created attachment 217571 [details] [review]
fix the lexer to not think typedef in macro are identifiers

This let the macro expands to its value as gint64/guint64.

Also
- fix lexer identifier/typdef detection for macro and misc

- do not discard cast
Comment 5 Alban Browaeys 2012-06-29 03:05:40 UTC
Created attachment 217572 [details] [review]
properly handle signed to unsigned conversion at least for type we know the size
Comment 6 Johan (not receiving bugmail) Dahlin 2012-06-29 14:44:35 UTC
Review of attachment 217572 [details] [review]:

There's also missing tests.

::: giscanner/transformer.py
@@ +672,3 @@
+            self._resolve_type_from_ctype(unaliased)
+            if typeval.target_giname and typeval.ctype:
+                    target = self.lookup_giname(typeval.target_giname)

There's 8 spaces here instead of 4.

@@ +674,3 @@
+                    target = self.lookup_giname(typeval.target_giname)
+                    target = self.resolve_aliases(target)
+                    if isinstance (target, ast.Type):

Space before (, you really need to run make check

@@ +685,3 @@
+                value = str(symbol.const_int % 2**16)
+            else:
+            if unaliased == ast.TYPE_UINT64:

Extra ,
Comment 7 Johan (not receiving bugmail) Dahlin 2012-06-29 14:44:41 UTC
Review of attachment 217571 [details] [review]:

This looks quite good, but there needs to be a test for this.
Comment 8 Alban Browaeys 2012-07-24 13:18:54 UTC
Created attachment 219580 [details] [review]
giscanner: special case G_GINT64_CONSTANT and  G_GUINT64_CONSTANT + misc

with testcase and a small fix for to free cast type variable in lexer if of no use.
Comment 9 Alban Browaeys 2012-07-24 13:20:40 UTC
Created attachment 219581 [details] [review]
properly handle signed to unsigned conversion at least for type we know the size

with testcase and indentation , extra comma fixes
Comment 10 Alban Browaeys 2012-07-24 13:39:12 UTC
Created attachment 219582 [details] [review]
regression test for "alias" (typedef) in #define

This test requires the two previous patches. Thus I made it into a different patch.
Comment 11 Tomeu Vizoso 2012-08-03 14:38:26 UTC
Pushed, thanks!
Comment 12 Simon Feltman 2013-07-31 00:29:54 UTC
*** Bug 705154 has been marked as a duplicate of this bug. ***
Comment 13 André Klapper 2015-02-07 16:55:28 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]