added videorate limit
This commit is contained in:
parent
ee0b8d571c
commit
36e5afeb57
1 changed files with 14 additions and 4 deletions
|
@ -30,6 +30,9 @@ impl WebcamPipeline {
|
||||||
let convert = ElementFactory::make("videoconvert")
|
let convert = ElementFactory::make("videoconvert")
|
||||||
.build()
|
.build()
|
||||||
.expect("Could not build video convert for GStreamer");
|
.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")
|
let tee = ElementFactory::make("tee")
|
||||||
.build()
|
.build()
|
||||||
|
@ -51,11 +54,10 @@ impl WebcamPipeline {
|
||||||
.build()
|
.build()
|
||||||
.expect("Could not build videoscale for GStreamer");
|
.expect("Could not build videoscale for GStreamer");
|
||||||
|
|
||||||
let caps_string =
|
let caps_string = "video/x-raw,format=RGB,width=640,height=480,max-buffers=1,drop=true";
|
||||||
String::from("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 caps_string = String::from("video/x-raw,format=RGB,max-buffers=1,drop=true");
|
||||||
let appsrc_caps =
|
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")
|
// let sink_frame = ElementFactory::make("appsink")
|
||||||
|
@ -82,6 +84,7 @@ impl WebcamPipeline {
|
||||||
.add_many(&[
|
.add_many(&[
|
||||||
&source,
|
&source,
|
||||||
&convert,
|
&convert,
|
||||||
|
&rate,
|
||||||
&tee,
|
&tee,
|
||||||
&queue_app,
|
&queue_app,
|
||||||
&sink_paintable,
|
&sink_paintable,
|
||||||
|
@ -94,7 +97,14 @@ impl WebcamPipeline {
|
||||||
source
|
source
|
||||||
.link(&convert)
|
.link(&convert)
|
||||||
.expect("Could not link video source to converter");
|
.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
|
let tee_src_1 = tee
|
||||||
.request_pad_simple("src_%u")
|
.request_pad_simple("src_%u")
|
||||||
|
|
Loading…
Reference in a new issue