diff --git a/audio/audiofx/tests/audioloudnorm.rs b/audio/audiofx/tests/audioloudnorm.rs index 3540c9f9..2e6973ed 100644 --- a/audio/audiofx/tests/audioloudnorm.rs +++ b/audio/audiofx/tests/audioloudnorm.rs @@ -66,7 +66,7 @@ fn run_test( .downcast::() .unwrap(); - sink.set_property("sync", false); + sink.set_sync(false); let caps = gst_audio::AudioInfo::builder(gst_audio::AUDIO_FORMAT_F64, 192_000, channels) .build() .unwrap() diff --git a/audio/csound/examples/effect_example.rs b/audio/csound/examples/effect_example.rs index a681f2c0..f1e8355f 100644 --- a/audio/csound/examples/effect_example.rs +++ b/audio/csound/examples/effect_example.rs @@ -73,7 +73,7 @@ const CSD: &str = " "; fn create_pipeline() -> Result> { - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let audio_src = gst::parse_bin_from_description(AUDIO_SRC, true)?.upcast(); diff --git a/generic/fmp4/examples/hls_live.rs b/generic/fmp4/examples/hls_live.rs index f9459325..f1d9ed6d 100644 --- a/generic/fmp4/examples/hls_live.rs +++ b/generic/fmp4/examples/hls_live.rs @@ -234,8 +234,6 @@ fn setup_appsink(appsink: &gst_app::AppSink, name: &str, path: &Path, is_video: segment_index: 0, })); - appsink.set_buffer_list(true); - appsink.set_callbacks( gst_app::AppSinkCallbacks::builder() .new_sample(move |sink| { @@ -395,20 +393,37 @@ impl VideoStream { .property("is-live", true) .build()?; - let raw_capsfilter = gst::ElementFactory::make("capsfilter").build()?; + let raw_capsfilter = gst::ElementFactory::make("capsfilter") + .property( + "caps", + gst_video::VideoCapsBuilder::new() + .format(gst_video::VideoFormat::I420) + .width(self.width as i32) + .height(self.height as i32) + .framerate(30.into()) + .build(), + ) + .build()?; let timeoverlay = gst::ElementFactory::make("timeoverlay").build()?; let enc = gst::ElementFactory::make("x264enc") .property("bframes", 0u32) .property("bitrate", self.bitrate as u32 / 1000u32) .property_from_str("tune", "zerolatency") .build()?; - let h264_capsfilter = gst::ElementFactory::make("capsfilter").build()?; + let h264_capsfilter = gst::ElementFactory::make("capsfilter") + .property( + "caps", + gst::Caps::builder("video/x-h264") + .field("profile", "main") + .build(), + ) + .build()?; let mux = gst::ElementFactory::make("cmafmux") .property("fragment-duration", 2500.mseconds()) .property_from_str("header-update-mode", "update") .property("write-mehd", true) .build()?; - let appsink = gst::ElementFactory::make("appsink").build()?; + let appsink = gst_app::AppSink::builder().buffer_list(true).build(); pipeline.add_many(&[ &src, @@ -417,26 +432,9 @@ impl VideoStream { &enc, &h264_capsfilter, &mux, - &appsink, + appsink.upcast_ref(), ])?; - raw_capsfilter.set_property( - "caps", - gst_video::VideoCapsBuilder::new() - .format(gst_video::VideoFormat::I420) - .width(self.width as i32) - .height(self.height as i32) - .framerate(30.into()) - .build(), - ); - - h264_capsfilter.set_property( - "caps", - gst::Caps::builder("video/x-h264") - .field("profile", "main") - .build(), - ); - gst::Element::link_many(&[ &src, &raw_capsfilter, @@ -444,13 +442,11 @@ impl VideoStream { &enc, &h264_capsfilter, &mux, - &appsink, + appsink.upcast_ref(), ])?; probe_encoder(state, enc); - let appsink = appsink.downcast::().unwrap(); - setup_appsink(&appsink, &self.name, path, true); Ok(()) @@ -474,16 +470,14 @@ impl AudioStream { .property_from_str("header-update-mode", "update") .property("write-mehd", true) .build()?; - let appsink = gst::ElementFactory::make("appsink").build()?; + let appsink = gst_app::AppSink::builder().buffer_list(true).build(); - pipeline.add_many(&[&src, &enc, &mux, &appsink])?; + pipeline.add_many(&[&src, &enc, &mux, appsink.upcast_ref()])?; - gst::Element::link_many(&[&src, &enc, &mux, &appsink])?; + gst::Element::link_many(&[&src, &enc, &mux, appsink.upcast_ref()])?; probe_encoder(state, enc); - let appsink = appsink.downcast::().unwrap(); - setup_appsink(&appsink, &self.name, path, false); Ok(()) @@ -497,7 +491,7 @@ fn main() -> Result<(), Error> { let path = PathBuf::from("hls_live_stream"); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); std::fs::create_dir_all(&path).expect("failed to create directory"); diff --git a/generic/fmp4/examples/hls_vod.rs b/generic/fmp4/examples/hls_vod.rs index 50a164a4..4a2533cd 100644 --- a/generic/fmp4/examples/hls_vod.rs +++ b/generic/fmp4/examples/hls_vod.rs @@ -136,8 +136,6 @@ fn setup_appsink(appsink: &gst_app::AppSink, name: &str, path: &Path, is_video: path, })); - appsink.set_buffer_list(true); - let state_clone = state.clone(); appsink.set_callbacks( gst_app::AppSinkCallbacks::builder() @@ -289,19 +287,36 @@ impl VideoStream { let src = gst::ElementFactory::make("videotestsrc") .property("num-buffers", 300) .build()?; - let raw_capsfilter = gst::ElementFactory::make("capsfilter").build()?; + let raw_capsfilter = gst::ElementFactory::make("capsfilter") + .property( + "caps", + gst_video::VideoCapsBuilder::new() + .format(gst_video::VideoFormat::I420) + .width(self.width as i32) + .height(self.height as i32) + .framerate(30.into()) + .build(), + ) + .build()?; let timeoverlay = gst::ElementFactory::make("timeoverlay").build()?; let enc = gst::ElementFactory::make("x264enc") .property("bframes", 0u32) .property("bitrate", self.bitrate as u32 / 1000u32) .build()?; - let h264_capsfilter = gst::ElementFactory::make("capsfilter").build()?; + let h264_capsfilter = gst::ElementFactory::make("capsfilter") + .property( + "caps", + gst::Caps::builder("video/x-h264") + .field("profile", "main") + .build(), + ) + .build()?; let mux = gst::ElementFactory::make("cmafmux") .property("fragment-duration", 2500.mseconds()) .property_from_str("header-update-mode", "update") .property("write-mehd", true) .build()?; - let appsink = gst::ElementFactory::make("appsink").build()?; + let appsink = gst_app::AppSink::builder().buffer_list(true).build(); pipeline.add_many(&[ &src, @@ -310,7 +325,7 @@ impl VideoStream { &enc, &h264_capsfilter, &mux, - &appsink, + appsink.upcast_ref(), ])?; gst::Element::link_many(&[ @@ -320,30 +335,11 @@ impl VideoStream { &enc, &h264_capsfilter, &mux, - &appsink, + appsink.upcast_ref(), ])?; - raw_capsfilter.set_property( - "caps", - gst_video::VideoCapsBuilder::new() - .format(gst_video::VideoFormat::I420) - .width(self.width as i32) - .height(self.height as i32) - .framerate(30.into()) - .build(), - ); - - h264_capsfilter.set_property( - "caps", - gst::Caps::builder("video/x-h264") - .field("profile", "main") - .build(), - ); - probe_encoder(state, enc); - let appsink = appsink.downcast::().unwrap(); - setup_appsink(&appsink, &self.name, path, true); Ok(()) @@ -362,28 +358,26 @@ impl AudioStream { .property("samplesperbuffer", 4410) .property_from_str("wave", &self.wave) .build()?; - let raw_capsfilter = gst::ElementFactory::make("capsfilter").build()?; + let raw_capsfilter = gst::ElementFactory::make("capsfilter") + .property( + "caps", + gst_audio::AudioCapsBuilder::new().rate(44100).build(), + ) + .build()?; let enc = gst::ElementFactory::make("avenc_aac").build()?; let mux = gst::ElementFactory::make("cmafmux") .property("fragment-duration", 2500.mseconds()) .property_from_str("header-update-mode", "update") .property("write-mehd", true) .build()?; - let appsink = gst::ElementFactory::make("appsink").build()?; + let appsink = gst_app::AppSink::builder().buffer_list(true).build(); - pipeline.add_many(&[&src, &raw_capsfilter, &enc, &mux, &appsink])?; + pipeline.add_many(&[&src, &raw_capsfilter, &enc, &mux, appsink.upcast_ref()])?; - gst::Element::link_many(&[&src, &raw_capsfilter, &enc, &mux, &appsink])?; - - raw_capsfilter.set_property( - "caps", - gst_audio::AudioCapsBuilder::new().rate(44100).build(), - ); + gst::Element::link_many(&[&src, &raw_capsfilter, &enc, &mux, appsink.upcast_ref()])?; probe_encoder(state, enc); - let appsink = appsink.downcast::().unwrap(); - setup_appsink(&appsink, &self.name, path, false); Ok(()) @@ -397,7 +391,7 @@ fn main() -> Result<(), Error> { let path = PathBuf::from("hls_vod_stream"); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); std::fs::create_dir_all(&path).expect("failed to create directory"); diff --git a/generic/sodium/examples/decrypt_example.rs b/generic/sodium/examples/decrypt_example.rs index 1da10de1..301c5443 100644 --- a/generic/sodium/examples/decrypt_example.rs +++ b/generic/sodium/examples/decrypt_example.rs @@ -100,7 +100,7 @@ fn main() -> Result<(), Box> { .build() .unwrap(); - let pipeline = gst::Pipeline::new(Some("test-pipeline")); + let pipeline = gst::Pipeline::builder().name("test-pipeline").build(); pipeline .add_many(&[&filesrc, &decrypter, &typefind, &filesink]) .expect("failed to add elements to the pipeline"); diff --git a/generic/sodium/examples/encrypt_example.rs b/generic/sodium/examples/encrypt_example.rs index ff578b0d..8a110a6d 100644 --- a/generic/sodium/examples/encrypt_example.rs +++ b/generic/sodium/examples/encrypt_example.rs @@ -103,7 +103,7 @@ fn main() -> Result<(), Box> { .build() .unwrap(); - let pipeline = gst::Pipeline::new(Some("test-pipeline")); + let pipeline = gst::Pipeline::builder().name("test-pipeline").build(); pipeline .add_many(&[&filesrc, &encrypter, &filesink]) .expect("failed to add elements to the pipeline"); diff --git a/generic/sodium/tests/decrypter.rs b/generic/sodium/tests/decrypter.rs index a489d188..2e779cda 100644 --- a/generic/sodium/tests/decrypter.rs +++ b/generic/sodium/tests/decrypter.rs @@ -61,7 +61,9 @@ fn init() { fn test_pipeline() { init(); - let pipeline = gst::Pipeline::new(Some("sodium-decrypter-test")); + let pipeline = gst::Pipeline::builder() + .name("sodium-decrypter-test") + .build(); let input_path = { let mut r = PathBuf::new(); @@ -86,17 +88,16 @@ fn test_pipeline() { // the typefind element here is cause the decrypter only supports // operating in pull mode bu the filesink wants push-mode. let typefind = gst::ElementFactory::make("typefind").build().unwrap(); - let sink = gst::ElementFactory::make("appsink").build().unwrap(); + let sink = gst_app::AppSink::builder().build(); pipeline - .add_many(&[&filesrc, &dec, &typefind, &sink]) + .add_many(&[&filesrc, &dec, &typefind, sink.upcast_ref()]) .expect("failed to add elements to the pipeline"); - gst::Element::link_many(&[&filesrc, &dec, &typefind, &sink]) + gst::Element::link_many(&[&filesrc, &dec, &typefind, sink.upcast_ref()]) .expect("failed to link the elements"); let adapter = Arc::new(Mutex::new(gst_base::UniqueAdapter::new())); - let sink = sink.downcast::().unwrap(); let adapter_clone = adapter.clone(); sink.set_callbacks( gst_app::AppSinkCallbacks::builder() @@ -154,7 +155,9 @@ fn test_pipeline() { fn test_pull_range() { init(); - let pipeline = gst::Pipeline::new(Some("sodium-decrypter-pull-range-test")); + let pipeline = gst::Pipeline::builder() + .name("sodium-decrypter-pull-range-test") + .build(); let input_path = { let mut r = PathBuf::new(); r.push(env!("CARGO_MANIFEST_DIR")); diff --git a/generic/threadshare/examples/benchmark.rs b/generic/threadshare/examples/benchmark.rs index 4fb5c0c5..2080b777 100644 --- a/generic/threadshare/examples/benchmark.rs +++ b/generic/threadshare/examples/benchmark.rs @@ -71,7 +71,7 @@ fn main() { .build(); let l = glib::MainLoop::new(None, false); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let counter = Arc::new(AtomicU64::new(0)); for i in 0..n_streams { diff --git a/generic/threadshare/examples/standalone/main.rs b/generic/threadshare/examples/standalone/main.rs index 23f60279..a033ef5a 100644 --- a/generic/threadshare/examples/standalone/main.rs +++ b/generic/threadshare/examples/standalone/main.rs @@ -128,7 +128,7 @@ fn main() { let args = args(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); for i in 0..args.streams { let ctx_name = format!("standalone {}", i % args.groups); diff --git a/generic/threadshare/examples/udpsrc_benchmark_sender.rs b/generic/threadshare/examples/udpsrc_benchmark_sender.rs index 5dfbf523..196662ac 100644 --- a/generic/threadshare/examples/udpsrc_benchmark_sender.rs +++ b/generic/threadshare/examples/udpsrc_benchmark_sender.rs @@ -90,7 +90,7 @@ fn send_rtp_buffers(n_streams: u16) { } let l = glib::MainLoop::new(None, false); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); for i in 0..n_streams { let src = gst::ElementFactory::make("audiotestsrc") .name(format!("audiotestsrc-{}", i).as_str()) diff --git a/generic/threadshare/tests/jitterbuffer.rs b/generic/threadshare/tests/jitterbuffer.rs index 2904384b..687ce5f8 100644 --- a/generic/threadshare/tests/jitterbuffer.rs +++ b/generic/threadshare/tests/jitterbuffer.rs @@ -49,7 +49,7 @@ fn jb_pipeline() { const LATENCY: u32 = 20; const BUFFER_NB: i32 = 3; - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let src = gst::ElementFactory::make("audiotestsrc") .name("audiotestsrc") @@ -84,21 +84,19 @@ fn jb_pipeline() { .build() .unwrap(); - let sink = gst::ElementFactory::make("appsink") + let sink = gst_app::AppSink::builder() .name("appsink") - .property("sync", false) - .property("async", false) - .build() - .unwrap(); + .sync(false) + .async_(false) + .build(); pipeline - .add_many(&[&src, &enc, &pay, &jb, &depay, &dec, &sink]) + .add_many(&[&src, &enc, &pay, &jb, &depay, &dec, sink.upcast_ref()]) .unwrap(); - gst::Element::link_many(&[&src, &enc, &pay, &jb, &depay, &dec, &sink]).unwrap(); + gst::Element::link_many(&[&src, &enc, &pay, &jb, &depay, &dec, sink.upcast_ref()]).unwrap(); - let appsink = sink.dynamic_cast::().unwrap(); let (sender, receiver) = mpsc::channel(); - appsink.set_callbacks( + sink.set_callbacks( gst_app::AppSinkCallbacks::builder() .new_sample(move |appsink| { let _sample = appsink.pull_sample().unwrap(); @@ -128,7 +126,7 @@ fn jb_ts_pipeline() { const LATENCY: u32 = 20; const BUFFER_NB: i32 = 3; - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let src = gst::ElementFactory::make("audiotestsrc") .name("audiotestsrc") @@ -170,21 +168,38 @@ fn jb_ts_pipeline() { .build() .unwrap(); - let sink = gst::ElementFactory::make("appsink") + let sink = gst_app::AppSink::builder() .name("appsink") - .property("sync", false) - .property("async", false) - .build() - .unwrap(); + .sync(false) + .async_(false) + .build(); pipeline - .add_many(&[&src, &queue, &enc, &pay, &jb, &depay, &dec, &sink]) + .add_many(&[ + &src, + &queue, + &enc, + &pay, + &jb, + &depay, + &dec, + sink.upcast_ref(), + ]) .unwrap(); - gst::Element::link_many(&[&src, &queue, &enc, &pay, &jb, &depay, &dec, &sink]).unwrap(); + gst::Element::link_many(&[ + &src, + &queue, + &enc, + &pay, + &jb, + &depay, + &dec, + sink.upcast_ref(), + ]) + .unwrap(); - let appsink = sink.dynamic_cast::().unwrap(); let (sender, receiver) = mpsc::channel(); - appsink.set_callbacks( + sink.set_callbacks( gst_app::AppSinkCallbacks::builder() .new_sample(move |appsink| { let _sample = appsink.pull_sample().unwrap(); diff --git a/generic/threadshare/tests/pad.rs b/generic/threadshare/tests/pad.rs index e293a2d3..fb7a3bfa 100644 --- a/generic/threadshare/tests/pad.rs +++ b/generic/threadshare/tests/pad.rs @@ -693,7 +693,7 @@ fn setup( ) { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); // Src let src_element = glib::Object::new::(&[]); diff --git a/generic/threadshare/tests/pipeline.rs b/generic/threadshare/tests/pipeline.rs index 137d4dc4..3b8ea46d 100644 --- a/generic/threadshare/tests/pipeline.rs +++ b/generic/threadshare/tests/pipeline.rs @@ -58,7 +58,7 @@ fn multiple_contexts_queue() { const FIRST_PORT: u16 = 40000; let l = glib::MainLoop::new(None, false); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let (sender, receiver) = mpsc::channel(); @@ -78,19 +78,19 @@ fn multiple_contexts_queue() { .build() .unwrap(); - let sink = gst::ElementFactory::make("appsink") + let sink = gst_app::AppSink::builder() .name(format!("sink-{}", i).as_str()) - .property("sync", false) - .property("async", false) - .build() + .sync(false) + .async_(false) + .build(); + + pipeline + .add_many(&[&src, &queue, sink.upcast_ref()]) .unwrap(); + gst::Element::link_many(&[&src, &queue, sink.upcast_ref()]).unwrap(); - pipeline.add_many(&[&src, &queue, &sink]).unwrap(); - gst::Element::link_many(&[&src, &queue, &sink]).unwrap(); - - let appsink = sink.dynamic_cast::().unwrap(); let sender_clone = sender.clone(); - appsink.set_callbacks( + sink.set_callbacks( gst_app::AppSinkCallbacks::builder() .new_sample(move |appsink| { let _sample = appsink.pull_sample().unwrap(); @@ -192,7 +192,7 @@ fn multiple_contexts_proxy() { const FIRST_PORT: u16 = 40000 + OFFSET; let l = glib::MainLoop::new(None, false); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let (sender, receiver) = mpsc::channel(); @@ -223,22 +223,20 @@ fn multiple_contexts_proxy() { .build() .unwrap(); - let sink = gst::ElementFactory::make("appsink") + let sink = gst_app::AppSink::builder() .name(format!("sink-{}", pipeline_index).as_str()) - .property("sync", false) - .property("async", false) - .build() - .unwrap(); + .sync(false) + .async_(false) + .build(); pipeline - .add_many(&[&src, &proxysink, &proxysrc, &sink]) + .add_many(&[&src, &proxysink, &proxysrc, sink.upcast_ref()]) .unwrap(); src.link(&proxysink).unwrap(); proxysrc.link(&sink).unwrap(); - let appsink = sink.dynamic_cast::().unwrap(); let sender_clone = sender.clone(); - appsink.set_callbacks( + sink.set_callbacks( gst_app::AppSinkCallbacks::builder() .new_sample(move |appsink| { let _sample = appsink.pull_sample().unwrap(); @@ -330,7 +328,7 @@ fn eos() { init(); let l = glib::MainLoop::new(None, false); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let caps = gst::Caps::builder("foo/bar").build(); @@ -348,20 +346,20 @@ fn eos() { .build() .unwrap(); - let appsink = gst::ElementFactory::make("appsink") + let sink = gst_app::AppSink::builder() .name("sink-eos") - .property("sync", false) - .property("async", false) - .build() - .unwrap(); + .sync(false) + .async_(false) + .build(); - pipeline.add_many(&[&src, &queue, &appsink]).unwrap(); - gst::Element::link_many(&[&src, &queue, &appsink]).unwrap(); + pipeline + .add_many(&[&src, &queue, sink.upcast_ref()]) + .unwrap(); + gst::Element::link_many(&[&src, &queue, sink.upcast_ref()]).unwrap(); let (sample_notifier, sample_notif_rcv) = mpsc::channel(); let (eos_notifier, eos_notif_rcv) = mpsc::channel(); - let appsink = appsink.dynamic_cast::().unwrap(); - appsink.set_callbacks( + sink.set_callbacks( gst_app::AppSinkCallbacks::builder() .new_sample(move |appsink| { gst::debug!(CAT, obj: appsink, "eos: pulling sample"); @@ -461,7 +459,7 @@ fn premature_shutdown() { const QUEUE_ITEMS_CAPACITY: u32 = 1; let l = glib::MainLoop::new(None, false); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let caps = gst::Caps::builder("foo/bar").build(); @@ -482,20 +480,20 @@ fn premature_shutdown() { .build() .unwrap(); - let appsink = gst::ElementFactory::make("appsink") + let sink = gst_app::AppSink::builder() .name("sink-ps") - .property("sync", false) - .property("async", false) - .build() - .unwrap(); + .sync(false) + .async_(false) + .build(); - pipeline.add_many(&[&src, &queue, &appsink]).unwrap(); - gst::Element::link_many(&[&src, &queue, &appsink]).unwrap(); + pipeline + .add_many(&[&src, &queue, sink.upcast_ref()]) + .unwrap(); + gst::Element::link_many(&[&src, &queue, sink.upcast_ref()]).unwrap(); let (appsink_sender, appsink_receiver) = mpsc::channel(); - let appsink = appsink.dynamic_cast::().unwrap(); - appsink.set_callbacks( + sink.set_callbacks( gst_app::AppSinkCallbacks::builder() .new_sample(move |appsink| { gst::debug!(CAT, obj: appsink, "premature_shutdown: pulling sample"); @@ -620,7 +618,7 @@ fn socket_play_null_play() { init(); let l = glib::MainLoop::new(None, false); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let socket = gio::Socket::new( SocketFamily::Ipv4, diff --git a/generic/threadshare/tests/proxy.rs b/generic/threadshare/tests/proxy.rs index 5b68a869..49eb64e6 100644 --- a/generic/threadshare/tests/proxy.rs +++ b/generic/threadshare/tests/proxy.rs @@ -35,7 +35,7 @@ fn init() { fn test_push() { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let fakesrc = gst::ElementFactory::make("fakesrc") .property("num-buffers", 3i32) .build() @@ -51,17 +51,16 @@ fn test_push() { .property("context", "proxy::test") .build() .unwrap(); - let appsink = gst::ElementFactory::make("appsink").build().unwrap(); + let appsink = gst_app::AppSink::builder().build(); pipeline - .add_many(&[&fakesrc, &proxysink, &proxysrc, &appsink]) + .add_many(&[&fakesrc, &proxysink, &proxysrc, appsink.upcast_ref()]) .unwrap(); fakesrc.link(&proxysink).unwrap(); proxysrc.link(&appsink).unwrap(); let samples = Arc::new(Mutex::new(Vec::new())); - let appsink = appsink.dynamic_cast::().unwrap(); let samples_clone = samples.clone(); appsink.set_callbacks( gst_app::AppSinkCallbacks::builder() @@ -106,7 +105,7 @@ fn test_push() { fn test_from_pipeline_to_pipeline() { init(); - let pipe_1 = gst::Pipeline::new(None); + let pipe_1 = gst::Pipeline::default(); let fakesrc = gst::ElementFactory::make("fakesrc").build().unwrap(); let pxsink = gst::ElementFactory::make("ts-proxysink") .name("proxysink::test2") @@ -114,7 +113,7 @@ fn test_from_pipeline_to_pipeline() { .build() .unwrap(); - let pipe_2 = gst::Pipeline::new(None); + let pipe_2 = gst::Pipeline::default(); let pxsrc = gst::ElementFactory::make("ts-proxysrc") .name("proxysrc::test2") .property("proxy-context", "proxy::test2_proxy") @@ -144,7 +143,7 @@ fn test_from_pipeline_to_pipeline() { fn test_from_pipeline_to_pipeline_and_back() { init(); - let pipe_1 = gst::Pipeline::new(None); + let pipe_1 = gst::Pipeline::default(); let pxsrc_1 = gst::ElementFactory::make("ts-proxysrc") .name("proxysrc1::test3") .property("proxy-context", "proxy::test3_proxy1") @@ -157,7 +156,7 @@ fn test_from_pipeline_to_pipeline_and_back() { .build() .unwrap(); - let pipe_2 = gst::Pipeline::new(None); + let pipe_2 = gst::Pipeline::default(); let pxsrc_2 = gst::ElementFactory::make("ts-proxysrc") .name("proxysrc2::test3") .property("proxy-context", "proxy::test3_proxy2") diff --git a/generic/threadshare/tests/queue.rs b/generic/threadshare/tests/queue.rs index 682f7175..321f3cd5 100644 --- a/generic/threadshare/tests/queue.rs +++ b/generic/threadshare/tests/queue.rs @@ -35,21 +35,22 @@ fn init() { fn test_push() { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let fakesrc = gst::ElementFactory::make("fakesrc") .property("num-buffers", 3i32) .build() .unwrap(); let queue = gst::ElementFactory::make("ts-queue").build().unwrap(); - let appsink = gst::ElementFactory::make("appsink").build().unwrap(); + let appsink = gst_app::AppSink::builder().build(); - pipeline.add_many(&[&fakesrc, &queue, &appsink]).unwrap(); + pipeline + .add_many(&[&fakesrc, &queue, appsink.upcast_ref()]) + .unwrap(); fakesrc.link(&queue).unwrap(); queue.link(&appsink).unwrap(); let samples = Arc::new(Mutex::new(Vec::new())); - let appsink = appsink.dynamic_cast::().unwrap(); let samples_clone = samples.clone(); appsink.set_callbacks( gst_app::AppSinkCallbacks::builder() diff --git a/generic/threadshare/tests/tcpclientsrc.rs b/generic/threadshare/tests/tcpclientsrc.rs index 3ad1330d..f8b8c2f2 100644 --- a/generic/threadshare/tests/tcpclientsrc.rs +++ b/generic/threadshare/tests/tcpclientsrc.rs @@ -54,7 +54,7 @@ fn test_push() { } }); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let caps = gst::Caps::builder("foo/bar").build(); let tcpclientsrc = gst::ElementFactory::make("ts-tcpclientsrc") @@ -62,18 +62,18 @@ fn test_push() { .property("port", 5000i32) .build() .unwrap(); - let appsink = gst::ElementFactory::make("appsink") - .property("sync", false) - .property("async", false) - .build() - .unwrap(); + let appsink = gst_app::AppSink::builder() + .sync(false) + .async_(false) + .build(); - pipeline.add_many(&[&tcpclientsrc, &appsink]).unwrap(); + pipeline + .add_many(&[&tcpclientsrc, appsink.upcast_ref()]) + .unwrap(); tcpclientsrc.link(&appsink).unwrap(); let samples = Arc::new(Mutex::new(Vec::new())); - let appsink = appsink.dynamic_cast::().unwrap(); let samples_clone = samples.clone(); appsink.set_callbacks( gst_app::AppSinkCallbacks::builder() diff --git a/net/hlssink3/tests/hlssink3.rs b/net/hlssink3/tests/hlssink3.rs index b945adc3..e218b636 100644 --- a/net/hlssink3/tests/hlssink3.rs +++ b/net/hlssink3/tests/hlssink3.rs @@ -105,7 +105,7 @@ fn test_hlssink3_element_with_video_content() -> Result<(), ()> { const BUFFER_NB: i32 = 250; - let pipeline = gst::Pipeline::new(Some("video_pipeline")); + let pipeline = gst::Pipeline::builder().name("video_pipeline").build(); let video_src = try_create_element!("videotestsrc"); video_src.set_property("is-live", true); @@ -253,7 +253,7 @@ fn test_hlssink3_element_with_audio_content() -> Result<(), ()> { const BUFFER_NB: i32 = 100; - let pipeline = gst::Pipeline::new(Some("audio_pipeline")); + let pipeline = gst::Pipeline::builder().name("audio_pipeline").build(); let audio_src = try_create_element!("audiotestsrc"); audio_src.set_property("is-live", true); @@ -316,7 +316,7 @@ fn test_hlssink3_write_correct_playlist_content() -> Result<(), ()> { const BUFFER_NB: i32 = 50; - let pipeline = gst::Pipeline::new(Some("video_pipeline")); + let pipeline = gst::Pipeline::builder().name("video_pipeline").build(); let video_src = try_create_element!("videotestsrc"); video_src.set_property("is-live", true); diff --git a/net/webrtc/src/webrtcsink/imp.rs b/net/webrtc/src/webrtcsink/imp.rs index 3d2adc42..58727984 100644 --- a/net/webrtc/src/webrtcsink/imp.rs +++ b/net/webrtc/src/webrtcsink/imp.rs @@ -312,7 +312,7 @@ fn make_converter_for_video_caps(caps: &gst::Caps) -> Result Result { - let pipe = PipelineWrapper(gst::Pipeline::new(None)); + let pipe = PipelineWrapper(gst::Pipeline::default()); let src = if codec.is_video() { make_element("videotestsrc", None)? diff --git a/utils/fallbackswitch/examples/gtk_fallbackswitch.rs b/utils/fallbackswitch/examples/gtk_fallbackswitch.rs index 82eab8b8..d5f5d8c6 100644 --- a/utils/fallbackswitch/examples/gtk_fallbackswitch.rs +++ b/utils/fallbackswitch/examples/gtk_fallbackswitch.rs @@ -23,7 +23,7 @@ const FALLBACK_PIPELINE: &str = "videotestsrc is-live=true pattern=snow"; //const FALLBACK_PIPELINE: &str = "videotestsrc is-live=true pattern=snow ! x264enc tune=zerolatency"; fn create_pipeline() -> (gst::Pipeline, gst::Pad, gst::Element) { - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let video_src = gst::parse_bin_from_description(MAIN_PIPELINE, true) .unwrap() diff --git a/utils/fallbackswitch/src/fallbacksrc/imp.rs b/utils/fallbackswitch/src/fallbacksrc/imp.rs index 0b08217b..becee9a0 100644 --- a/utils/fallbackswitch/src/fallbacksrc/imp.rs +++ b/utils/fallbackswitch/src/fallbacksrc/imp.rs @@ -893,7 +893,7 @@ impl BinImpl for FallbackSrc { impl FallbackSrc { fn create_dummy_audio_source(filter_caps: &gst::Caps, min_latency: gst::ClockTime) -> gst::Bin { - let bin = gst::Bin::new(None); + let bin = gst::Bin::default(); let audiotestsrc = gst::ElementFactory::make("audiotestsrc") .name("audiosrc") @@ -952,7 +952,7 @@ impl FallbackSrc { } fn create_dummy_video_source(filter_caps: &gst::Caps, min_latency: gst::ClockTime) -> gst::Bin { - let bin = gst::Bin::new(None); + let bin = gst::Bin::default(); let videotestsrc = gst::ElementFactory::make("videotestsrc") .name("videosrc") @@ -1011,7 +1011,7 @@ impl FallbackSrc { } fn create_main_input(&self, source: &Source, buffer_duration: i64) -> SourceBin { - let bin = gst::Bin::new(None); + let bin = gst::Bin::default(); let source = match source { Source::Uri(ref uri) => { @@ -1104,7 +1104,7 @@ impl FallbackSrc { None => return None, }; - let bin = gst::Bin::new(None); + let bin = gst::Bin::default(); bin.add(&source).unwrap(); @@ -1585,7 +1585,7 @@ impl FallbackSrc { return imagefreeze; } - let bin = gst::Bin::new(None); + let bin = gst::Bin::default(); let videoconvert = gst::ElementFactory::make("videoconvert") .name("video_videoconvert") .build() @@ -1633,7 +1633,7 @@ impl FallbackSrc { .expect("No identity found"); } - let bin = gst::Bin::new(None); + let bin = gst::Bin::default(); let videoconvert = gst::ElementFactory::make("videoconvert") .name("video_videoconvert") .build() @@ -1681,7 +1681,7 @@ impl FallbackSrc { .expect("No identity found"); } - let bin = gst::Bin::new(None); + let bin = gst::Bin::default(); let audioconvert = gst::ElementFactory::make("audioconvert") .name("audio_audioconvert") .build() diff --git a/utils/fallbackswitch/tests/fallbackswitch.rs b/utils/fallbackswitch/tests/fallbackswitch.rs index 089d725d..8257c73d 100644 --- a/utils/fallbackswitch/tests/fallbackswitch.rs +++ b/utils/fallbackswitch/tests/fallbackswitch.rs @@ -464,7 +464,7 @@ fn setup_pipeline( let clock = gst_check::TestClock::new(); clock.set_time(gst::ClockTime::ZERO); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); // Running time 0 in our pipeline is going to be clock time 1s. All // clock ids before 1s are used for signalling to our clock advancing @@ -473,23 +473,20 @@ fn setup_pipeline( pipeline.set_base_time(gst::ClockTime::SECOND); pipeline.set_start_time(gst::ClockTime::NONE); - let src = gst::ElementFactory::make("appsrc") + let src = gst_app::AppSrc::builder() .name("src") - .build() - .unwrap() - .downcast::() - .unwrap(); - src.set_is_live(true); - src.set_format(gst::Format::Time); - src.set_min_latency(LATENCY.nseconds() as i64); - src.set_caps(Some( - &gst_video::VideoCapsBuilder::new() - .format(gst_video::VideoFormat::Argb) - .width(320) - .height(240) - .framerate((0, 1).into()) - .build(), - )); + .is_live(true) + .format(gst::Format::Time) + .min_latency(LATENCY.nseconds() as i64) + .caps( + &gst_video::VideoCapsBuilder::new() + .format(gst_video::VideoFormat::Argb) + .width(320) + .height(240) + .framerate((0, 1).into()) + .build(), + ) + .build(); let switch = gst::ElementFactory::make("fallbackswitch") .name("switch") @@ -504,13 +501,7 @@ fn setup_pipeline( switch.set_property("auto-switch", auto_switch); } - let sink = gst::ElementFactory::make("appsink") - .name("sink") - .build() - .unwrap() - .downcast::() - .unwrap(); - sink.set_sync(false); + let sink = gst_app::AppSink::builder().name("sink").sync(false).build(); let queue = gst::ElementFactory::make("queue").build().unwrap(); @@ -525,23 +516,20 @@ fn setup_pipeline( sink_pad.set_property("priority", 0u32); if let Some(live) = with_live_fallback { - let fallback_src = gst::ElementFactory::make("appsrc") + let fallback_src = gst_app::AppSrc::builder() .name("fallback-src") - .build() - .unwrap() - .downcast::() - .unwrap(); - fallback_src.set_is_live(live); - fallback_src.set_format(gst::Format::Time); - fallback_src.set_min_latency(LATENCY.nseconds() as i64); - fallback_src.set_caps(Some( - &gst_video::VideoCapsBuilder::new() - .format(gst_video::VideoFormat::Argb) - .width(160) - .height(120) - .framerate((0, 1).into()) - .build(), - )); + .is_live(live) + .format(gst::Format::Time) + .min_latency(LATENCY.nseconds() as i64) + .caps( + &gst_video::VideoCapsBuilder::new() + .format(gst_video::VideoFormat::Argb) + .width(160) + .height(120) + .framerate((0, 1).into()) + .build(), + ) + .build(); pipeline.add(&fallback_src).unwrap(); diff --git a/utils/togglerecord/examples/gtk_recording.rs b/utils/togglerecord/examples/gtk_recording.rs index 5816eefd..e90241a7 100644 --- a/utils/togglerecord/examples/gtk_recording.rs +++ b/utils/togglerecord/examples/gtk_recording.rs @@ -21,7 +21,7 @@ fn create_pipeline() -> ( gst::Element, gst::Element, ) { - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let video_src = gst::ElementFactory::make("videotestsrc") .property("is-live", true) diff --git a/utils/togglerecord/tests/tests.rs b/utils/togglerecord/tests/tests.rs index e5511f5f..6836d9c6 100644 --- a/utils/togglerecord/tests/tests.rs +++ b/utils/togglerecord/tests/tests.rs @@ -275,7 +275,7 @@ fn test_create_pads() { fn test_one_stream_open() { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); pipeline.add(&togglerecord).unwrap(); @@ -307,7 +307,7 @@ fn test_one_stream_open() { fn test_one_stream_gaps_open() { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); pipeline.add(&togglerecord).unwrap(); @@ -340,7 +340,7 @@ fn test_one_stream_gaps_open() { fn test_one_stream_close_open() { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); pipeline.add(&togglerecord).unwrap(); @@ -374,7 +374,7 @@ fn test_one_stream_close_open() { fn test_one_stream_open_close() { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); pipeline.add(&togglerecord).unwrap(); @@ -409,7 +409,7 @@ fn test_one_stream_open_close() { fn test_one_stream_open_close_open() { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); pipeline.add(&togglerecord).unwrap(); @@ -453,7 +453,7 @@ fn test_one_stream_open_close_open() { fn test_two_stream_open() { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); pipeline.add(&togglerecord).unwrap(); @@ -506,7 +506,7 @@ fn test_two_stream_open() { fn test_two_stream_open_shift() { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); pipeline.add(&togglerecord).unwrap(); @@ -563,7 +563,7 @@ fn test_two_stream_open_shift() { fn test_two_stream_open_shift_main() { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); pipeline.add(&togglerecord).unwrap(); @@ -628,7 +628,7 @@ fn test_two_stream_open_shift_main() { fn test_two_stream_open_close() { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); pipeline.add(&togglerecord).unwrap(); @@ -697,7 +697,7 @@ fn test_two_stream_open_close() { fn test_two_stream_close_open() { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); pipeline.add(&togglerecord).unwrap(); @@ -766,7 +766,7 @@ fn test_two_stream_close_open() { fn test_two_stream_open_close_open() { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); pipeline.add(&togglerecord).unwrap(); @@ -860,7 +860,7 @@ fn test_two_stream_open_close_open() { fn test_two_stream_open_close_open_gaps() { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); pipeline.add(&togglerecord).unwrap(); @@ -960,7 +960,7 @@ fn test_two_stream_open_close_open_gaps() { fn test_two_stream_close_open_close_delta() { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); pipeline.add(&togglerecord).unwrap(); @@ -1049,7 +1049,7 @@ fn test_two_stream_close_open_close_delta() { fn test_three_stream_open_close_open() { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); pipeline.add(&togglerecord).unwrap(); @@ -1173,7 +1173,7 @@ fn test_three_stream_open_close_open() { fn test_two_stream_main_eos() { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); pipeline.add(&togglerecord).unwrap(); @@ -1248,7 +1248,7 @@ fn test_two_stream_main_eos() { fn test_two_stream_secondary_eos_first() { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); pipeline.add(&togglerecord).unwrap(); @@ -1316,7 +1316,7 @@ fn test_two_stream_secondary_eos_first() { fn test_three_stream_main_eos() { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); pipeline.add(&togglerecord).unwrap(); @@ -1417,7 +1417,7 @@ fn test_three_stream_main_eos() { fn test_three_stream_main_and_second_eos() { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); pipeline.add(&togglerecord).unwrap(); @@ -1518,7 +1518,7 @@ fn test_three_stream_main_and_second_eos() { fn test_three_stream_secondary_eos_first() { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); pipeline.add(&togglerecord).unwrap(); diff --git a/utils/uriplaylistbin/examples/playlist.rs b/utils/uriplaylistbin/examples/playlist.rs index 6b23a211..0f3bdfe2 100644 --- a/utils/uriplaylistbin/examples/playlist.rs +++ b/utils/uriplaylistbin/examples/playlist.rs @@ -24,7 +24,7 @@ struct Opt { } fn create_pipeline(uris: Vec, iterations: u32) -> anyhow::Result { - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let playlist = gst::ElementFactory::make("uriplaylistbin") .property("uris", &uris) .property("iterations", &iterations) diff --git a/utils/uriplaylistbin/tests/uriplaylistbin.rs b/utils/uriplaylistbin/tests/uriplaylistbin.rs index fca4fa47..3786ba6c 100644 --- a/utils/uriplaylistbin/tests/uriplaylistbin.rs +++ b/utils/uriplaylistbin/tests/uriplaylistbin.rs @@ -85,7 +85,7 @@ fn test( let uris: Vec = medias.iter().map(|t| t.uri.clone()).collect(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let playlist = gst::ElementFactory::make("uriplaylistbin") .property("uris", &uris) .property("iterations", &iterations) diff --git a/video/cdg/tests/cdgdec.rs b/video/cdg/tests/cdgdec.rs index b5e07118..7810883b 100644 --- a/video/cdg/tests/cdgdec.rs +++ b/video/cdg/tests/cdgdec.rs @@ -25,7 +25,7 @@ fn init() { fn test_cdgdec() { init(); - let pipeline = gst::Pipeline::new(Some("cdgdec-test")); + let pipeline = gst::Pipeline::builder().name("cdgdec-test").build(); let input_path = { let mut r = PathBuf::new(); @@ -50,14 +50,14 @@ fn test_cdgdec() { let parse = gst::ElementFactory::make("cdgparse").build().unwrap(); let dec = gst::ElementFactory::make("cdgdec").build().unwrap(); - let sink = gst::ElementFactory::make("appsink").build().unwrap(); + let sink = gst_app::AppSink::builder().build(); pipeline - .add_many(&[&filesrc, &parse, &dec, &sink]) + .add_many(&[&filesrc, &parse, &dec, sink.upcast_ref()]) .expect("failed to add elements to the pipeline"); - gst::Element::link_many(&[&filesrc, &parse, &dec, &sink]).expect("failed to link the elements"); + gst::Element::link_many(&[&filesrc, &parse, &dec, sink.upcast_ref()]) + .expect("failed to link the elements"); - let sink = sink.downcast::().unwrap(); sink.set_callbacks( gst_app::AppSinkCallbacks::builder() // Add a handler to the "new-sample" signal. diff --git a/video/closedcaption/src/transcriberbin/imp.rs b/video/closedcaption/src/transcriberbin/imp.rs index 5e2636ac..ef8852c7 100644 --- a/video/closedcaption/src/transcriberbin/imp.rs +++ b/video/closedcaption/src/transcriberbin/imp.rs @@ -442,8 +442,8 @@ impl TranscriberBin { } fn build_state(&self) -> Result { - let internal_bin = gst::Bin::new(Some("internal")); - let transcription_bin = gst::Bin::new(Some("transcription-bin")); + let internal_bin = gst::Bin::builder().name("internal").build(); + let transcription_bin = gst::Bin::builder().name("transcription-bin").build(); let audio_tee = gst::ElementFactory::make("tee") // Protect passthrough enable (and resulting dynamic reconfigure) // from non-streaming thread diff --git a/video/gtk4/examples/gtksink.rs b/video/gtk4/examples/gtksink.rs index 0899d480..ee2b4e2f 100644 --- a/video/gtk4/examples/gtksink.rs +++ b/video/gtk4/examples/gtksink.rs @@ -6,7 +6,7 @@ use gtk::{gdk, gio, glib}; use std::cell::RefCell; fn create_ui(app: >k::Application) { - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let src = gst::ElementFactory::make("videotestsrc").build().unwrap(); let overlay = gst::ElementFactory::make("clockoverlay") diff --git a/video/videofx/tests/colordetect.rs b/video/videofx/tests/colordetect.rs index 6b355ea4..96cea95d 100644 --- a/video/videofx/tests/colordetect.rs +++ b/video/videofx/tests/colordetect.rs @@ -21,7 +21,7 @@ fn init() { #[test] fn test_red_color() { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); let src = gst::ElementFactory::make("videotestsrc") .property_from_str("pattern", "red") diff --git a/video/videofx/tests/videocompare.rs b/video/videofx/tests/videocompare.rs index cc1ab724..ee4ec40e 100644 --- a/video/videofx/tests/videocompare.rs +++ b/video/videofx/tests/videocompare.rs @@ -60,7 +60,7 @@ fn test_can_find_similar_frames() { let max_distance = 0.0f64; - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); setup_pipeline( &pipeline, "red", @@ -106,7 +106,7 @@ fn test_can_find_similar_frames() { fn test_do_not_send_message_when_image_not_found() { init(); - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); setup_pipeline(&pipeline, "snow", "red", 0f64, HashAlgorithm::Blockhash); pipeline.set_state(gst::State::Playing).unwrap(); @@ -145,7 +145,7 @@ fn test_use_dssim_to_find_similar_frames() { let max_distance = 0.0f64; - let pipeline = gst::Pipeline::new(None); + let pipeline = gst::Pipeline::default(); setup_pipeline(&pipeline, "red", "red", max_distance, HashAlgorithm::Dssim); pipeline.set_state(gst::State::Playing).unwrap();