mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-19 08:36:27 +00:00
adapt to ObjectExt improvements
This commit is contained in:
parent
d9bda62a47
commit
82be7b3ac5
35 changed files with 381 additions and 673 deletions
|
@ -75,7 +75,7 @@ fn run_test(
|
|||
.downcast::<gst_app::AppSink>()
|
||||
.unwrap();
|
||||
|
||||
sink.set_property("sync", false).unwrap();
|
||||
sink.set_property("sync", false);
|
||||
let caps = gst_audio::AudioInfo::builder(gst_audio::AUDIO_FORMAT_F64, 192_000, channels)
|
||||
.build()
|
||||
.unwrap()
|
||||
|
|
|
@ -89,7 +89,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Box<dyn Error>> {
|
|||
let audio_sink = gst::parse_bin_from_description(AUDIO_SINK, true)?.upcast();
|
||||
|
||||
let csoundfilter = gst::ElementFactory::make("csoundfilter", None)?;
|
||||
csoundfilter.set_property("csd-text", &CSD)?;
|
||||
csoundfilter.set_property("csd-text", &CSD);
|
||||
|
||||
pipeline.add_many(&[&audio_src, &csoundfilter, &audio_sink])?;
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ fn init() {
|
|||
|
||||
fn build_harness(src_caps: gst::Caps, sink_caps: gst::Caps, csd: &str) -> gst_check::Harness {
|
||||
let filter = gst::ElementFactory::make("csoundfilter", None).unwrap();
|
||||
filter.set_property("csd-text", &csd).unwrap();
|
||||
filter.set_property("csd-text", &csd);
|
||||
|
||||
let mut h = gst_check::Harness::with_element(&filter, Some("sink"), Some("src"));
|
||||
|
||||
|
|
|
@ -102,15 +102,11 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||
let typefind = gst::ElementFactory::make("typefind", None).unwrap();
|
||||
let filesink = gst::ElementFactory::make("filesink", None).unwrap();
|
||||
|
||||
filesrc
|
||||
.set_property("location", &input_loc)
|
||||
.expect("Failed to set location property");
|
||||
filesink
|
||||
.set_property("location", &out_loc)
|
||||
.expect("Failed to set location property");
|
||||
filesrc.set_property("location", &input_loc);
|
||||
filesink.set_property("location", &out_loc);
|
||||
|
||||
decrypter.set_property("receiver-key", glib::Bytes::from_owned(receiver.private.0))?;
|
||||
decrypter.set_property("sender-key", glib::Bytes::from_owned(sender.public))?;
|
||||
decrypter.set_property("receiver-key", glib::Bytes::from_owned(receiver.private.0));
|
||||
decrypter.set_property("sender-key", glib::Bytes::from_owned(sender.public));
|
||||
|
||||
let pipeline = gst::Pipeline::new(Some("test-pipeline"));
|
||||
pipeline
|
||||
|
|
|
@ -101,15 +101,11 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||
let encrypter = gst::ElementFactory::make("sodiumencrypter", None).unwrap();
|
||||
let filesink = gst::ElementFactory::make("filesink", None).unwrap();
|
||||
|
||||
filesrc
|
||||
.set_property("location", &input_loc)
|
||||
.expect("Failed to set location property");
|
||||
filesink
|
||||
.set_property("location", &out_loc)
|
||||
.expect("Failed to set location property");
|
||||
filesrc.set_property("location", &input_loc);
|
||||
filesink.set_property("location", &out_loc);
|
||||
|
||||
encrypter.set_property("receiver-key", glib::Bytes::from_owned(receiver.public))?;
|
||||
encrypter.set_property("sender-key", glib::Bytes::from_owned(sender.private.0))?;
|
||||
encrypter.set_property("receiver-key", glib::Bytes::from_owned(receiver.public));
|
||||
encrypter.set_property("sender-key", glib::Bytes::from_owned(sender.private.0));
|
||||
|
||||
let pipeline = gst::Pipeline::new(Some("test-pipeline"));
|
||||
pipeline
|
||||
|
|
|
@ -73,15 +73,11 @@ fn test_pipeline() {
|
|||
};
|
||||
|
||||
let filesrc = gst::ElementFactory::make("filesrc", None).unwrap();
|
||||
filesrc
|
||||
.set_property("location", &input_path.to_str().unwrap())
|
||||
.expect("failed to set property");
|
||||
filesrc.set_property("location", &input_path.to_str().unwrap());
|
||||
|
||||
let dec = gst::ElementFactory::make("sodiumdecrypter", None).unwrap();
|
||||
dec.set_property("sender-key", &*SENDER_PUBLIC)
|
||||
.expect("failed to set property");
|
||||
dec.set_property("receiver-key", &*RECEIVER_PRIVATE)
|
||||
.expect("failed to set property");
|
||||
dec.set_property("sender-key", &*SENDER_PUBLIC);
|
||||
dec.set_property("receiver-key", &*RECEIVER_PRIVATE);
|
||||
|
||||
// the typefind element here is cause the decrypter only supports
|
||||
// operating in pull mode bu the filesink wants push-mode.
|
||||
|
@ -165,15 +161,11 @@ fn test_pull_range() {
|
|||
};
|
||||
|
||||
let filesrc = gst::ElementFactory::make("filesrc", None).unwrap();
|
||||
filesrc
|
||||
.set_property("location", input_path.to_str().unwrap())
|
||||
.expect("failed to set property");
|
||||
filesrc.set_property("location", input_path.to_str().unwrap());
|
||||
|
||||
let dec = gst::ElementFactory::make("sodiumdecrypter", None).unwrap();
|
||||
dec.set_property("sender-key", &*SENDER_PUBLIC)
|
||||
.expect("failed to set property");
|
||||
dec.set_property("receiver-key", &*RECEIVER_PRIVATE)
|
||||
.expect("failed to set property");
|
||||
dec.set_property("sender-key", &*SENDER_PUBLIC);
|
||||
dec.set_property("receiver-key", &*RECEIVER_PRIVATE);
|
||||
|
||||
pipeline
|
||||
.add_many(&[&filesrc, &dec])
|
||||
|
@ -284,34 +276,28 @@ fn test_state_changes() {
|
|||
|
||||
// Set only receiver key
|
||||
let dec = gst::ElementFactory::make("sodiumdecrypter", None).unwrap();
|
||||
dec.set_property("receiver-key", &*RECEIVER_PRIVATE)
|
||||
.expect("failed to set property");
|
||||
dec.set_property("receiver-key", &*RECEIVER_PRIVATE);
|
||||
assert!(dec.change_state(gst::StateChange::NullToReady).is_err());
|
||||
|
||||
// Set only sender key
|
||||
let dec = gst::ElementFactory::make("sodiumdecrypter", None).unwrap();
|
||||
dec.set_property("sender-key", &*SENDER_PUBLIC)
|
||||
.expect("failed to set property");
|
||||
dec.set_property("sender-key", &*SENDER_PUBLIC);
|
||||
assert!(dec.change_state(gst::StateChange::NullToReady).is_err());
|
||||
}
|
||||
|
||||
// NullToReady, no nonce provided
|
||||
{
|
||||
let dec = gst::ElementFactory::make("sodiumdecrypter", None).unwrap();
|
||||
dec.set_property("sender-key", &*SENDER_PUBLIC)
|
||||
.expect("failed to set property");
|
||||
dec.set_property("receiver-key", &*RECEIVER_PRIVATE)
|
||||
.expect("failed to set property");
|
||||
dec.set_property("sender-key", &*SENDER_PUBLIC);
|
||||
dec.set_property("receiver-key", &*RECEIVER_PRIVATE);
|
||||
assert!(dec.change_state(gst::StateChange::NullToReady).is_ok());
|
||||
}
|
||||
|
||||
// ReadyToNull
|
||||
{
|
||||
let dec = gst::ElementFactory::make("sodiumdecrypter", None).unwrap();
|
||||
dec.set_property("sender-key", &*SENDER_PUBLIC)
|
||||
.expect("failed to set property");
|
||||
dec.set_property("receiver-key", &*RECEIVER_PRIVATE)
|
||||
.expect("failed to set property");
|
||||
dec.set_property("sender-key", &*SENDER_PUBLIC);
|
||||
dec.set_property("receiver-key", &*RECEIVER_PRIVATE);
|
||||
assert!(dec.change_state(gst::StateChange::NullToReady).is_ok());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,12 +74,9 @@ fn encrypt_file() {
|
|||
let mut adapter = gst_base::UniqueAdapter::new();
|
||||
|
||||
let enc = gst::ElementFactory::make("sodiumencrypter", None).unwrap();
|
||||
enc.set_property("sender-key", &*SENDER_PRIVATE)
|
||||
.expect("failed to set property");
|
||||
enc.set_property("receiver-key", &*RECEIVER_PUBLIC)
|
||||
.expect("failed to set property");
|
||||
enc.set_property("block-size", 1024u32)
|
||||
.expect("failed to set property");
|
||||
enc.set_property("sender-key", &*SENDER_PRIVATE);
|
||||
enc.set_property("receiver-key", &*RECEIVER_PUBLIC);
|
||||
enc.set_property("block-size", 1024u32);
|
||||
|
||||
let mut h = gst_check::Harness::with_element(&enc, None, None);
|
||||
h.add_element_src_pad(&enc.static_pad("src").expect("failed to get src pad"));
|
||||
|
@ -117,34 +114,28 @@ fn test_state_changes() {
|
|||
|
||||
// Set only receiver key
|
||||
let enc = gst::ElementFactory::make("sodiumencrypter", None).unwrap();
|
||||
enc.set_property("receiver-key", &*RECEIVER_PUBLIC)
|
||||
.expect("failed to set property");
|
||||
enc.set_property("receiver-key", &*RECEIVER_PUBLIC);
|
||||
assert!(enc.change_state(gst::StateChange::NullToReady).is_err());
|
||||
|
||||
// Set only sender key
|
||||
let enc = gst::ElementFactory::make("sodiumencrypter", None).unwrap();
|
||||
enc.set_property("sender-key", &*SENDER_PRIVATE)
|
||||
.expect("failed to set property");
|
||||
enc.set_property("sender-key", &*SENDER_PRIVATE);
|
||||
assert!(enc.change_state(gst::StateChange::NullToReady).is_err());
|
||||
}
|
||||
|
||||
// NullToReady
|
||||
{
|
||||
let enc = gst::ElementFactory::make("sodiumencrypter", None).unwrap();
|
||||
enc.set_property("sender-key", &*SENDER_PRIVATE)
|
||||
.expect("failed to set property");
|
||||
enc.set_property("receiver-key", &*RECEIVER_PUBLIC)
|
||||
.expect("failed to set property");
|
||||
enc.set_property("sender-key", &*SENDER_PRIVATE);
|
||||
enc.set_property("receiver-key", &*RECEIVER_PUBLIC);
|
||||
assert!(enc.change_state(gst::StateChange::NullToReady).is_ok());
|
||||
}
|
||||
|
||||
// ReadyToNull
|
||||
{
|
||||
let enc = gst::ElementFactory::make("sodiumencrypter", None).unwrap();
|
||||
enc.set_property("sender-key", &*SENDER_PRIVATE)
|
||||
.expect("failed to set property");
|
||||
enc.set_property("receiver-key", &*RECEIVER_PUBLIC)
|
||||
.expect("failed to set property");
|
||||
enc.set_property("sender-key", &*SENDER_PRIVATE);
|
||||
enc.set_property("receiver-key", &*RECEIVER_PUBLIC);
|
||||
assert!(enc.change_state(gst::StateChange::NullToReady).is_ok());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,8 +66,8 @@ fn main() {
|
|||
for i in 0..n_streams {
|
||||
let sink =
|
||||
gst::ElementFactory::make("fakesink", Some(format!("sink-{}", i).as_str())).unwrap();
|
||||
sink.set_property("sync", false).unwrap();
|
||||
sink.set_property("async", false).unwrap();
|
||||
sink.set_property("sync", false);
|
||||
sink.set_property("async", false);
|
||||
|
||||
let counter_clone = Arc::clone(&counter);
|
||||
sink.static_pad("sink").unwrap().add_probe(
|
||||
|
@ -83,10 +83,8 @@ fn main() {
|
|||
let source =
|
||||
gst::ElementFactory::make("udpsrc", Some(format!("source-{}", i).as_str()))
|
||||
.unwrap();
|
||||
source.set_property("port", 40000i32 + i as i32).unwrap();
|
||||
source
|
||||
.set_property("retrieve-sender-address", false)
|
||||
.unwrap();
|
||||
source.set_property("port", 40000i32 + i as i32);
|
||||
source.set_property("retrieve-sender-address", false);
|
||||
|
||||
source
|
||||
}
|
||||
|
@ -94,11 +92,9 @@ fn main() {
|
|||
let source =
|
||||
gst::ElementFactory::make("ts-udpsrc", Some(format!("source-{}", i).as_str()))
|
||||
.unwrap();
|
||||
source.set_property("port", 40000i32 + i as i32).unwrap();
|
||||
source
|
||||
.set_property("context", format!("context-{}", (i as u32) % n_groups))
|
||||
.unwrap();
|
||||
source.set_property("context-wait", wait).unwrap();
|
||||
source.set_property("port", 40000i32 + i as i32);
|
||||
source.set_property("context", format!("context-{}", (i as u32) % n_groups));
|
||||
source.set_property("context-wait", wait);
|
||||
|
||||
source
|
||||
}
|
||||
|
@ -108,8 +104,8 @@ fn main() {
|
|||
Some(format!("source-{}", i).as_str()),
|
||||
)
|
||||
.unwrap();
|
||||
source.set_property("host", "127.0.0.1").unwrap();
|
||||
source.set_property("port", 40000i32).unwrap();
|
||||
source.set_property("host", "127.0.0.1");
|
||||
source.set_property("port", 40000i32);
|
||||
|
||||
source
|
||||
}
|
||||
|
@ -119,12 +115,10 @@ fn main() {
|
|||
Some(format!("source-{}", i).as_str()),
|
||||
)
|
||||
.unwrap();
|
||||
source.set_property("host", "127.0.0.1").unwrap();
|
||||
source.set_property("port", 40000i32).unwrap();
|
||||
source
|
||||
.set_property("context", format!("context-{}", (i as u32) % n_groups))
|
||||
.unwrap();
|
||||
source.set_property("context-wait", wait).unwrap();
|
||||
source.set_property("host", "127.0.0.1");
|
||||
source.set_property("port", 40000i32);
|
||||
source.set_property("context", format!("context-{}", (i as u32) % n_groups));
|
||||
source.set_property("context-wait", wait);
|
||||
|
||||
source
|
||||
}
|
||||
|
@ -134,11 +128,9 @@ fn main() {
|
|||
Some(format!("source-{}", i).as_str()),
|
||||
)
|
||||
.unwrap();
|
||||
source
|
||||
.set_property("samplesperbuffer", (wait as i32) * 8000 / 1000)
|
||||
.unwrap();
|
||||
source.set_property("samplesperbuffer", (wait as i32) * 8000 / 1000);
|
||||
|
||||
sink.set_property("sync", true).unwrap();
|
||||
sink.set_property("sync", true);
|
||||
|
||||
source
|
||||
}
|
||||
|
@ -146,13 +138,9 @@ fn main() {
|
|||
let source =
|
||||
gst::ElementFactory::make("ts-tonesrc", Some(format!("source-{}", i).as_str()))
|
||||
.unwrap();
|
||||
source
|
||||
.set_property("samples-per-buffer", (wait as u32) * 8000 / 1000)
|
||||
.unwrap();
|
||||
source
|
||||
.set_property("context", format!("context-{}", (i as u32) % n_groups))
|
||||
.unwrap();
|
||||
source.set_property("context-wait", wait).unwrap();
|
||||
source.set_property("samples-per-buffer", (wait as u32) * 8000 / 1000);
|
||||
source.set_property("context", format!("context-{}", (i as u32) % n_groups));
|
||||
source.set_property("context-wait", wait);
|
||||
|
||||
source
|
||||
}
|
||||
|
|
|
@ -369,7 +369,7 @@ impl SinkHandler {
|
|||
if state.clock_rate.is_none() {
|
||||
drop(state);
|
||||
let caps = element
|
||||
.emit_by_name("request-pt-map", &[&(pt as u32)])
|
||||
.try_emit_by_name("request-pt-map", &[&(pt as u32)])
|
||||
.map_err(|_| gst::FlowError::Error)?
|
||||
.ok_or(gst::FlowError::Error)?
|
||||
.get::<Option<gst::Caps>>()
|
||||
|
|
|
@ -36,9 +36,9 @@ fn push() {
|
|||
let caps = gst::Caps::builder("foo/bar").build();
|
||||
{
|
||||
let appsrc = h.element().unwrap();
|
||||
appsrc.set_property("caps", &caps).unwrap();
|
||||
appsrc.set_property("do-timestamp", true).unwrap();
|
||||
appsrc.set_property("context", "appsrc-push").unwrap();
|
||||
appsrc.set_property("caps", &caps);
|
||||
appsrc.set_property("do-timestamp", true);
|
||||
appsrc.set_property("context", "appsrc-push");
|
||||
}
|
||||
|
||||
h.play();
|
||||
|
@ -49,7 +49,6 @@ fn push() {
|
|||
assert!(appsrc
|
||||
.emit_by_name("push-buffer", &[&gst::Buffer::new()])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap());
|
||||
}
|
||||
|
@ -57,7 +56,6 @@ fn push() {
|
|||
assert!(appsrc
|
||||
.emit_by_name("end-of-stream", &[])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap());
|
||||
}
|
||||
|
@ -102,9 +100,9 @@ fn pause_regular() {
|
|||
let caps = gst::Caps::builder("foo/bar").build();
|
||||
{
|
||||
let appsrc = h.element().unwrap();
|
||||
appsrc.set_property("caps", &caps).unwrap();
|
||||
appsrc.set_property("do-timestamp", true).unwrap();
|
||||
appsrc.set_property("context", "appsrc-pause").unwrap();
|
||||
appsrc.set_property("caps", &caps);
|
||||
appsrc.set_property("do-timestamp", true);
|
||||
appsrc.set_property("context", "appsrc-pause");
|
||||
}
|
||||
|
||||
h.play();
|
||||
|
@ -115,7 +113,6 @@ fn pause_regular() {
|
|||
assert!(appsrc
|
||||
.emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![1, 2, 3, 4])])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap());
|
||||
|
||||
|
@ -125,7 +122,6 @@ fn pause_regular() {
|
|||
assert!(appsrc
|
||||
.emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![5, 6, 7])])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap());
|
||||
|
||||
|
@ -137,7 +133,6 @@ fn pause_regular() {
|
|||
assert!(appsrc
|
||||
.emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![8, 9])])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap());
|
||||
|
||||
|
@ -155,7 +150,6 @@ fn pause_regular() {
|
|||
assert!(appsrc
|
||||
.emit_by_name("push-buffer", &[&gst::Buffer::new()])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap());
|
||||
|
||||
|
@ -172,9 +166,9 @@ fn flush_regular() {
|
|||
let caps = gst::Caps::builder("foo/bar").build();
|
||||
{
|
||||
let appsrc = h.element().unwrap();
|
||||
appsrc.set_property("caps", &caps).unwrap();
|
||||
appsrc.set_property("do-timestamp", true).unwrap();
|
||||
appsrc.set_property("context", "appsrc-flush").unwrap();
|
||||
appsrc.set_property("caps", &caps);
|
||||
appsrc.set_property("do-timestamp", true);
|
||||
appsrc.set_property("context", "appsrc-flush");
|
||||
}
|
||||
|
||||
h.play();
|
||||
|
@ -185,7 +179,6 @@ fn flush_regular() {
|
|||
assert!(appsrc
|
||||
.emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![1, 2, 3, 4])])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap());
|
||||
|
||||
|
@ -198,7 +191,6 @@ fn flush_regular() {
|
|||
assert!(!appsrc
|
||||
.emit_by_name("push-buffer", &[&gst::Buffer::new()])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap());
|
||||
|
||||
|
@ -214,7 +206,6 @@ fn flush_regular() {
|
|||
assert!(appsrc
|
||||
.emit_by_name("push-buffer", &[&gst::Buffer::new()])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap());
|
||||
|
||||
|
@ -231,11 +222,9 @@ fn pause_flush() {
|
|||
let caps = gst::Caps::builder("foo/bar").build();
|
||||
{
|
||||
let appsrc = h.element().unwrap();
|
||||
appsrc.set_property("caps", &caps).unwrap();
|
||||
appsrc.set_property("do-timestamp", true).unwrap();
|
||||
appsrc
|
||||
.set_property("context", "appsrc-pause_flush")
|
||||
.unwrap();
|
||||
appsrc.set_property("caps", &caps);
|
||||
appsrc.set_property("do-timestamp", true);
|
||||
appsrc.set_property("context", "appsrc-pause_flush");
|
||||
}
|
||||
|
||||
h.play();
|
||||
|
@ -246,7 +235,6 @@ fn pause_flush() {
|
|||
assert!(appsrc
|
||||
.emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![1, 2, 3, 4])])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap());
|
||||
|
||||
|
@ -263,7 +251,6 @@ fn pause_flush() {
|
|||
assert!(!appsrc
|
||||
.emit_by_name("push-buffer", &[&gst::Buffer::new()])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap());
|
||||
|
||||
|
@ -283,7 +270,6 @@ fn pause_flush() {
|
|||
assert!(appsrc
|
||||
.emit_by_name("push-buffer", &[&gst::Buffer::new()])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap());
|
||||
|
||||
|
|
|
@ -36,20 +36,11 @@ fn test_active_pad() {
|
|||
let mut h1 = gst_check::Harness::with_element(&is, Some("sink_%u"), Some("src"));
|
||||
let mut h2 = gst_check::Harness::with_element(&is, Some("sink_%u"), None);
|
||||
|
||||
let active_pad = is
|
||||
.property("active-pad")
|
||||
.unwrap()
|
||||
.get::<Option<gst::Pad>>()
|
||||
.unwrap();
|
||||
let active_pad = is.property::<Option<gst::Pad>>("active-pad");
|
||||
assert_eq!(active_pad, h1.srcpad().unwrap().peer());
|
||||
|
||||
is.set_property("active-pad", h2.srcpad().unwrap().peer())
|
||||
.unwrap();
|
||||
let active_pad = is
|
||||
.property("active-pad")
|
||||
.unwrap()
|
||||
.get::<Option<gst::Pad>>()
|
||||
.unwrap();
|
||||
is.set_property("active-pad", h2.srcpad().unwrap().peer());
|
||||
let active_pad = is.property::<Option<gst::Pad>>("active-pad");
|
||||
assert_eq!(active_pad, h2.srcpad().unwrap().peer());
|
||||
|
||||
h1.set_src_caps_str("foo/bar");
|
||||
|
@ -85,8 +76,7 @@ fn test_active_pad() {
|
|||
/* Switch the active pad and push a buffer, we should receive stream-start, segment and caps
|
||||
* again */
|
||||
let buf = gst::Buffer::new();
|
||||
is.set_property("active-pad", h1.srcpad().unwrap().peer())
|
||||
.unwrap();
|
||||
is.set_property("active-pad", h1.srcpad().unwrap().peer());
|
||||
assert_eq!(h1.push(buf), Ok(gst::FlowSuccess::Ok));
|
||||
assert_eq!(h1.buffers_received(), 3);
|
||||
assert_eq!(h1.events_received(), 6);
|
||||
|
|
|
@ -51,24 +51,24 @@ fn jb_pipeline() {
|
|||
let pipeline = gst::Pipeline::new(None);
|
||||
|
||||
let src = gst::ElementFactory::make("audiotestsrc", Some("audiotestsrc")).unwrap();
|
||||
src.set_property("is-live", true).unwrap();
|
||||
src.set_property("num-buffers", BUFFER_NB).unwrap();
|
||||
src.set_property("is-live", true);
|
||||
src.set_property("num-buffers", BUFFER_NB);
|
||||
|
||||
let enc = gst::ElementFactory::make("alawenc", Some("alawenc")).unwrap();
|
||||
let pay = gst::ElementFactory::make("rtppcmapay", Some("rtppcmapay")).unwrap();
|
||||
|
||||
let jb = gst::ElementFactory::make("ts-jitterbuffer", Some("ts-jitterbuffer")).unwrap();
|
||||
jb.set_property("context", "jb_pipeline").unwrap();
|
||||
jb.set_property("context-wait", CONTEXT_WAIT).unwrap();
|
||||
jb.set_property("latency", LATENCY).unwrap();
|
||||
jb.set_property("context", "jb_pipeline");
|
||||
jb.set_property("context-wait", CONTEXT_WAIT);
|
||||
jb.set_property("latency", LATENCY);
|
||||
|
||||
let depay = gst::ElementFactory::make("rtppcmadepay", Some("rtppcmadepay")).unwrap();
|
||||
let dec = gst::ElementFactory::make("alawdec", Some("alawdec")).unwrap();
|
||||
|
||||
let sink = gst::ElementFactory::make("appsink", Some("appsink")).unwrap();
|
||||
sink.set_property("sync", false).unwrap();
|
||||
sink.set_property("async", false).unwrap();
|
||||
sink.set_property("emit-signals", true).unwrap();
|
||||
sink.set_property("sync", false);
|
||||
sink.set_property("async", false);
|
||||
sink.set_property("emit-signals", true);
|
||||
|
||||
pipeline
|
||||
.add_many(&[&src, &enc, &pay, &jb, &depay, &dec, &sink])
|
||||
|
@ -83,7 +83,6 @@ fn jb_pipeline() {
|
|||
let _sample = appsink
|
||||
.emit_by_name("pull-sample", &[])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<gst::Sample>()
|
||||
.unwrap();
|
||||
|
||||
|
@ -115,30 +114,28 @@ fn jb_ts_pipeline() {
|
|||
let pipeline = gst::Pipeline::new(None);
|
||||
|
||||
let src = gst::ElementFactory::make("audiotestsrc", Some("audiotestsrc")).unwrap();
|
||||
src.set_property("is-live", true).unwrap();
|
||||
src.set_property("num-buffers", BUFFER_NB).unwrap();
|
||||
src.set_property("is-live", true);
|
||||
src.set_property("num-buffers", BUFFER_NB);
|
||||
|
||||
let queue = gst::ElementFactory::make("ts-queue", Some("ts-queue")).unwrap();
|
||||
queue
|
||||
.set_property("context", "jb_ts_pipeline_queue")
|
||||
.unwrap();
|
||||
queue.set_property("context-wait", CONTEXT_WAIT).unwrap();
|
||||
queue.set_property("context", "jb_ts_pipeline_queue");
|
||||
queue.set_property("context-wait", CONTEXT_WAIT);
|
||||
|
||||
let enc = gst::ElementFactory::make("alawenc", Some("alawenc")).unwrap();
|
||||
let pay = gst::ElementFactory::make("rtppcmapay", Some("rtppcmapay")).unwrap();
|
||||
|
||||
let jb = gst::ElementFactory::make("ts-jitterbuffer", Some("ts-jitterbuffer")).unwrap();
|
||||
jb.set_property("context", "jb_ts_pipeline").unwrap();
|
||||
jb.set_property("context-wait", CONTEXT_WAIT).unwrap();
|
||||
jb.set_property("latency", LATENCY).unwrap();
|
||||
jb.set_property("context", "jb_ts_pipeline");
|
||||
jb.set_property("context-wait", CONTEXT_WAIT);
|
||||
jb.set_property("latency", LATENCY);
|
||||
|
||||
let depay = gst::ElementFactory::make("rtppcmadepay", Some("rtppcmadepay")).unwrap();
|
||||
let dec = gst::ElementFactory::make("alawdec", Some("alawdec")).unwrap();
|
||||
|
||||
let sink = gst::ElementFactory::make("appsink", Some("appsink")).unwrap();
|
||||
sink.set_property("sync", false).unwrap();
|
||||
sink.set_property("async", false).unwrap();
|
||||
sink.set_property("emit-signals", true).unwrap();
|
||||
sink.set_property("sync", false);
|
||||
sink.set_property("async", false);
|
||||
sink.set_property("emit-signals", true);
|
||||
|
||||
pipeline
|
||||
.add_many(&[&src, &queue, &enc, &pay, &jb, &depay, &dec, &sink])
|
||||
|
@ -153,7 +150,6 @@ fn jb_ts_pipeline() {
|
|||
let _sample = appsink
|
||||
.emit_by_name("pull-sample", &[])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<gst::Sample>()
|
||||
.unwrap();
|
||||
|
||||
|
|
|
@ -772,7 +772,7 @@ fn setup(
|
|||
|
||||
// Src
|
||||
let src_element = glib::Object::new::<ElementSrcTest>(&[]).unwrap();
|
||||
src_element.set_property("context", &context_name).unwrap();
|
||||
src_element.set_property("context", &context_name);
|
||||
pipeline.add(&src_element).unwrap();
|
||||
|
||||
let mut last_element = src_element.clone().upcast::<gst::Element>();
|
||||
|
@ -969,12 +969,8 @@ fn src_tsqueue_sink_nominal() {
|
|||
let name = "src_tsqueue_sink";
|
||||
|
||||
let ts_queue = gst::ElementFactory::make("ts-queue", Some("ts-queue")).unwrap();
|
||||
ts_queue
|
||||
.set_property("context", format!("{}_queue", name))
|
||||
.unwrap();
|
||||
ts_queue
|
||||
.set_property("context-wait", THROTTLING_DURATION.as_millis() as u32)
|
||||
.unwrap();
|
||||
ts_queue.set_property("context", format!("{}_queue", name));
|
||||
ts_queue.set_property("context-wait", THROTTLING_DURATION.as_millis() as u32);
|
||||
|
||||
let (pipeline, src_element, _sink_element, receiver) = setup(name, Some(ts_queue), None);
|
||||
|
||||
|
@ -1000,20 +996,12 @@ fn src_tsproxy_sink_nominal() {
|
|||
let name = "src_tsproxy_sink";
|
||||
|
||||
let ts_proxy_sink = gst::ElementFactory::make("ts-proxysink", Some("ts-proxysink")).unwrap();
|
||||
ts_proxy_sink
|
||||
.set_property("proxy-context", format!("{}_proxy_context", name))
|
||||
.unwrap();
|
||||
ts_proxy_sink.set_property("proxy-context", format!("{}_proxy_context", name));
|
||||
|
||||
let ts_proxy_src = gst::ElementFactory::make("ts-proxysrc", Some("ts-proxysrc")).unwrap();
|
||||
ts_proxy_src
|
||||
.set_property("proxy-context", format!("{}_proxy_context", name))
|
||||
.unwrap();
|
||||
ts_proxy_src
|
||||
.set_property("context", format!("{}_context", name))
|
||||
.unwrap();
|
||||
ts_proxy_src
|
||||
.set_property("context-wait", THROTTLING_DURATION.as_millis() as u32)
|
||||
.unwrap();
|
||||
ts_proxy_src.set_property("proxy-context", format!("{}_proxy_context", name));
|
||||
ts_proxy_src.set_property("context", format!("{}_context", name));
|
||||
ts_proxy_src.set_property("context-wait", THROTTLING_DURATION.as_millis() as u32);
|
||||
|
||||
let (pipeline, src_element, _sink_element, receiver) =
|
||||
setup(name, Some(ts_proxy_sink), Some(ts_proxy_src));
|
||||
|
|
|
@ -63,23 +63,20 @@ fn multiple_contexts_queue() {
|
|||
for i in 0..SRC_NB {
|
||||
let src =
|
||||
gst::ElementFactory::make("ts-udpsrc", Some(format!("src-{}", i).as_str())).unwrap();
|
||||
src.set_property("context", format!("context-{}", (i as u32) % CONTEXT_NB))
|
||||
.unwrap();
|
||||
src.set_property("context-wait", CONTEXT_WAIT).unwrap();
|
||||
src.set_property("port", (FIRST_PORT + i) as i32).unwrap();
|
||||
src.set_property("context", format!("context-{}", (i as u32) % CONTEXT_NB));
|
||||
src.set_property("context-wait", CONTEXT_WAIT);
|
||||
src.set_property("port", (FIRST_PORT + i) as i32);
|
||||
|
||||
let queue =
|
||||
gst::ElementFactory::make("ts-queue", Some(format!("queue-{}", i).as_str())).unwrap();
|
||||
queue
|
||||
.set_property("context", format!("context-{}", (i as u32) % CONTEXT_NB))
|
||||
.unwrap();
|
||||
queue.set_property("context-wait", CONTEXT_WAIT).unwrap();
|
||||
queue.set_property("context", format!("context-{}", (i as u32) % CONTEXT_NB));
|
||||
queue.set_property("context-wait", CONTEXT_WAIT);
|
||||
|
||||
let sink =
|
||||
gst::ElementFactory::make("appsink", Some(format!("sink-{}", i).as_str())).unwrap();
|
||||
sink.set_property("sync", false).unwrap();
|
||||
sink.set_property("async", false).unwrap();
|
||||
sink.set_property("emit-signals", true).unwrap();
|
||||
sink.set_property("sync", false);
|
||||
sink.set_property("async", false);
|
||||
sink.set_property("emit-signals", true);
|
||||
|
||||
pipeline.add_many(&[&src, &queue, &sink]).unwrap();
|
||||
gst::Element::link_many(&[&src, &queue, &sink]).unwrap();
|
||||
|
@ -92,7 +89,6 @@ fn multiple_contexts_queue() {
|
|||
let _sample = appsink
|
||||
.emit_by_name("pull-sample", &[])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<gst::Sample>()
|
||||
.unwrap();
|
||||
|
||||
|
@ -204,40 +200,33 @@ fn multiple_contexts_proxy() {
|
|||
Some(format!("src-{}", pipeline_index).as_str()),
|
||||
)
|
||||
.unwrap();
|
||||
src.set_property("context", format!("context-{}", (i as u32) % CONTEXT_NB))
|
||||
.unwrap();
|
||||
src.set_property("context-wait", CONTEXT_WAIT).unwrap();
|
||||
src.set_property("port", (FIRST_PORT + i) as i32).unwrap();
|
||||
src.set_property("context", format!("context-{}", (i as u32) % CONTEXT_NB));
|
||||
src.set_property("context-wait", CONTEXT_WAIT);
|
||||
src.set_property("port", (FIRST_PORT + i) as i32);
|
||||
|
||||
let proxysink = gst::ElementFactory::make(
|
||||
"ts-proxysink",
|
||||
Some(format!("proxysink-{}", pipeline_index).as_str()),
|
||||
)
|
||||
.unwrap();
|
||||
proxysink
|
||||
.set_property("proxy-context", format!("proxy-{}", pipeline_index))
|
||||
.unwrap();
|
||||
proxysink.set_property("proxy-context", format!("proxy-{}", pipeline_index));
|
||||
let proxysrc = gst::ElementFactory::make(
|
||||
"ts-proxysrc",
|
||||
Some(format!("proxysrc-{}", pipeline_index).as_str()),
|
||||
)
|
||||
.unwrap();
|
||||
proxysrc
|
||||
.set_property(
|
||||
proxysrc.set_property(
|
||||
"context",
|
||||
&format!("context-{}", (pipeline_index as u32) % CONTEXT_NB),
|
||||
)
|
||||
.unwrap();
|
||||
proxysrc
|
||||
.set_property("proxy-context", format!("proxy-{}", pipeline_index))
|
||||
.unwrap();
|
||||
);
|
||||
proxysrc.set_property("proxy-context", format!("proxy-{}", pipeline_index));
|
||||
|
||||
let sink =
|
||||
gst::ElementFactory::make("appsink", Some(format!("sink-{}", pipeline_index).as_str()))
|
||||
.unwrap();
|
||||
sink.set_property("sync", false).unwrap();
|
||||
sink.set_property("async", false).unwrap();
|
||||
sink.set_property("emit-signals", true).unwrap();
|
||||
sink.set_property("sync", false);
|
||||
sink.set_property("async", false);
|
||||
sink.set_property("emit-signals", true);
|
||||
|
||||
pipeline
|
||||
.add_many(&[&src, &proxysink, &proxysrc, &sink])
|
||||
|
@ -253,7 +242,6 @@ fn multiple_contexts_proxy() {
|
|||
let _sample = appsink
|
||||
.emit_by_name("pull-sample", &[])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<gst::Sample>()
|
||||
.unwrap();
|
||||
|
||||
|
@ -349,22 +337,22 @@ fn eos() {
|
|||
let caps = gst::Caps::builder("foo/bar").build();
|
||||
|
||||
let src = gst::ElementFactory::make("ts-appsrc", Some("src-eos")).unwrap();
|
||||
src.set_property("caps", &caps).unwrap();
|
||||
src.set_property("do-timestamp", true).unwrap();
|
||||
src.set_property("context", &CONTEXT).unwrap();
|
||||
src.set_property("caps", &caps);
|
||||
src.set_property("do-timestamp", true);
|
||||
src.set_property("context", &CONTEXT);
|
||||
|
||||
let queue = gst::ElementFactory::make("ts-queue", Some("queue-eos")).unwrap();
|
||||
queue.set_property("context", &CONTEXT).unwrap();
|
||||
queue.set_property("context", &CONTEXT);
|
||||
|
||||
let appsink = gst::ElementFactory::make("appsink", Some("sink-eos")).unwrap();
|
||||
|
||||
pipeline.add_many(&[&src, &queue, &appsink]).unwrap();
|
||||
gst::Element::link_many(&[&src, &queue, &appsink]).unwrap();
|
||||
|
||||
appsink.set_property("sync", false).unwrap();
|
||||
appsink.set_property("async", false).unwrap();
|
||||
appsink.set_property("sync", false);
|
||||
appsink.set_property("async", false);
|
||||
|
||||
appsink.set_property("emit-signals", true).unwrap();
|
||||
appsink.set_property("emit-signals", true);
|
||||
let (sample_notifier, sample_notif_rcv) = mpsc::channel();
|
||||
let (eos_notifier, eos_notif_rcv) = mpsc::channel();
|
||||
let appsink = appsink.dynamic_cast::<gst_app::AppSink>().unwrap();
|
||||
|
@ -375,7 +363,6 @@ fn eos() {
|
|||
let _ = appsink
|
||||
.emit_by_name("pull-sample", &[])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<gst::Sample>()
|
||||
.unwrap();
|
||||
|
||||
|
@ -390,7 +377,6 @@ fn eos() {
|
|||
fn push_buffer(src: &gst::Element) -> bool {
|
||||
gst_debug!(CAT, obj: src, "eos: pushing buffer");
|
||||
src.emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![0; 1024])])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap()
|
||||
|
@ -407,7 +393,6 @@ fn eos() {
|
|||
assert!(src
|
||||
.emit_by_name("end-of-stream", &[])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap());
|
||||
|
||||
|
@ -487,29 +472,24 @@ fn premature_shutdown() {
|
|||
let caps = gst::Caps::builder("foo/bar").build();
|
||||
|
||||
let src = gst::ElementFactory::make("ts-appsrc", Some("src-ps")).unwrap();
|
||||
src.set_property("caps", &caps).unwrap();
|
||||
src.set_property("do-timestamp", true).unwrap();
|
||||
src.set_property("context", "appsrc-context").unwrap();
|
||||
src.set_property("context-wait", APPSRC_CONTEXT_WAIT)
|
||||
.unwrap();
|
||||
src.set_property("caps", &caps);
|
||||
src.set_property("do-timestamp", true);
|
||||
src.set_property("context", "appsrc-context");
|
||||
src.set_property("context-wait", APPSRC_CONTEXT_WAIT);
|
||||
|
||||
let queue = gst::ElementFactory::make("ts-queue", Some("queue-ps")).unwrap();
|
||||
queue.set_property("context", "queue-context").unwrap();
|
||||
queue
|
||||
.set_property("context-wait", QUEUE_CONTEXT_WAIT)
|
||||
.unwrap();
|
||||
queue
|
||||
.set_property("max-size-buffers", QUEUE_ITEMS_CAPACITY)
|
||||
.unwrap();
|
||||
queue.set_property("context", "queue-context");
|
||||
queue.set_property("context-wait", QUEUE_CONTEXT_WAIT);
|
||||
queue.set_property("max-size-buffers", QUEUE_ITEMS_CAPACITY);
|
||||
|
||||
let appsink = gst::ElementFactory::make("appsink", Some("sink-ps")).unwrap();
|
||||
|
||||
pipeline.add_many(&[&src, &queue, &appsink]).unwrap();
|
||||
gst::Element::link_many(&[&src, &queue, &appsink]).unwrap();
|
||||
|
||||
appsink.set_property("emit-signals", true).unwrap();
|
||||
appsink.set_property("sync", false).unwrap();
|
||||
appsink.set_property("async", false).unwrap();
|
||||
appsink.set_property("emit-signals", true);
|
||||
appsink.set_property("sync", false);
|
||||
appsink.set_property("async", false);
|
||||
|
||||
let (appsink_sender, appsink_receiver) = mpsc::channel();
|
||||
|
||||
|
@ -521,7 +501,6 @@ fn premature_shutdown() {
|
|||
let _sample = appsink
|
||||
.emit_by_name("pull-sample", &[])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<gst::Sample>()
|
||||
.unwrap();
|
||||
|
||||
|
@ -540,7 +519,6 @@ fn premature_shutdown() {
|
|||
intent
|
||||
);
|
||||
src.emit_by_name("push-buffer", &[&gst::Buffer::from_slice(vec![0; 1024])])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap()
|
||||
|
|
|
@ -45,11 +45,11 @@ fn test_push() {
|
|||
fakesrc.link(&proxysink).unwrap();
|
||||
proxysrc.link(&appsink).unwrap();
|
||||
|
||||
fakesrc.set_property("num-buffers", 3i32).unwrap();
|
||||
proxysink.set_property("proxy-context", "test1").unwrap();
|
||||
proxysrc.set_property("proxy-context", "test1").unwrap();
|
||||
fakesrc.set_property("num-buffers", 3i32);
|
||||
proxysink.set_property("proxy-context", "test1");
|
||||
proxysrc.set_property("proxy-context", "test1");
|
||||
|
||||
appsink.set_property("emit-signals", true).unwrap();
|
||||
appsink.set_property("emit-signals", true);
|
||||
|
||||
let samples = Arc::new(Mutex::new(Vec::new()));
|
||||
|
||||
|
@ -61,7 +61,6 @@ fn test_push() {
|
|||
let sample = appsink
|
||||
.emit_by_name("pull-sample", &[])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<gst::Sample>()
|
||||
.unwrap();
|
||||
|
||||
|
@ -117,8 +116,8 @@ fn test_from_pipeline_to_pipeline() {
|
|||
pipe_2.add_many(&[&pxsrc, &fakesink]).unwrap();
|
||||
pxsrc.link(&fakesink).unwrap();
|
||||
|
||||
pxsink.set_property("proxy-context", "test2").unwrap();
|
||||
pxsrc.set_property("proxy-context", "test2").unwrap();
|
||||
pxsink.set_property("proxy-context", "test2");
|
||||
pxsrc.set_property("proxy-context", "test2");
|
||||
|
||||
pipe_1.set_state(gst::State::Paused).unwrap();
|
||||
pipe_2.set_state(gst::State::Paused).unwrap();
|
||||
|
@ -149,11 +148,11 @@ fn test_from_pipeline_to_pipeline_and_back() {
|
|||
pipe_2.add_many(&[&pxsrc_2, &pxsink_2]).unwrap();
|
||||
pxsrc_2.link(&pxsink_2).unwrap();
|
||||
|
||||
pxsrc_1.set_property("proxy-context", "test3").unwrap();
|
||||
pxsink_2.set_property("proxy-context", "test3").unwrap();
|
||||
pxsrc_1.set_property("proxy-context", "test3");
|
||||
pxsink_2.set_property("proxy-context", "test3");
|
||||
|
||||
pxsrc_2.set_property("proxy-context", "test4").unwrap();
|
||||
pxsink_1.set_property("proxy-context", "test4").unwrap();
|
||||
pxsrc_2.set_property("proxy-context", "test4");
|
||||
pxsink_1.set_property("proxy-context", "test4");
|
||||
|
||||
pipe_1.set_state(gst::State::Paused).unwrap();
|
||||
pipe_2.set_state(gst::State::Paused).unwrap();
|
||||
|
|
|
@ -42,9 +42,9 @@ fn test_push() {
|
|||
fakesrc.link(&queue).unwrap();
|
||||
queue.link(&appsink).unwrap();
|
||||
|
||||
fakesrc.set_property("num-buffers", 3i32).unwrap();
|
||||
fakesrc.set_property("num-buffers", 3i32);
|
||||
|
||||
appsink.set_property("emit-signals", true).unwrap();
|
||||
appsink.set_property("emit-signals", true);
|
||||
|
||||
let samples = Arc::new(Mutex::new(Vec::new()));
|
||||
|
||||
|
@ -56,7 +56,6 @@ fn test_push() {
|
|||
let sample = appsink
|
||||
.emit_by_name("pull-sample", &[])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<gst::Sample>()
|
||||
.unwrap();
|
||||
|
||||
|
|
|
@ -56,17 +56,17 @@ fn test_push() {
|
|||
|
||||
let tcpclientsrc = gst::ElementFactory::make("ts-tcpclientsrc", None).unwrap();
|
||||
let appsink = gst::ElementFactory::make("appsink", None).unwrap();
|
||||
appsink.set_property("sync", false).unwrap();
|
||||
appsink.set_property("async", false).unwrap();
|
||||
appsink.set_property("sync", false);
|
||||
appsink.set_property("async", false);
|
||||
|
||||
pipeline.add_many(&[&tcpclientsrc, &appsink]).unwrap();
|
||||
tcpclientsrc.link(&appsink).unwrap();
|
||||
|
||||
let caps = gst::Caps::builder("foo/bar").build();
|
||||
tcpclientsrc.set_property("caps", &caps).unwrap();
|
||||
tcpclientsrc.set_property("port", 5000i32).unwrap();
|
||||
tcpclientsrc.set_property("caps", &caps);
|
||||
tcpclientsrc.set_property("port", 5000i32);
|
||||
|
||||
appsink.set_property("emit-signals", true).unwrap();
|
||||
appsink.set_property("emit-signals", true);
|
||||
|
||||
let samples = Arc::new(Mutex::new(Vec::new()));
|
||||
|
||||
|
@ -78,7 +78,6 @@ fn test_push() {
|
|||
let sample = appsink
|
||||
.emit_by_name("pull-sample", &[])
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.get::<gst::Sample>()
|
||||
.unwrap();
|
||||
|
||||
|
|
|
@ -36,84 +36,40 @@ fn test_client_management() {
|
|||
let h = gst_check::Harness::new("ts-udpsink");
|
||||
let udpsink = h.element().unwrap();
|
||||
|
||||
let clients = udpsink
|
||||
.property("clients")
|
||||
.unwrap()
|
||||
.get::<String>()
|
||||
.unwrap();
|
||||
let clients = udpsink.property::<String>("clients");
|
||||
|
||||
assert_eq!(clients, "127.0.0.1:5004");
|
||||
|
||||
udpsink
|
||||
.emit_by_name("add", &[&"192.168.1.1", &57i32])
|
||||
.unwrap();
|
||||
let clients = udpsink
|
||||
.property("clients")
|
||||
.unwrap()
|
||||
.get::<String>()
|
||||
.unwrap();
|
||||
udpsink.emit_by_name("add", &[&"192.168.1.1", &57i32]);
|
||||
let clients = udpsink.property::<String>("clients");
|
||||
assert_eq!(clients, "127.0.0.1:5004,192.168.1.1:57");
|
||||
|
||||
/* Adding a client twice is not supported */
|
||||
udpsink
|
||||
.emit_by_name("add", &[&"192.168.1.1", &57i32])
|
||||
.unwrap();
|
||||
let clients = udpsink
|
||||
.property("clients")
|
||||
.unwrap()
|
||||
.get::<String>()
|
||||
.unwrap();
|
||||
udpsink.emit_by_name("add", &[&"192.168.1.1", &57i32]);
|
||||
let clients = udpsink.property::<String>("clients");
|
||||
assert_eq!(clients, "127.0.0.1:5004,192.168.1.1:57");
|
||||
|
||||
udpsink
|
||||
.emit_by_name("remove", &[&"192.168.1.1", &57i32])
|
||||
.unwrap();
|
||||
let clients = udpsink
|
||||
.property("clients")
|
||||
.unwrap()
|
||||
.get::<String>()
|
||||
.unwrap();
|
||||
udpsink.emit_by_name("remove", &[&"192.168.1.1", &57i32]);
|
||||
let clients = udpsink.property::<String>("clients");
|
||||
assert_eq!(clients, "127.0.0.1:5004");
|
||||
|
||||
/* Removing a non-existing client should not be a problem */
|
||||
udpsink
|
||||
.emit_by_name("remove", &[&"192.168.1.1", &57i32])
|
||||
.unwrap();
|
||||
let clients = udpsink
|
||||
.property("clients")
|
||||
.unwrap()
|
||||
.get::<String>()
|
||||
.unwrap();
|
||||
udpsink.emit_by_name("remove", &[&"192.168.1.1", &57i32]);
|
||||
let clients = udpsink.property::<String>("clients");
|
||||
assert_eq!(clients, "127.0.0.1:5004");
|
||||
|
||||
/* Removing the default client is possible */
|
||||
udpsink
|
||||
.emit_by_name("remove", &[&"127.0.0.1", &5004i32])
|
||||
.unwrap();
|
||||
let clients = udpsink
|
||||
.property("clients")
|
||||
.unwrap()
|
||||
.get::<String>()
|
||||
.unwrap();
|
||||
udpsink.emit_by_name("remove", &[&"127.0.0.1", &5004i32]);
|
||||
let clients = udpsink.property::<String>("clients");
|
||||
assert_eq!(clients, "");
|
||||
|
||||
/* The client properties is writable too */
|
||||
udpsink
|
||||
.set_property("clients", "127.0.0.1:5004,192.168.1.1:57")
|
||||
.unwrap();
|
||||
let clients = udpsink
|
||||
.property("clients")
|
||||
.unwrap()
|
||||
.get::<String>()
|
||||
.unwrap();
|
||||
udpsink.set_property("clients", "127.0.0.1:5004,192.168.1.1:57");
|
||||
let clients = udpsink.property::<String>("clients");
|
||||
assert_eq!(clients, "127.0.0.1:5004,192.168.1.1:57");
|
||||
|
||||
udpsink.emit_by_name("clear", &[]).unwrap();
|
||||
let clients = udpsink
|
||||
.property("clients")
|
||||
.unwrap()
|
||||
.get::<String>()
|
||||
.unwrap();
|
||||
udpsink.emit_by_name("clear", &[]);
|
||||
let clients = udpsink.property::<String>("clients");
|
||||
assert_eq!(clients, "");
|
||||
}
|
||||
|
||||
|
@ -125,7 +81,7 @@ fn test_chain() {
|
|||
h.set_src_caps_str("foo/bar");
|
||||
{
|
||||
let udpsink = h.element().unwrap();
|
||||
udpsink.set_property("clients", "127.0.0.1:5005").unwrap();
|
||||
udpsink.set_property("clients", "127.0.0.1:5005");
|
||||
}
|
||||
|
||||
thread::spawn(move || {
|
||||
|
|
|
@ -38,9 +38,9 @@ fn test_push() {
|
|||
let caps = gst::Caps::builder("foo/bar").build();
|
||||
{
|
||||
let udpsrc = h.element().unwrap();
|
||||
udpsrc.set_property("caps", &caps).unwrap();
|
||||
udpsrc.set_property("port", 5000i32).unwrap();
|
||||
udpsrc.set_property("context", "test-push").unwrap();
|
||||
udpsrc.set_property("caps", &caps);
|
||||
udpsrc.set_property("port", 5000i32);
|
||||
udpsrc.set_property("context", "test-push");
|
||||
}
|
||||
|
||||
h.play();
|
||||
|
@ -105,31 +105,27 @@ fn test_socket_reuse() {
|
|||
|
||||
{
|
||||
let udpsrc = ts_src_h.element().unwrap();
|
||||
udpsrc.set_property("port", 6000i32).unwrap();
|
||||
udpsrc.set_property("context", "test-socket-reuse").unwrap();
|
||||
udpsrc.set_property("port", 6000i32);
|
||||
udpsrc.set_property("context", "test-socket-reuse");
|
||||
}
|
||||
ts_src_h.play();
|
||||
|
||||
{
|
||||
let udpsrc = ts_src_h.element().unwrap();
|
||||
let socket = udpsrc
|
||||
.property("used-socket")
|
||||
.unwrap()
|
||||
.get::<gio::Socket>()
|
||||
.unwrap();
|
||||
let socket = udpsrc.property::<gio::Socket>("used-socket");
|
||||
|
||||
let udpsink = sink_h.element().unwrap();
|
||||
udpsink.set_property("socket", &socket).unwrap();
|
||||
udpsink.set_property("host", "127.0.0.1").unwrap();
|
||||
udpsink.set_property("port", 6001i32).unwrap();
|
||||
udpsink.set_property("socket", &socket);
|
||||
udpsink.set_property("host", "127.0.0.1");
|
||||
udpsink.set_property("port", 6001i32);
|
||||
}
|
||||
sink_h.play();
|
||||
sink_h.set_src_caps_str("application/test");
|
||||
|
||||
{
|
||||
let udpsrc = ts_src_h2.element().unwrap();
|
||||
udpsrc.set_property("port", 6001i32).unwrap();
|
||||
udpsrc.set_property("context", "test-socket-reuse").unwrap();
|
||||
udpsrc.set_property("port", 6001i32);
|
||||
udpsrc.set_property("context", "test-socket-reuse");
|
||||
}
|
||||
ts_src_h2.play();
|
||||
|
||||
|
|
|
@ -142,8 +142,7 @@ impl Harness {
|
|||
});
|
||||
|
||||
let local_addr = futures::executor::block_on(local_addr_receiver).unwrap();
|
||||
src.set_property("location", format!("http://{}/", local_addr))
|
||||
.unwrap();
|
||||
src.set_property("location", format!("http://{}/", local_addr));
|
||||
|
||||
// Let the test setup anything needed on the HTTP source now
|
||||
setup_func(&src);
|
||||
|
@ -410,10 +409,10 @@ fn test_basic_request_inverted_defaults() {
|
|||
Response::new(Body::from("Hello World"))
|
||||
},
|
||||
|src| {
|
||||
src.set_property("keep-alive", false).unwrap();
|
||||
src.set_property("compress", true).unwrap();
|
||||
src.set_property("iradio-mode", false).unwrap();
|
||||
src.set_property("user-agent", "test user-agent").unwrap();
|
||||
src.set_property("keep-alive", false);
|
||||
src.set_property("compress", true);
|
||||
src.set_property("iradio-mode", false);
|
||||
src.set_property("user-agent", "test user-agent");
|
||||
},
|
||||
);
|
||||
|
||||
|
@ -490,8 +489,7 @@ fn test_extra_headers() {
|
|||
.field("list", gst::List::new([1i32, 2i32]))
|
||||
.field("array", gst::Array::new([1i32, 2i32]))
|
||||
.build(),
|
||||
)
|
||||
.unwrap();
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
|
@ -550,8 +548,7 @@ fn test_cookies_property() {
|
|||
String::from("bar=2"),
|
||||
String::from("baz=3"),
|
||||
],
|
||||
)
|
||||
.unwrap();
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
|
@ -760,8 +757,8 @@ fn test_authorization() {
|
|||
}
|
||||
},
|
||||
|src| {
|
||||
src.set_property("user-id", "user").unwrap();
|
||||
src.set_property("user-pw", "password").unwrap();
|
||||
src.set_property("user-id", "user");
|
||||
src.set_property("user-pw", "password");
|
||||
},
|
||||
);
|
||||
|
||||
|
@ -860,7 +857,7 @@ fn test_network_error() {
|
|||
let mut h = Harness::new(
|
||||
|_req| unreachable!(),
|
||||
|src| {
|
||||
src.set_property("location", "http://0.0.0.0:0").unwrap();
|
||||
src.set_property("location", "http://0.0.0.0:0");
|
||||
},
|
||||
);
|
||||
|
||||
|
@ -1194,14 +1191,8 @@ fn test_proxy_prop_souphttpsrc_compatibility() {
|
|||
fn assert_proxy_set(set_to: Option<&str>, expected: Option<&str>) {
|
||||
// The same assertions should hold for "souphttpsrc".
|
||||
let src = gst::ElementFactory::make("reqwesthttpsrc", None).unwrap();
|
||||
src.set_property("proxy", set_to).unwrap();
|
||||
assert_eq!(
|
||||
src.property("proxy")
|
||||
.unwrap()
|
||||
.get::<Option<&str>>()
|
||||
.unwrap(),
|
||||
expected
|
||||
);
|
||||
src.set_property("proxy", set_to);
|
||||
assert_eq!(src.property::<Option<String>>("proxy").as_deref(), expected);
|
||||
}
|
||||
|
||||
// Test env var proxy.
|
||||
|
@ -1275,7 +1266,7 @@ fn test_proxy() {
|
|||
.unwrap()
|
||||
},
|
||||
|src| {
|
||||
src.set_property("proxy", proxy_addr.to_string()).unwrap();
|
||||
src.set_property("proxy", proxy_addr.to_string());
|
||||
},
|
||||
);
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ fn test_replace_all() {
|
|||
|
||||
let commands = gst::Array::from(vec![command.to_send_value()]);
|
||||
|
||||
regex.set_property("commands", &commands).unwrap();
|
||||
regex.set_property("commands", &commands);
|
||||
}
|
||||
|
||||
h.set_src_caps_str("text/x-raw, format=utf8");
|
||||
|
|
|
@ -39,7 +39,7 @@ fn test_columns() {
|
|||
|
||||
{
|
||||
let wrap = h.element().expect("Could not create textwrap");
|
||||
wrap.set_property("columns", 5u32).unwrap();
|
||||
wrap.set_property("columns", 5u32);
|
||||
}
|
||||
|
||||
h.set_src_caps_str("text/x-raw, format=utf8");
|
||||
|
@ -77,8 +77,8 @@ fn test_lines() {
|
|||
|
||||
{
|
||||
let wrap = h.element().expect("Could not create textwrap");
|
||||
wrap.set_property("columns", 5u32).unwrap();
|
||||
wrap.set_property("lines", 2u32).unwrap();
|
||||
wrap.set_property("columns", 5u32);
|
||||
wrap.set_property("lines", 2u32);
|
||||
}
|
||||
|
||||
h.set_src_caps_str("text/x-raw, format=utf8");
|
||||
|
|
|
@ -64,7 +64,7 @@ impl ObjectSubclass for ProgressBin {
|
|||
// Create the progressreport element.
|
||||
let progress = gst::ElementFactory::make("progressreport", Some("progress")).unwrap();
|
||||
// Don't let progressreport print to stdout itself
|
||||
progress.set_property("silent", true).unwrap();
|
||||
progress.set_property("silent", true);
|
||||
|
||||
// Return an instance of our struct
|
||||
Self {
|
||||
|
|
|
@ -41,9 +41,7 @@ fn create_pipeline() -> (gst::Pipeline, gst::Pad, gst::Element, gtk::Widget) {
|
|||
.upcast();
|
||||
|
||||
let fallbackswitch = gst::ElementFactory::make("fallbackswitch", None).unwrap();
|
||||
fallbackswitch
|
||||
.set_property("timeout", gst::ClockTime::SECOND)
|
||||
.unwrap();
|
||||
fallbackswitch.set_property("timeout", gst::ClockTime::SECOND);
|
||||
|
||||
let decodebin = gst::ElementFactory::make("decodebin", None).unwrap();
|
||||
let videoconvert = gst::ElementFactory::make("videoconvert", None).unwrap();
|
||||
|
@ -63,15 +61,15 @@ fn create_pipeline() -> (gst::Pipeline, gst::Pad, gst::Element, gtk::Widget) {
|
|||
let (video_sink, video_widget) =
|
||||
//if let Some(gtkglsink) = gst::ElementFactory::make("gtkglsink", None) {
|
||||
// let glsinkbin = gst::ElementFactory::make("glsinkbin", None).unwrap();
|
||||
// glsinkbin.set_property("sink", >kglsink).unwrap();
|
||||
// glsinkbin.set_property("sink", >kglsink);
|
||||
|
||||
// let widget = gtkglsink.get_property("widget").unwrap();
|
||||
// (glsinkbin, widget.get::<gtk::Widget>().unwrap().unwrap())
|
||||
// let widget = gtkglsink.property::<gtk::Widget>("widget");
|
||||
// (glsinkbin, widget)
|
||||
//} else
|
||||
{
|
||||
let sink = gst::ElementFactory::make("gtksink", None).unwrap();
|
||||
let widget = sink.property("widget").unwrap();
|
||||
(sink, widget.get::<gtk::Widget>().unwrap())
|
||||
let widget = sink.property::<gtk::Widget>("widget");
|
||||
(sink, widget)
|
||||
};
|
||||
|
||||
pipeline
|
||||
|
|
|
@ -827,17 +827,14 @@ impl FallbackSrc {
|
|||
|
||||
let uri = element
|
||||
.emit_by_name("update-uri", &[uri])
|
||||
.expect("Failed to emit update-uri signal")
|
||||
.expect("No value returned");
|
||||
let uri = uri
|
||||
.get::<&str>()
|
||||
.expect("Wrong type returned from update-uri signal");
|
||||
|
||||
source.set_property("uri", uri).unwrap();
|
||||
source.set_property("use-buffering", true).unwrap();
|
||||
source
|
||||
.set_property("buffer-duration", buffer_duration)
|
||||
.unwrap();
|
||||
source.set_property("uri", uri);
|
||||
source.set_property("use-buffering", true);
|
||||
source.set_property("buffer-duration", buffer_duration);
|
||||
|
||||
source
|
||||
}
|
||||
|
@ -846,7 +843,7 @@ impl FallbackSrc {
|
|||
|
||||
// Handle any async state changes internally, they don't affect the pipeline because we
|
||||
// convert everything to a live stream
|
||||
source.set_property("async-handling", true).unwrap();
|
||||
source.set_property("async-handling", true);
|
||||
// Don't let the bin handle state changes of the source. We want to do it manually to catch
|
||||
// possible errors and retry, without causing the whole bin state change to fail
|
||||
source.set_locked_state(true);
|
||||
|
@ -894,10 +891,8 @@ impl FallbackSrc {
|
|||
.expect("No audiotestsrc found");
|
||||
input.add_many(&[&audiotestsrc]).unwrap();
|
||||
|
||||
audiotestsrc
|
||||
.set_property_from_str("wave", "silence")
|
||||
.unwrap();
|
||||
audiotestsrc.set_property("is-live", true).unwrap();
|
||||
audiotestsrc.set_property_from_str("wave", "silence");
|
||||
audiotestsrc.set_property("is-live", true);
|
||||
|
||||
let srcpad = audiotestsrc.static_pad("src").unwrap();
|
||||
input
|
||||
|
@ -931,20 +926,18 @@ impl FallbackSrc {
|
|||
let clocksync = gst::ElementFactory::make("clocksync", None)
|
||||
.or_else(|_| -> Result<_, glib::BoolError> {
|
||||
let identity = gst::ElementFactory::make("identity", None)?;
|
||||
identity.set_property("sync", true).unwrap();
|
||||
identity.set_property("sync", true);
|
||||
Ok(identity)
|
||||
})
|
||||
.expect("No clocksync or identity found");
|
||||
|
||||
// Workaround for issues caused by https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/800
|
||||
let clocksync_queue = gst::ElementFactory::make("queue", None).expect("No queue found");
|
||||
clocksync_queue
|
||||
.set_properties(&[
|
||||
clocksync_queue.set_properties(&[
|
||||
("max-size-buffers", &0u32),
|
||||
("max-size-bytes", &0u32),
|
||||
("max-size-time", &gst::ClockTime::SECOND),
|
||||
])
|
||||
.unwrap();
|
||||
]);
|
||||
|
||||
element
|
||||
.add_many(&[&fallback_input, &switch, &clocksync_queue, &clocksync])
|
||||
|
@ -960,13 +953,9 @@ impl FallbackSrc {
|
|||
let src = FallbackSrc::from_instance(&element);
|
||||
src.handle_switch_active_pad_change(&element);
|
||||
});
|
||||
switch.set_property("timeout", timeout.nseconds()).unwrap();
|
||||
switch
|
||||
.set_property("min-upstream-latency", min_latency.nseconds())
|
||||
.unwrap();
|
||||
switch
|
||||
.set_property("immediate-fallback", immediate_fallback)
|
||||
.unwrap();
|
||||
switch.set_property("timeout", timeout.nseconds());
|
||||
switch.set_property("min-upstream-latency", min_latency.nseconds());
|
||||
switch.set_property("immediate-fallback", immediate_fallback);
|
||||
|
||||
gst::Element::link_pads(&fallback_input, Some("src"), &switch, Some("fallback_sink"))
|
||||
.unwrap();
|
||||
|
@ -1341,7 +1330,7 @@ impl FallbackSrc {
|
|||
|
||||
gst_debug!(CAT, "image stream, inserting imagefreeze");
|
||||
element.add(&imagefreeze).unwrap();
|
||||
imagefreeze.set_property("is-live", true).unwrap();
|
||||
imagefreeze.set_property("is-live", true);
|
||||
if imagefreeze.sync_state_with_parent().is_err() {
|
||||
gst_error!(CAT, obj: element, "imagefreeze failed to change state",);
|
||||
return Err(gst::error_msg!(
|
||||
|
@ -2014,10 +2003,7 @@ impl FallbackSrc {
|
|||
|
||||
let prev_fallback_uri = video_stream
|
||||
.fallback_input
|
||||
.property("uri")
|
||||
.unwrap()
|
||||
.get::<Option<String>>()
|
||||
.unwrap();
|
||||
.property::<Option<String>>("uri");
|
||||
|
||||
// This means previously videotestsrc was configured
|
||||
// Something went wrong and there is no other way than to error out
|
||||
|
@ -2383,13 +2369,7 @@ impl FallbackSrc {
|
|||
&& state
|
||||
.audio_stream
|
||||
.as_ref()
|
||||
.and_then(|s| {
|
||||
s.switch
|
||||
.property("active-pad")
|
||||
.unwrap()
|
||||
.get::<Option<gst::Pad>>()
|
||||
.unwrap()
|
||||
})
|
||||
.and_then(|s| s.switch.property::<Option<gst::Pad>>("active-pad"))
|
||||
.map(|p| p.name() == "fallback_sink")
|
||||
.unwrap_or(true))
|
||||
|| (have_video
|
||||
|
@ -2397,13 +2377,7 @@ impl FallbackSrc {
|
|||
&& state
|
||||
.video_stream
|
||||
.as_ref()
|
||||
.and_then(|s| {
|
||||
s.switch
|
||||
.property("active-pad")
|
||||
.unwrap()
|
||||
.get::<Option<gst::Pad>>()
|
||||
.unwrap()
|
||||
})
|
||||
.and_then(|s| s.switch.property::<Option<gst::Pad>>("active-pad"))
|
||||
.map(|p| p.name() == "fallback_sink")
|
||||
.unwrap_or(true))
|
||||
}
|
||||
|
|
|
@ -303,22 +303,20 @@ impl VideoFallbackSource {
|
|||
.or_else(|_| -> Result<_, glib::BoolError> {
|
||||
let identity =
|
||||
gst::ElementFactory::make("identity", Some("fallback_clocksync"))?;
|
||||
identity.set_property("sync", true).unwrap();
|
||||
identity.set_property("sync", true);
|
||||
Ok(identity)
|
||||
})
|
||||
.expect("No clocksync or identity found");
|
||||
let queue = gst::ElementFactory::make("queue", Some("fallback_queue"))
|
||||
.expect("No queue found");
|
||||
queue
|
||||
.set_properties(&[
|
||||
queue.set_properties(&[
|
||||
("max-size-buffers", &0u32),
|
||||
("max-size-bytes", &0u32),
|
||||
(
|
||||
"max-size-time",
|
||||
&min_latency.max(5 * gst::ClockTime::SECOND).nseconds(),
|
||||
),
|
||||
])
|
||||
.unwrap();
|
||||
]);
|
||||
|
||||
source
|
||||
.add_many(&[
|
||||
|
@ -341,7 +339,7 @@ impl VideoFallbackSource {
|
|||
])
|
||||
.unwrap();
|
||||
|
||||
if imagefreeze.set_property("is-live", true).is_err() {
|
||||
if imagefreeze.try_set_property("is-live", true).is_err() {
|
||||
gst_error!(
|
||||
CAT,
|
||||
obj: element,
|
||||
|
@ -357,8 +355,7 @@ impl VideoFallbackSource {
|
|||
let element_weak = element.downgrade();
|
||||
let source_weak = source.downgrade();
|
||||
let videoconvert_weak = videoconvert.downgrade();
|
||||
typefind
|
||||
.connect("have-type", false, move |args| {
|
||||
typefind.connect("have-type", false, move |args| {
|
||||
let typefind = args[0].get::<gst::Element>().unwrap();
|
||||
let _probability = args[1].get::<u32>().unwrap();
|
||||
let caps = args[2].get::<gst::Caps>().unwrap();
|
||||
|
@ -411,8 +408,7 @@ impl VideoFallbackSource {
|
|||
}
|
||||
|
||||
None
|
||||
})
|
||||
.unwrap();
|
||||
});
|
||||
|
||||
queue.static_pad("src").unwrap()
|
||||
}
|
||||
|
@ -422,10 +418,8 @@ impl VideoFallbackSource {
|
|||
.expect("No videotestsrc found");
|
||||
source.add_many(&[&videotestsrc]).unwrap();
|
||||
|
||||
videotestsrc
|
||||
.set_property_from_str("pattern", "black")
|
||||
.unwrap();
|
||||
videotestsrc.set_property("is-live", true).unwrap();
|
||||
videotestsrc.set_property_from_str("pattern", "black");
|
||||
videotestsrc.set_property("is-live", true);
|
||||
|
||||
videotestsrc.static_pad("src").unwrap()
|
||||
}
|
||||
|
|
|
@ -371,9 +371,9 @@ fn setup_pipeline(with_live_fallback: Option<bool>) -> Pipeline {
|
|||
.unwrap()
|
||||
.downcast::<gst_app::AppSrc>()
|
||||
.unwrap();
|
||||
src.set_property("is-live", true).unwrap();
|
||||
src.set_property("format", gst::Format::Time).unwrap();
|
||||
src.set_property("min-latency", 10i64).unwrap();
|
||||
src.set_property("is-live", true);
|
||||
src.set_property("format", gst::Format::Time);
|
||||
src.set_property("min-latency", 10i64);
|
||||
src.set_property(
|
||||
"caps",
|
||||
&gst::Caps::builder("video/x-raw")
|
||||
|
@ -382,19 +382,16 @@ fn setup_pipeline(with_live_fallback: Option<bool>) -> Pipeline {
|
|||
.field("height", 240)
|
||||
.field("framerate", gst::Fraction::new(1, 1))
|
||||
.build(),
|
||||
)
|
||||
.unwrap();
|
||||
);
|
||||
|
||||
let switch = gst::ElementFactory::make("fallbackswitch", Some("switch")).unwrap();
|
||||
switch
|
||||
.set_property("timeout", 3 * gst::ClockTime::SECOND)
|
||||
.unwrap();
|
||||
switch.set_property("timeout", 3 * gst::ClockTime::SECOND);
|
||||
|
||||
let sink = gst::ElementFactory::make("appsink", Some("sink"))
|
||||
.unwrap()
|
||||
.downcast::<gst_app::AppSink>()
|
||||
.unwrap();
|
||||
sink.set_property("sync", false).unwrap();
|
||||
sink.set_property("sync", false);
|
||||
|
||||
let queue = gst::ElementFactory::make("queue", None).unwrap();
|
||||
|
||||
|
@ -410,13 +407,10 @@ fn setup_pipeline(with_live_fallback: Option<bool>) -> Pipeline {
|
|||
.unwrap()
|
||||
.downcast::<gst_app::AppSrc>()
|
||||
.unwrap();
|
||||
fallback_src.set_property("is-live", live).unwrap();
|
||||
fallback_src
|
||||
.set_property("format", gst::Format::Time)
|
||||
.unwrap();
|
||||
fallback_src.set_property("min-latency", 10i64).unwrap();
|
||||
fallback_src
|
||||
.set_property(
|
||||
fallback_src.set_property("is-live", live);
|
||||
fallback_src.set_property("format", gst::Format::Time);
|
||||
fallback_src.set_property("min-latency", 10i64);
|
||||
fallback_src.set_property(
|
||||
"caps",
|
||||
&gst::Caps::builder("video/x-raw")
|
||||
.field("format", "ARGB")
|
||||
|
@ -424,8 +418,7 @@ fn setup_pipeline(with_live_fallback: Option<bool>) -> Pipeline {
|
|||
.field("height", 120)
|
||||
.field("framerate", gst::Fraction::new(1, 1))
|
||||
.build(),
|
||||
)
|
||||
.unwrap();
|
||||
);
|
||||
|
||||
pipeline.add(&fallback_src).unwrap();
|
||||
|
||||
|
|
|
@ -33,13 +33,11 @@ fn create_pipeline() -> (
|
|||
let pipeline = gst::Pipeline::new(None);
|
||||
|
||||
let video_src = gst::ElementFactory::make("videotestsrc", None).unwrap();
|
||||
video_src.set_property("is-live", true).unwrap();
|
||||
video_src.set_property_from_str("pattern", "ball").unwrap();
|
||||
video_src.set_property("is-live", true);
|
||||
video_src.set_property_from_str("pattern", "ball");
|
||||
|
||||
let timeoverlay = gst::ElementFactory::make("timeoverlay", None).unwrap();
|
||||
timeoverlay
|
||||
.set_property("font-desc", "Monospace 20")
|
||||
.unwrap();
|
||||
timeoverlay.set_property("font-desc", "Monospace 20");
|
||||
|
||||
let video_tee = gst::ElementFactory::make("tee", None).unwrap();
|
||||
let video_queue1 = gst::ElementFactory::make("queue", None).unwrap();
|
||||
|
@ -51,24 +49,24 @@ fn create_pipeline() -> (
|
|||
let (video_sink, video_widget) =
|
||||
if let Ok(gtkglsink) = gst::ElementFactory::make("gtkglsink", None) {
|
||||
let glsinkbin = gst::ElementFactory::make("glsinkbin", None).unwrap();
|
||||
glsinkbin.set_property("sink", >kglsink).unwrap();
|
||||
glsinkbin.set_property("sink", >kglsink);
|
||||
|
||||
let widget = gtkglsink.property("widget").unwrap();
|
||||
(glsinkbin, widget.get::<gtk::Widget>().unwrap())
|
||||
let widget = gtkglsink.property::<gtk::Widget>("widget");
|
||||
(glsinkbin, widget)
|
||||
} else {
|
||||
let sink = gst::ElementFactory::make("gtksink", None).unwrap();
|
||||
let widget = sink.property("widget").unwrap();
|
||||
(sink, widget.get::<gtk::Widget>().unwrap())
|
||||
let widget = sink.property::<gtk::Widget>("widget");
|
||||
(sink, widget)
|
||||
};
|
||||
|
||||
let video_enc = gst::ElementFactory::make("x264enc", None).unwrap();
|
||||
video_enc.set_property("rc-lookahead", 10i32).unwrap();
|
||||
video_enc.set_property("key-int-max", 30u32).unwrap();
|
||||
video_enc.set_property("rc-lookahead", 10i32);
|
||||
video_enc.set_property("key-int-max", 30u32);
|
||||
let video_parse = gst::ElementFactory::make("h264parse", None).unwrap();
|
||||
|
||||
let audio_src = gst::ElementFactory::make("audiotestsrc", None).unwrap();
|
||||
audio_src.set_property("is-live", true).unwrap();
|
||||
audio_src.set_property_from_str("wave", "ticks").unwrap();
|
||||
audio_src.set_property("is-live", true);
|
||||
audio_src.set_property_from_str("wave", "ticks");
|
||||
|
||||
let audio_tee = gst::ElementFactory::make("tee", None).unwrap();
|
||||
let audio_queue1 = gst::ElementFactory::make("queue", None).unwrap();
|
||||
|
@ -90,9 +88,9 @@ fn create_pipeline() -> (
|
|||
let mux = gst::ElementFactory::make("mp4mux", None).unwrap();
|
||||
|
||||
let file_sink = gst::ElementFactory::make("filesink", None).unwrap();
|
||||
file_sink.set_property("location", "recording.mp4").unwrap();
|
||||
file_sink.set_property("async", false).unwrap();
|
||||
file_sink.set_property("sync", false).unwrap();
|
||||
file_sink.set_property("location", "recording.mp4");
|
||||
file_sink.set_property("async", false);
|
||||
file_sink.set_property("sync", false);
|
||||
|
||||
pipeline
|
||||
.add_many(&[
|
||||
|
@ -255,12 +253,8 @@ fn create_ui(app: >k::Application) {
|
|||
None => return,
|
||||
};
|
||||
|
||||
let recording = !togglerecord
|
||||
.property("record")
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap();
|
||||
togglerecord.set_property("record", recording).unwrap();
|
||||
let recording = !togglerecord.property::<bool>("record");
|
||||
togglerecord.set_property("record", recording);
|
||||
|
||||
button.set_label(if recording { "Stop" } else { "Record" });
|
||||
});
|
||||
|
|
|
@ -53,7 +53,7 @@ fn setup_sender_receiver(
|
|||
thread::JoinHandle<()>,
|
||||
) {
|
||||
let fakesink = gst::ElementFactory::make("fakesink", None).unwrap();
|
||||
fakesink.set_property("async", false).unwrap();
|
||||
fakesink.set_property("async", false);
|
||||
pipeline.add(&fakesink).unwrap();
|
||||
|
||||
let main_stream = pad == "src";
|
||||
|
@ -298,7 +298,7 @@ fn test_one_stream_open() {
|
|||
|
||||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
togglerecord.set_property("record", true).unwrap();
|
||||
togglerecord.set_property("record", true);
|
||||
sender_input.send(SendData::Buffers(10)).unwrap();
|
||||
drop(sender_input);
|
||||
|
||||
|
@ -330,7 +330,7 @@ fn test_one_stream_gaps_open() {
|
|||
|
||||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
togglerecord.set_property("record", true).unwrap();
|
||||
togglerecord.set_property("record", true);
|
||||
sender_input.send(SendData::Buffers(5)).unwrap();
|
||||
sender_input.send(SendData::Gaps(5)).unwrap();
|
||||
drop(sender_input);
|
||||
|
@ -365,7 +365,7 @@ fn test_one_stream_close_open() {
|
|||
|
||||
sender_input.send(SendData::Buffers(10)).unwrap();
|
||||
receiver_input_done.recv().unwrap();
|
||||
togglerecord.set_property("record", true).unwrap();
|
||||
togglerecord.set_property("record", true);
|
||||
sender_input.send(SendData::Buffers(10)).unwrap();
|
||||
drop(sender_input);
|
||||
|
||||
|
@ -397,10 +397,10 @@ fn test_one_stream_open_close() {
|
|||
|
||||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
togglerecord.set_property("record", true).unwrap();
|
||||
togglerecord.set_property("record", true);
|
||||
sender_input.send(SendData::Buffers(10)).unwrap();
|
||||
receiver_input_done.recv().unwrap();
|
||||
togglerecord.set_property("record", false).unwrap();
|
||||
togglerecord.set_property("record", false);
|
||||
sender_input.send(SendData::Buffers(10)).unwrap();
|
||||
drop(sender_input);
|
||||
|
||||
|
@ -432,13 +432,13 @@ fn test_one_stream_open_close_open() {
|
|||
|
||||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
togglerecord.set_property("record", true).unwrap();
|
||||
togglerecord.set_property("record", true);
|
||||
sender_input.send(SendData::Buffers(10)).unwrap();
|
||||
receiver_input_done.recv().unwrap();
|
||||
togglerecord.set_property("record", false).unwrap();
|
||||
togglerecord.set_property("record", false);
|
||||
sender_input.send(SendData::Buffers(10)).unwrap();
|
||||
receiver_input_done.recv().unwrap();
|
||||
togglerecord.set_property("record", true).unwrap();
|
||||
togglerecord.set_property("record", true);
|
||||
sender_input.send(SendData::Buffers(10)).unwrap();
|
||||
drop(sender_input);
|
||||
|
||||
|
@ -478,7 +478,7 @@ fn test_two_stream_open() {
|
|||
|
||||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
togglerecord.set_property("record", true).unwrap();
|
||||
togglerecord.set_property("record", true);
|
||||
|
||||
sender_input_1.send(SendData::Buffers(10)).unwrap();
|
||||
sender_input_2.send(SendData::Buffers(11)).unwrap();
|
||||
|
@ -536,7 +536,7 @@ fn test_two_stream_open_shift() {
|
|||
|
||||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
togglerecord.set_property("record", true).unwrap();
|
||||
togglerecord.set_property("record", true);
|
||||
|
||||
sender_input_1.send(SendData::Buffers(10)).unwrap();
|
||||
sender_input_2.send(SendData::Buffers(11)).unwrap();
|
||||
|
@ -599,7 +599,7 @@ fn test_two_stream_open_shift_main() {
|
|||
|
||||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
togglerecord.set_property("record", true).unwrap();
|
||||
togglerecord.set_property("record", true);
|
||||
|
||||
sender_input_1.send(SendData::Buffers(10)).unwrap();
|
||||
sender_input_2.send(SendData::Buffers(12)).unwrap();
|
||||
|
@ -676,7 +676,7 @@ fn test_two_stream_open_close() {
|
|||
|
||||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
togglerecord.set_property("record", true).unwrap();
|
||||
togglerecord.set_property("record", true);
|
||||
|
||||
sender_input_1.send(SendData::Buffers(10)).unwrap();
|
||||
sender_input_2.send(SendData::Buffers(11)).unwrap();
|
||||
|
@ -686,7 +686,7 @@ fn test_two_stream_open_close() {
|
|||
|
||||
// Stop recording and push new buffers to sender 1, which will advance
|
||||
// it and release the 11th buffer of sender 2 above
|
||||
togglerecord.set_property("record", false).unwrap();
|
||||
togglerecord.set_property("record", false);
|
||||
sender_input_1.send(SendData::Buffers(10)).unwrap();
|
||||
receiver_input_done_2.recv().unwrap();
|
||||
|
||||
|
@ -745,7 +745,7 @@ fn test_two_stream_close_open() {
|
|||
|
||||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
togglerecord.set_property("record", false).unwrap();
|
||||
togglerecord.set_property("record", false);
|
||||
|
||||
sender_input_1.send(SendData::Buffers(10)).unwrap();
|
||||
sender_input_2.send(SendData::Buffers(11)).unwrap();
|
||||
|
@ -755,7 +755,7 @@ fn test_two_stream_close_open() {
|
|||
|
||||
// Start recording and push new buffers to sender 1, which will advance
|
||||
// it and release the 11th buffer of sender 2 above
|
||||
togglerecord.set_property("record", true).unwrap();
|
||||
togglerecord.set_property("record", true);
|
||||
sender_input_1.send(SendData::Buffers(10)).unwrap();
|
||||
receiver_input_done_2.recv().unwrap();
|
||||
|
||||
|
@ -814,7 +814,7 @@ fn test_two_stream_open_close_open() {
|
|||
|
||||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
togglerecord.set_property("record", true).unwrap();
|
||||
togglerecord.set_property("record", true);
|
||||
|
||||
sender_input_1.send(SendData::Buffers(10)).unwrap();
|
||||
sender_input_2.send(SendData::Buffers(11)).unwrap();
|
||||
|
@ -824,7 +824,7 @@ fn test_two_stream_open_close_open() {
|
|||
|
||||
// Stop recording and push new buffers to sender 1, which will advance
|
||||
// it and release the 11th buffer of sender 2 above
|
||||
togglerecord.set_property("record", false).unwrap();
|
||||
togglerecord.set_property("record", false);
|
||||
sender_input_1.send(SendData::Buffers(10)).unwrap();
|
||||
receiver_input_done_2.recv().unwrap();
|
||||
|
||||
|
@ -840,7 +840,7 @@ fn test_two_stream_open_close_open() {
|
|||
sender_input_2.send(SendData::Buffers(1)).unwrap();
|
||||
|
||||
// Start recording again and send another set of buffers to both senders
|
||||
togglerecord.set_property("record", true).unwrap();
|
||||
togglerecord.set_property("record", true);
|
||||
sender_input_1.send(SendData::Buffers(10)).unwrap();
|
||||
sender_input_2.send(SendData::Buffers(10)).unwrap();
|
||||
receiver_input_done_1.recv().unwrap();
|
||||
|
@ -908,7 +908,7 @@ fn test_two_stream_open_close_open_gaps() {
|
|||
|
||||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
togglerecord.set_property("record", true).unwrap();
|
||||
togglerecord.set_property("record", true);
|
||||
|
||||
sender_input_1.send(SendData::Buffers(3)).unwrap();
|
||||
sender_input_1.send(SendData::Gaps(3)).unwrap();
|
||||
|
@ -922,7 +922,7 @@ fn test_two_stream_open_close_open_gaps() {
|
|||
|
||||
// Stop recording and push new buffers to sender 1, which will advance
|
||||
// it and release the 11th buffer of sender 2 above
|
||||
togglerecord.set_property("record", false).unwrap();
|
||||
togglerecord.set_property("record", false);
|
||||
sender_input_1.send(SendData::Buffers(10)).unwrap();
|
||||
receiver_input_done_2.recv().unwrap();
|
||||
|
||||
|
@ -940,7 +940,7 @@ fn test_two_stream_open_close_open_gaps() {
|
|||
sender_input_2.send(SendData::Gaps(1)).unwrap();
|
||||
|
||||
// Start recording again and send another set of buffers to both senders
|
||||
togglerecord.set_property("record", true).unwrap();
|
||||
togglerecord.set_property("record", true);
|
||||
sender_input_1.send(SendData::Buffers(10)).unwrap();
|
||||
sender_input_2.send(SendData::Buffers(10)).unwrap();
|
||||
receiver_input_done_1.recv().unwrap();
|
||||
|
@ -1008,7 +1008,7 @@ fn test_two_stream_close_open_close_delta() {
|
|||
|
||||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
togglerecord.set_property("record", false).unwrap();
|
||||
togglerecord.set_property("record", false);
|
||||
|
||||
sender_input_1.send(SendData::Buffers(10)).unwrap();
|
||||
sender_input_2.send(SendData::Buffers(11)).unwrap();
|
||||
|
@ -1019,7 +1019,7 @@ fn test_two_stream_close_open_close_delta() {
|
|||
// Start recording and push new buffers to sender 1. The first one is a delta frame,
|
||||
// so will be dropped, and as such the next frame of sender 2 will also be dropped
|
||||
// Sender 2 is empty now
|
||||
togglerecord.set_property("record", true).unwrap();
|
||||
togglerecord.set_property("record", true);
|
||||
sender_input_1.send(SendData::BuffersDelta(1)).unwrap();
|
||||
sender_input_1.send(SendData::Buffers(9)).unwrap();
|
||||
receiver_input_done_2.recv().unwrap();
|
||||
|
@ -1039,7 +1039,7 @@ fn test_two_stream_close_open_close_delta() {
|
|||
// Stop recording again and send another set of buffers to both senders
|
||||
// The first one is a delta frame, so we only actually stop recording
|
||||
// after recording another frame
|
||||
togglerecord.set_property("record", false).unwrap();
|
||||
togglerecord.set_property("record", false);
|
||||
sender_input_1.send(SendData::BuffersDelta(1)).unwrap();
|
||||
sender_input_1.send(SendData::Buffers(9)).unwrap();
|
||||
sender_input_2.send(SendData::Buffers(10)).unwrap();
|
||||
|
@ -1099,7 +1099,7 @@ fn test_three_stream_open_close_open() {
|
|||
|
||||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
togglerecord.set_property("record", true).unwrap();
|
||||
togglerecord.set_property("record", true);
|
||||
|
||||
sender_input_1.send(SendData::Buffers(10)).unwrap();
|
||||
sender_input_2.send(SendData::Buffers(11)).unwrap();
|
||||
|
@ -1110,7 +1110,7 @@ fn test_three_stream_open_close_open() {
|
|||
|
||||
// Stop recording and push new buffers to sender 1, which will advance
|
||||
// it and release the 11th buffer of sender 2/3 above
|
||||
togglerecord.set_property("record", false).unwrap();
|
||||
togglerecord.set_property("record", false);
|
||||
sender_input_1.send(SendData::Buffers(10)).unwrap();
|
||||
|
||||
receiver_input_done_2.recv().unwrap();
|
||||
|
@ -1130,7 +1130,7 @@ fn test_three_stream_open_close_open() {
|
|||
sender_input_2.send(SendData::Buffers(1)).unwrap();
|
||||
|
||||
// Start recording again and send another set of buffers to both senders
|
||||
togglerecord.set_property("record", true).unwrap();
|
||||
togglerecord.set_property("record", true);
|
||||
sender_input_1.send(SendData::Buffers(10)).unwrap();
|
||||
sender_input_2.send(SendData::Buffers(10)).unwrap();
|
||||
sender_input_3.send(SendData::Buffers(5)).unwrap();
|
||||
|
@ -1221,7 +1221,7 @@ fn test_two_stream_main_eos() {
|
|||
|
||||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
togglerecord.set_property("record", true).unwrap();
|
||||
togglerecord.set_property("record", true);
|
||||
|
||||
// Send 10 buffers to main stream first
|
||||
sender_input_1.send(SendData::Buffers(10)).unwrap();
|
||||
|
@ -1234,11 +1234,7 @@ fn test_two_stream_main_eos() {
|
|||
sender_input_1.send(SendData::Eos).unwrap();
|
||||
receiver_input_done_1.recv().unwrap();
|
||||
|
||||
let recording = togglerecord
|
||||
.property("recording")
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap();
|
||||
let recording = togglerecord.property::<bool>("recording");
|
||||
assert!(recording);
|
||||
|
||||
// Send 2 buffers to secondary stream. At this moment, main stream got eos
|
||||
|
@ -1253,11 +1249,7 @@ fn test_two_stream_main_eos() {
|
|||
|
||||
// At this moment, all streams should be in eos state. So togglerecord
|
||||
// must be in stopped state
|
||||
let recording = togglerecord
|
||||
.property("recording")
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap();
|
||||
let recording = togglerecord.property::<bool>("recording");
|
||||
assert!(!recording);
|
||||
|
||||
let mut segment_1 = gst::FormattedSegment::<gst::ClockTime>::new();
|
||||
|
@ -1304,7 +1296,7 @@ fn test_two_stream_secondary_eos_first() {
|
|||
|
||||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
togglerecord.set_property("record", true).unwrap();
|
||||
togglerecord.set_property("record", true);
|
||||
|
||||
// Send 10 buffers to main stream first
|
||||
sender_input_1.send(SendData::Buffers(10)).unwrap();
|
||||
|
@ -1317,22 +1309,14 @@ fn test_two_stream_secondary_eos_first() {
|
|||
receiver_input_done_2.recv().unwrap();
|
||||
|
||||
// Since main stream is not yet EOS state, we should be in recording state
|
||||
let recording = togglerecord
|
||||
.property("recording")
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap();
|
||||
let recording = togglerecord.property::<bool>("recording");
|
||||
assert!(recording);
|
||||
|
||||
// And send EOS to the main stream then it will update state to Stopped
|
||||
sender_input_1.send(SendData::Eos).unwrap();
|
||||
receiver_input_done_1.recv().unwrap();
|
||||
|
||||
let recording = togglerecord
|
||||
.property("recording")
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap();
|
||||
let recording = togglerecord.property::<bool>("recording");
|
||||
assert!(!recording);
|
||||
|
||||
let mut segment_1 = gst::FormattedSegment::<gst::ClockTime>::new();
|
||||
|
@ -1382,7 +1366,7 @@ fn test_three_stream_main_eos() {
|
|||
|
||||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
togglerecord.set_property("record", true).unwrap();
|
||||
togglerecord.set_property("record", true);
|
||||
|
||||
sender_input_1.send(SendData::Buffers(10)).unwrap();
|
||||
sender_input_2.send(SendData::Buffers(9)).unwrap();
|
||||
|
@ -1396,11 +1380,7 @@ fn test_three_stream_main_eos() {
|
|||
sender_input_1.send(SendData::Eos).unwrap();
|
||||
receiver_input_done_1.recv().unwrap();
|
||||
|
||||
let recording = togglerecord
|
||||
.property("recording")
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap();
|
||||
let recording = togglerecord.property::<bool>("recording");
|
||||
assert!(recording);
|
||||
|
||||
// Send 2 buffers to non-main streams. At this moment, main stream got EOS
|
||||
|
@ -1415,11 +1395,7 @@ fn test_three_stream_main_eos() {
|
|||
receiver_input_done_2.recv().unwrap();
|
||||
|
||||
// The third stream is not in EOS state yet, so still recording == true
|
||||
let recording = togglerecord
|
||||
.property("recording")
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap();
|
||||
let recording = togglerecord.property::<bool>("recording");
|
||||
assert!(recording);
|
||||
|
||||
// And terminate the third thread without EOS
|
||||
|
@ -1430,11 +1406,7 @@ fn test_three_stream_main_eos() {
|
|||
|
||||
// At this moment, all streams should be in eos state. So togglerecord
|
||||
// must be in stopped state
|
||||
let recording = togglerecord
|
||||
.property("recording")
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap();
|
||||
let recording = togglerecord.property::<bool>("recording");
|
||||
assert!(!recording);
|
||||
|
||||
let mut segment_1 = gst::FormattedSegment::<gst::ClockTime>::new();
|
||||
|
@ -1495,7 +1467,7 @@ fn test_three_stream_main_and_second_eos() {
|
|||
|
||||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
togglerecord.set_property("record", true).unwrap();
|
||||
togglerecord.set_property("record", true);
|
||||
|
||||
sender_input_1.send(SendData::Buffers(10)).unwrap();
|
||||
sender_input_2.send(SendData::Buffers(9)).unwrap();
|
||||
|
@ -1509,11 +1481,7 @@ fn test_three_stream_main_and_second_eos() {
|
|||
sender_input_1.send(SendData::Eos).unwrap();
|
||||
receiver_input_done_1.recv().unwrap();
|
||||
|
||||
let recording = togglerecord
|
||||
.property("recording")
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap();
|
||||
let recording = togglerecord.property::<bool>("recording");
|
||||
assert!(recording);
|
||||
|
||||
// And send EOS to the second stream, but state shouldn't be affected by
|
||||
|
@ -1521,11 +1489,7 @@ fn test_three_stream_main_and_second_eos() {
|
|||
sender_input_2.send(SendData::Eos).unwrap();
|
||||
receiver_input_done_2.recv().unwrap();
|
||||
|
||||
let recording = togglerecord
|
||||
.property("recording")
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap();
|
||||
let recording = togglerecord.property::<bool>("recording");
|
||||
assert!(recording);
|
||||
|
||||
// Send 2 buffers to the third stream. At this moment, main stream and
|
||||
|
@ -1542,11 +1506,7 @@ fn test_three_stream_main_and_second_eos() {
|
|||
|
||||
// At this moment, all streams should be in eos state. So togglerecord
|
||||
// must be in stopped state
|
||||
let recording = togglerecord
|
||||
.property("recording")
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap();
|
||||
let recording = togglerecord.property::<bool>("recording");
|
||||
assert!(!recording);
|
||||
|
||||
let mut segment_1 = gst::FormattedSegment::<gst::ClockTime>::new();
|
||||
|
@ -1608,7 +1568,7 @@ fn test_three_stream_secondary_eos_first() {
|
|||
|
||||
pipeline.set_state(gst::State::Playing).unwrap();
|
||||
|
||||
togglerecord.set_property("record", true).unwrap();
|
||||
togglerecord.set_property("record", true);
|
||||
|
||||
sender_input_1.send(SendData::Buffers(10)).unwrap();
|
||||
sender_input_2.send(SendData::Buffers(9)).unwrap();
|
||||
|
@ -1625,11 +1585,7 @@ fn test_three_stream_secondary_eos_first() {
|
|||
receiver_input_done_3.recv().unwrap();
|
||||
|
||||
// Since main stream is not yet EOS state, we should be in recording state
|
||||
let recording = togglerecord
|
||||
.property("recording")
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap();
|
||||
let recording = togglerecord.property::<bool>("recording");
|
||||
assert!(recording);
|
||||
|
||||
// And send EOS, Send EOS to the main stream then it will update state to
|
||||
|
@ -1637,11 +1593,7 @@ fn test_three_stream_secondary_eos_first() {
|
|||
sender_input_1.send(SendData::Eos).unwrap();
|
||||
receiver_input_done_1.recv().unwrap();
|
||||
|
||||
let recording = togglerecord
|
||||
.property("recording")
|
||||
.unwrap()
|
||||
.get::<bool>()
|
||||
.unwrap();
|
||||
let recording = togglerecord.property::<bool>("recording");
|
||||
assert!(!recording);
|
||||
|
||||
let mut segment_1 = gst::FormattedSegment::<gst::ClockTime>::new();
|
||||
|
|
|
@ -36,9 +36,7 @@ fn test_cdgdec() {
|
|||
|
||||
// Ensure we are in push mode so 'blocksize' prop is used
|
||||
let filesrc = gst::ElementFactory::make("pushfilesrc", None).unwrap();
|
||||
filesrc
|
||||
.set_property("location", input_path.to_str().unwrap())
|
||||
.expect("failed to set 'location' property");
|
||||
filesrc.set_property("location", input_path.to_str().unwrap());
|
||||
{
|
||||
let child_proxy = filesrc.dynamic_cast_ref::<gst::ChildProxy>().unwrap();
|
||||
child_proxy
|
||||
|
|
|
@ -139,16 +139,12 @@ impl TranscriberBin {
|
|||
|
||||
state
|
||||
.transcriber_queue
|
||||
.set_property("max-size-buffers", 0u32)
|
||||
.unwrap();
|
||||
state
|
||||
.transcriber_queue
|
||||
.set_property("max-size-time", 0u64)
|
||||
.unwrap();
|
||||
.set_property("max-size-buffers", 0u32);
|
||||
state.transcriber_queue.set_property("max-size-time", 0u64);
|
||||
|
||||
state.internal_bin.add(&state.transcription_bin)?;
|
||||
|
||||
state.textwrap.set_property("lines", 2u32).unwrap();
|
||||
state.textwrap.set_property("lines", 2u32);
|
||||
|
||||
state.transcription_bin.set_locked_state(true);
|
||||
|
||||
|
@ -208,8 +204,7 @@ impl TranscriberBin {
|
|||
|
||||
state
|
||||
.cccombiner
|
||||
.set_property("latency", 100 * gst::ClockTime::MSECOND)
|
||||
.unwrap();
|
||||
.set_property("latency", 100 * gst::ClockTime::MSECOND);
|
||||
|
||||
self.audio_sinkpad
|
||||
.set_target(Some(&state.internal_bin.static_pad("audio_sink").unwrap()))?;
|
||||
|
@ -234,21 +229,18 @@ impl TranscriberBin {
|
|||
|
||||
s.set("framerate", &state.framerate.unwrap());
|
||||
|
||||
state.cccapsfilter.set_property("caps", &cc_caps).unwrap();
|
||||
state.cccapsfilter.set_property("caps", &cc_caps);
|
||||
|
||||
let max_size_time = settings.latency + settings.accumulate_time;
|
||||
|
||||
for queue in &[&state.audio_queue_passthrough, &state.video_queue] {
|
||||
queue.set_property("max-size-bytes", 0u32).unwrap();
|
||||
queue.set_property("max-size-buffers", 0u32).unwrap();
|
||||
queue.set_property("max-size-time", max_size_time).unwrap();
|
||||
queue.set_property("max-size-bytes", 0u32);
|
||||
queue.set_property("max-size-buffers", 0u32);
|
||||
queue.set_property("max-size-time", max_size_time);
|
||||
}
|
||||
|
||||
let latency_ms = settings.latency.mseconds() as u32;
|
||||
state
|
||||
.transcriber
|
||||
.set_property("latency", latency_ms)
|
||||
.unwrap();
|
||||
state.transcriber.set_property("latency", latency_ms);
|
||||
|
||||
if !settings.passthrough {
|
||||
let audio_tee_pad = state.audio_tee.request_pad_simple("src_%u").unwrap();
|
||||
|
@ -349,20 +341,16 @@ impl TranscriberBin {
|
|||
|
||||
gst_debug!(CAT, obj: element, "setting CC mode {:?}", mode);
|
||||
|
||||
state.tttocea608.set_property("mode", mode).unwrap();
|
||||
state.tttocea608.set_property("mode", mode);
|
||||
|
||||
if mode.is_rollup() {
|
||||
state
|
||||
.textwrap
|
||||
.set_property("accumulate-time", 0u64)
|
||||
.unwrap();
|
||||
state.textwrap.set_property("accumulate-time", 0u64);
|
||||
} else {
|
||||
let accumulate_time = self.settings.lock().unwrap().accumulate_time;
|
||||
|
||||
state
|
||||
.textwrap
|
||||
.set_property("accumulate-time", accumulate_time)
|
||||
.unwrap();
|
||||
.set_property("accumulate-time", accumulate_time);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,10 +71,7 @@ fn test_have_cc_data_notify() {
|
|||
let mut h = gst_check::Harness::new("ccdetect");
|
||||
h.set_src_caps_str("closedcaption/x-cea-708,format=cc_data");
|
||||
h.set_sink_caps_str("closedcaption/x-cea-708,format=cc_data");
|
||||
h.element()
|
||||
.unwrap()
|
||||
.set_property("window", 500_000_000u64)
|
||||
.unwrap();
|
||||
h.element().unwrap().set_property("window", 500_000_000u64);
|
||||
|
||||
let state = Arc::new(Mutex::new(NotifyState::default()));
|
||||
let state_c = state.clone();
|
||||
|
@ -83,7 +80,7 @@ fn test_have_cc_data_notify() {
|
|||
.connect_notify(Some("cc608"), move |o, _pspec| {
|
||||
let mut state_guard = state_c.lock().unwrap();
|
||||
state_guard.cc608_count += 1;
|
||||
o.property("cc608").unwrap();
|
||||
o.property_value("cc608");
|
||||
});
|
||||
let state_c = state.clone();
|
||||
h.element()
|
||||
|
@ -91,7 +88,7 @@ fn test_have_cc_data_notify() {
|
|||
.connect_notify(Some("cc708"), move |o, _pspec| {
|
||||
let mut state_guard = state_c.lock().unwrap();
|
||||
state_guard.cc708_count += 1;
|
||||
o.property("cc708").unwrap();
|
||||
o.property_value("cc708");
|
||||
});
|
||||
|
||||
/* valid cc608 data moves cc608 property to true */
|
||||
|
@ -137,10 +134,7 @@ fn test_cc_data_window() {
|
|||
let mut h = gst_check::Harness::new("ccdetect");
|
||||
h.set_src_caps_str("closedcaption/x-cea-708,format=cc_data");
|
||||
h.set_sink_caps_str("closedcaption/x-cea-708,format=cc_data");
|
||||
h.element()
|
||||
.unwrap()
|
||||
.set_property("window", 500_000_000u64)
|
||||
.unwrap();
|
||||
h.element().unwrap().set_property("window", 500_000_000u64);
|
||||
|
||||
let state = Arc::new(Mutex::new(NotifyState::default()));
|
||||
let state_c = state.clone();
|
||||
|
@ -236,10 +230,7 @@ fn test_have_cdp_notify() {
|
|||
let mut h = gst_check::Harness::new("ccdetect");
|
||||
h.set_src_caps_str("closedcaption/x-cea-708,format=cdp");
|
||||
h.set_sink_caps_str("closedcaption/x-cea-708,format=cdp");
|
||||
h.element()
|
||||
.unwrap()
|
||||
.set_property("window", 500_000_000u64)
|
||||
.unwrap();
|
||||
h.element().unwrap().set_property("window", 500_000_000u64);
|
||||
|
||||
let state = Arc::new(Mutex::new(NotifyState::default()));
|
||||
let state_c = state.clone();
|
||||
|
@ -307,7 +298,7 @@ fn test_malformed_cdp_notify() {
|
|||
let mut h = gst_check::Harness::new("ccdetect");
|
||||
h.set_src_caps_str("closedcaption/x-cea-708,format=cdp");
|
||||
h.set_sink_caps_str("closedcaption/x-cea-708,format=cdp");
|
||||
h.element().unwrap().set_property("window", 0u64).unwrap();
|
||||
h.element().unwrap().set_property("window", 0u64);
|
||||
|
||||
let state = Arc::new(Mutex::new(NotifyState::default()));
|
||||
let state_c = state.clone();
|
||||
|
@ -386,10 +377,7 @@ fn test_gap_events() {
|
|||
let mut h = gst_check::Harness::new("ccdetect");
|
||||
h.set_src_caps_str("closedcaption/x-cea-708,format=cc_data");
|
||||
h.set_sink_caps_str("closedcaption/x-cea-708,format=cc_data");
|
||||
h.element()
|
||||
.unwrap()
|
||||
.set_property("window", 500_000_000u64)
|
||||
.unwrap();
|
||||
h.element().unwrap().set_property("window", 500_000_000u64);
|
||||
|
||||
let state = Arc::new(Mutex::new(NotifyState::default()));
|
||||
let state_c = state.clone();
|
||||
|
|
|
@ -93,13 +93,11 @@ Time Code Rate=30DF\r\n\
|
|||
let mut h = gst_check::Harness::new("mccenc");
|
||||
{
|
||||
let enc = h.element().expect("could not create encoder");
|
||||
enc.set_property("uuid", "14720C04-857D-40E2-86FC-F080DE44CE74")
|
||||
.unwrap();
|
||||
enc.set_property("uuid", "14720C04-857D-40E2-86FC-F080DE44CE74");
|
||||
enc.set_property(
|
||||
"creation-date",
|
||||
glib::DateTime::new_utc(2018, 12, 27, 17, 34, 47.0).unwrap(),
|
||||
)
|
||||
.unwrap();
|
||||
);
|
||||
}
|
||||
|
||||
h.set_src_caps_str(
|
||||
|
|
|
@ -10,14 +10,10 @@ fn create_ui(app: >k::Application) {
|
|||
let src = gst::ElementFactory::make("videotestsrc", None).unwrap();
|
||||
|
||||
let overlay = gst::ElementFactory::make("clockoverlay", None).unwrap();
|
||||
overlay.set_property("font-desc", "Monospace 42").unwrap();
|
||||
overlay.set_property("font-desc", "Monospace 42");
|
||||
|
||||
let sink = gst::ElementFactory::make("gtk4paintablesink", None).unwrap();
|
||||
let paintable = sink
|
||||
.property("paintable")
|
||||
.unwrap()
|
||||
.get::<gdk::Paintable>()
|
||||
.unwrap();
|
||||
let paintable = sink.property::<gdk::Paintable>("paintable");
|
||||
|
||||
pipeline.add_many(&[&src, &overlay, &sink]).unwrap();
|
||||
src.link_filtered(
|
||||
|
|
|
@ -121,7 +121,7 @@ fn test_encode(video_info: &gst_video::VideoInfo) {
|
|||
let mut h = gst_check::Harness::new("rav1enc");
|
||||
{
|
||||
let rav1enc = h.element().unwrap();
|
||||
rav1enc.set_property("speed-preset", 10u32).unwrap();
|
||||
rav1enc.set_property("speed-preset", 10u32);
|
||||
}
|
||||
h.play();
|
||||
h.set_src_caps(video_info.to_caps().unwrap());
|
||||
|
|
Loading…
Reference in a new issue