gstclock and absolute time
Josh Doe
josh at joshdoe.com
Tue Jun 26 05:27:43 PDT 2012
On Tue, Jun 26, 2012 at 6:06 AM, Pazzo Da Legare
<pazzodalegare at gmail.com> wrote:
> Dear all,
>
> How can I convert gst_clock_get_time() value in an absolute time (with
> year, month, day, ....). I'm playing with an rtsp camera, using
> rtspsrc, and I would like to retrieve absolute time (ntp stream time)
> across my pipeline. Is there an easy way to do that?
>
> from element's clock time now (=Tue Jun 26 12:03:34 CEST 2012) I get
> something like:
>
> 6112256969101111
>
> and it contains a bunch of thousands of seconds....
>
> I'm a little bit puzzled.
gst_clock_get_time() will just give you a monotonically increasing
integer. Subtracting the base time from that will give you the stream
time:
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-clocks.html
If you're talking about the ISO 8601 timestamps that indicate the
absolute UTC time, this doesn't appear to be implemented currently:
http://cgit.freedesktop.org/gstreamer/gst-plugins-base/tree/gst-libs/gst/rtsp/gstrtsprange.c#n249
http://tools.ietf.org/html/rfc2326#page-18
A few issues. Not all servers support absolute time ranges. You can
only get an absolute time if you requested the range in the same
format, so rtspsrc would need to be given this information. Or you
could extract a time range from SDP. Either way, you'd need a way to
get the time to the application.
This last part is what I'm interested. For now I'm sending a
GST_TAG_DATE_TIME event to indicate the start time of the stream, so a
buffer absolute time can be calculated from this absolute time and the
stream time. If there's a better way (GstMeta?) then I'd like to hear
it.
-Josh
More information about the gstreamer-devel
mailing list