Rust PushSrc - How to acquire the pipeline's GstClock?

Hi, new to gstreamer and I’m writing a gst plugin in Rust that receives rtp packets from a network.

I need to set the pts of the buffers I receive when I pass them downstream in the PushSrcImpl::create() function, but I can’t find a function to acquire the pipeline’s clock to get the base time and running time.

How is this usually done ?

From reading the docs I suppose it should also be possible for this element to instanciate a GstClock and provide it to the rest of the pipeline with ElementImpl::set_clock() and ElementImpl::provide_clock(), but I also can’t figure out how to create a new GstClock instance.


[EDIT]

I was able to find a ElementExt::clock() function ( alias = gst_element_get_clock() and alias = get_clock ) but this trait and its methods are in the auto module of the gstreamer crate, and this module is private so I cannot access them.

You’d probably do self.obj().clock() in your code, see e.g. here.

The auto module is re-exported, you can import e.g. gst::prelude::* to get this trait.

1 Like