gstreamer-rs: how to find elements in a pipeline?

Tim-Philipp Müller t.i.m at zen.co.uk
Mon Sep 19 12:42:00 UTC 2022


Hi,

> I am currently using the rust implementation of the gstreamer
> interface (gstreamer-rs) and I am wondering why I can not find a way
> to the get elements in an existing pipeline.
> 
> I am using gstreamer::parse_launch() to start a pipeline from a
> string description because I find it much more clearer to give the
> pipeline in string form compared to use the element creators which
> gstreamer-rs provides.
> 
> In python I could use the pipeline.get_by_name() function but this
> one seems to be missing in gstreamer-rs and pipeline does not seem to
> behave like a Bin in kind of giving access to it's elements.
> 
> Here is an example code which I would expect to be able to use:
> 
> --
> gstreamer::parse_launch("videotestsrc name=test_src !
> autovideosink",true);
> 
> let testsrc = gstreamer::get_by_name("test_src").unwrap;
> --
> 
> But get_by_name is not provided. Is anyone able to give me a hint on
> how to do this?

Try something like:

   let pipeline = gstreamer::parse_launch("...")
      .expect("Error creating pipeline");
      
   let testsrc = pipeline.by_name("test_src").unwrap();
   
Cheers
 Tim



More information about the gstreamer-devel mailing list