[gst-devel] Can a controller use a different clock?
Steve Fink
sphink at gmail.com
Fri Jun 1 19:05:55 CEST 2007
On 6/1/07, Edward Hervey <bilboed at gmail.com> wrote:
> The controller doesn't use any clock whatsoever. It's the element
> that requests values for given times. Most (all?) elements that use
> controller ask for values for given timestamps.
That makes sense at a very high level, but I'm confused about the
details. I wonder if you would mind dissecting gstvolume as an
example?
> volume_transform_ip (GstBaseTransform * base, GstBuffer * outbuf)
> {
> GstVolume *this = GST_VOLUME (base);
> GstClockTime timestamp;
>
> timestamp = GST_BUFFER_TIMESTAMP (outbuf);
How does the buffer derive its timestamp? In a pipeline, would that
normally be set from the active clock?
> timestamp =
> gst_segment_to_stream_time (&base->segment, GST_FORMAT_TIME, timestamp);
I think I can ignore this for now.
> gst_object_sync_values (G_OBJECT (this), timestamp);
This is the first time the controller gets involved? Somehow, the
'this' aka 'base' object has a back-pointer to the controller, and can
ask it to compute the appropriate value given the passed-in timestamp?
So let me check if I'm basically following this correctly. Say I
wanted to use a different clock for the controller value lookup, but
only for a specific plugin that I am writing. I could do it by
replacing the line
> timestamp = GST_BUFFER_TIMESTAMP (outbuf);
with one that did something fancy with the buffer and the element to
go find the clock that I care about and look up the current time in
it? Or, nearly equivalently (since I don't understand how buffers get
a time associated with them), leave that line alone but change
> timestamp =
> gst_segment_to_stream_time (&base->segment, GST_FORMAT_TIME, timestamp);
to map the buffer time to the stream time with respect to a different element?
More information about the gstreamer-devel
mailing list