Issue with dataurisrc and Rust: streaming stopped, reason not-linked (-1)

Philippe Normand phil at base-art.net
Wed Nov 27 18:32:46 UTC 2019


Hi Nazar,

On Wed, 2019-11-27 at 19:55 +0200, Nazar Mokrynskyi wrote:
> Hi folks,
> I'm new to Rust and new to Gstreamer, so this may be a simple
> question, 
> but I'd be really helpful for any directions.
> 
> Essentially I want to turn this:
> 
> > gst-launch-1.0 dataurisrc 
> > uri="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAf
> > FcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==" 
> > ! pngdec ! imagefreeze ! videoconvert ! autovideosink
> Which works fine, into Rust code.
> 
> What I have so far is this:
> 
> > extern crate gstreamer as gst;
> > use gst::prelude::*;
> > 
> > extern crate glib;
> > 
> > fn main() {
> >     gst::init().unwrap();
> > 
> >     let base64_image = 
> > "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJ
> > AAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==";
> > 
> >     let pipeline = gst::Pipeline::new(None);
> > 
> >     let image = gst::ElementFactory::make("dataurisrc",
> > None).unwrap();
> >     let pngdec = gst::ElementFactory::make("pngdec",
> > None).unwrap();
> >     let imagefreeze = gst::ElementFactory::make("imagefreeze", 
> > None).unwrap();
> >     let videoconvert = gst::ElementFactory::make("videoconvert", 
> > None).unwrap();
> >     let autovideosink = gst::ElementFactory::make("autovideosink", 
> > None).unwrap();
> > 
> >     image.set_property_from_str("uri", base64_image);
> >     gst::Element::link_many(&[&image, &pngdec, &imagefreeze, 
> > &videoconvert, &autovideosink]).unwrap();
> > 

The elements need to be in the pipeline before attempting to link them.
So try to move this line before the link_many call:

> >     pipeline.add_many(&[&image, &pngdec, &imagefreeze,
> > &videoconvert, 
> > &autovideosink]).unwrap();
> > 

Philippe

> >     pipeline
> >         .set_state(gst::State::Playing)
> >         .expect("Unable to set the pipeline to the `Playing`
> > state");
> > 
> >     let bus = pipeline.get_bus().unwrap();
> > 
> >     for msg in bus.iter_timed(gst::CLOCK_TIME_NONE) {
> >         use gst::MessageView;
> > 
> >         match msg.view() {
> >             MessageView::Eos(..) => break,
> >             MessageView::Error(err) => {
> >                 println!(
> >                     "Error from {:?}: {} ({:?})",
> >                     err.get_src().map(|s| s.get_path_string()),
> >                     err.get_error(),
> >                     err.get_debug()
> >                 );
> >                 break;
> >             }
> >             _ => (),
> >         }
> >     }
> > 
> >     pipeline
> >         .set_state(gst::State::Null)
> >         .expect("Unable to set the pipeline to the `Null` state");
> > }
> However when I try to run it (with stable version of gstreamer crate)
> I 
> get this:
> > 0:00:00.023632544 20196 0x5632ff4081e0 WARN                
> > basesrc 
> > gstbasesrc.c:3072:gst_base_src_loop:<dataurisrc0> error: Internal
> > data 
> > stream error.
> > 0:00:00.023657375 20196 0x5632ff4081e0 WARN basesrc 
> > gstbasesrc.c:3072:gst_base_src_loop:<dataurisrc0> error: streaming 
> > stopped, reason not-linked (-1)
> > Error from Some(Owned(0x5632ff429c40, 48)): Internal data stream 
> > error. (Some("gstbasesrc.c(3072): gst_base_src_loop (): 
> > /GstPipeline:pipeline0/GstDataURISrc:dataurisrc0:\nstreaming
> > stopped, 
> > reason not-linked (-1)"))
> All pads should always be available, so I'm a bit confused by this.
> Any 
> ideas?
> 



More information about the gstreamer-devel mailing list