diff --git a/src/gstreamer_pipeline.rs b/src/gstreamer_pipeline.rs index b9dc810..c6f05c2 100644 --- a/src/gstreamer_pipeline.rs +++ b/src/gstreamer_pipeline.rs @@ -30,6 +30,9 @@ impl WebcamPipeline { let convert = ElementFactory::make("videoconvert") .build() .expect("Could not build video convert for GStreamer"); + let rate = ElementFactory::make("videorate") + .build() + .expect("Could not build the video rate element"); let tee = ElementFactory::make("tee") .build() @@ -51,11 +54,10 @@ impl WebcamPipeline { .build() .expect("Could not build videoscale for GStreamer"); - let caps_string = - String::from("video/x-raw,format=RGB,width=640,height=480,max-buffers=1,drop=true"); + let caps_string = "video/x-raw,format=RGB,width=640,height=480,max-buffers=1,drop=true"; // let caps_string = String::from("video/x-raw,format=RGB,max-buffers=1,drop=true"); let appsrc_caps = - gstreamer::Caps::from_str(&caps_string).expect("Couldn't create appsrc caps"); + gstreamer::Caps::from_str(caps_string).expect("Couldn't create appsrc caps"); /* // let sink_frame = ElementFactory::make("appsink") @@ -82,6 +84,7 @@ impl WebcamPipeline { .add_many(&[ &source, &convert, + &rate, &tee, &queue_app, &sink_paintable, @@ -94,7 +97,14 @@ impl WebcamPipeline { source .link(&convert) .expect("Could not link video source to converter"); - convert.link(&tee).expect("Could not link converter to tee"); + + convert.link(&rate) + .expect("Could not link rate to tee"); + + rate.link_filtered( + &tee, + &gstreamer::caps::Caps::from_str("video/x-raw,framerate=15/1").expect("Could not build framerate caps"), + ).expect("Could not link converter to rate"); let tee_src_1 = tee .request_pad_simple("src_%u")