GNOME Bugzilla – Bug 678928
video_event_new_upstream_force_key_unit doesn't accept GST_CLOCK_TIME_NONE
Last modified: 2015-02-07 16:55:28 UTC
GstVideo.video_event_new_upstream_force_key_unit doesn't seems to accept GST_CLOCK_TIME_NONE. Traceback (most recent call last):
+ Trace 230442
GstVideo.video_event_new_upstream_force_key_unit(Gst.CLOCK_TIME_NONE,True,1)
return info.invoke(*args, **kwargs)
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.
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
*** Bug 677925 has been marked as a duplicate of this bug. ***
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
Created attachment 217572 [details] [review] properly handle signed to unsigned conversion at least for type we know the size
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 ,
Review of attachment 217571 [details] [review]: This looks quite good, but there needs to be a test for this.
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.
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
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.
Pushed, thanks!
*** Bug 705154 has been marked as a duplicate of this bug. ***
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]