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 731008 - gst-python: Implement TIME_ARGS helper
gst-python: Implement TIME_ARGS helper
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-python
git master
Other Linux
: Normal normal
: 1.3.90
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-05-30 18:12 UTC by Nicolas Dufresne (ndufresne)
Modified: 2014-09-24 08:28 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Nicolas Dufresne (ndufresne) 2014-05-30 18:12:13 UTC
This helper cannot be translated as it's an expanding C macro. But we could implement it, it should look like

def TIME_ARGS(time):
  if (time == Gst.CLOCK_TIME_NONE):
    return (99, 99, 99, 999999999)
  else:
    return (time / (Gst.SECOND * 60 * 60), time / (Gst.SECOND * 60) % 60, time / Gst.SECOND % 60, time % Gst.SECOND)

And could be used like this:
print ("Allo %s %" + Gst.TIME_FORMAT + "\n") % (("toto",) + Gst.TIME_ARGS(time))

Would that make sense for Python or is there something better ?
Comment 1 Nicolas Dufresne (ndufresne) 2014-05-30 18:28:50 UTC
commit 8542c4b21929b2ed84272deb3ae49a2766c82035
Author: Olivier Crête <olivier.crete@collabora.com>
Date:   Tue Dec 3 17:49:11 2013 -0500

    Gst: Add python version of GST_TIME_ARGS

Though it's used differentlu:

print ("Allo %s" + Gst.TIME_ARGS(time) + "\n") % "toto"

or

print ("Allo %s %s\n" % ("toto", Gst.TIME_ARGS(time)))