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 680237 - QGst::ClockTime is inconvenient to use
QGst::ClockTime is inconvenient to use
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: qt-gstreamer
git master
Other Linux
: Normal normal
: 0.10.3
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks: 680236
 
 
Reported: 2012-07-19 09:33 UTC by Mathias Hasselmann (IRC: tbf)
Modified: 2012-12-18 16:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add convenience constructors for ClockTime (1.30 KB, patch)
2012-07-19 09:33 UTC, Mathias Hasselmann (IRC: tbf)
committed Details | Review

Description Mathias Hasselmann (IRC: tbf) 2012-07-19 09:33:06 UTC
Created attachment 219208 [details] [review]
Add convenience constructors for ClockTime

QGst::ClockTime is inconvenient to use: It always needs some thought to remember the proper scale for turning nanoseconds into milliseconds or similar, and even if you do out of sleep, it's easy to accidentally drop some of the significant zeros.
Comment 1 Tim-Philipp Müller 2012-07-19 10:17:45 UTC
Just on a side note, GStreamer defines GST_SECOND, GST_MSECOND etc. so you can write 5 * GST_SECOND or 5 * GST_MSECOND to get the right amount of nanoseconds (but explicit constructors are nicer of course).
Comment 2 Mathias Hasselmann (IRC: tbf) 2012-07-19 10:30:43 UTC
(In reply to comment #1)
> Just on a side note, GStreamer defines GST_SECOND, GST_MSECOND etc. so you can
> write 5 * GST_SECOND or 5 * GST_MSECOND to get the right amount of nanoseconds
> (but explicit constructors are nicer of course).

QtGStreamer explicitly doesn't include the GStreamer headers to avoid bad interactions between Qt convenience macros (slots, signals, foreach, forever, ...) and GLib related headers.
Comment 3 George Kiagiadakis 2012-08-02 08:32:46 UTC
Review of attachment 219208 [details] [review]:

Looks fine, thanks.
Comment 4 George Kiagiadakis 2012-08-02 08:43:17 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > Just on a side note, GStreamer defines GST_SECOND, GST_MSECOND etc. so you can
> > write 5 * GST_SECOND or 5 * GST_MSECOND to get the right amount of nanoseconds
> > (but explicit constructors are nicer of course).
> 
> QtGStreamer explicitly doesn't include the GStreamer headers to avoid bad
> interactions between Qt convenience macros (slots, signals, foreach, forever,
> ...) and GLib related headers.

Fwiw, the reason that QtGStreamer does not include GStreamer headers in its public headers is not that. The reason is that I don't want applications to be polluted with too many includes that are not necessarily required. This way, you don't have to install the gstreamer, glib and libxml development packages in order to use QtGStreamer and you also don't need to force applications to link to gstreamer and glib. This makes compilation and linking faster and serves as an abstraction layer in the (highly unlikely) case gstreamer and/or glib break ABI without API at some point (only QtGStreamer would require recompilation).

I admit though that having some macros from GStreamer would be convenient.