[gst-devel] Can a controller use a different clock?

Edward Hervey bilboed at gmail.com
Fri Jun 1 22:32:12 CEST 2007


Hi,

On 6/1/07, Steve Fink <sphink at gmail.com> wrote:
> 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?

  GStreamer 101 : Each buffer has a timestamp. If you don't grasp the
concept of timestamps on buffers, I'd recommend you read the
Application Developer Manual and Plugin Developer Guide.

>
> >   timestamp =
> >       gst_segment_to_stream_time (&base->segment, GST_FORMAT_TIME, timestamp);
>

  This is because stream time is the time realm used for GstController.

> 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?

  Exactly. Because it's the (user using the) controller that decides
which properties are controlled, what key-values are used and which
interpolation to use. And therefore it knows for a given timestamp (1)
what values to set and (2) for what properties.

>
> 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

   You do NOT want to modify the code of a plugin to do what you are
asking. The modification you wish to do should be done as an extra
interpolation mode in GstController. The behaviour of GstController
relies on the elements using it to give it stream time positions.
  Or else you are failing to give some information about what you
really want to achieve. Maybe giving the bigger picture would help.

>
> >   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?
>


-- 
Edward Hervey
Multimedia editing developer / Fluendo S.A.
http://www.pitivi.org/




More information about the gstreamer-devel mailing list