Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2022-10-22 19:06:29 +0300
committerSebastian Dröge <sebastian@centricular.com>2022-10-22 19:50:24 +0300
commitf058a5e2296d69456dae9a2960af79be7becfaa3 (patch)
tree3b46cc2a541b557e6b493f7b9aa36c13ff529139 /generic
parentf3546819edd26042f9d853a7f1ff7d24771f61a6 (diff)
Various minor cleanups
Diffstat (limited to 'generic')
-rw-r--r--generic/fmp4/examples/hls_live.rs58
-rw-r--r--generic/fmp4/examples/hls_vod.rs70
-rw-r--r--generic/sodium/examples/decrypt_example.rs2
-rw-r--r--generic/sodium/examples/encrypt_example.rs2
-rw-r--r--generic/sodium/tests/decrypter.rs15
-rw-r--r--generic/threadshare/examples/benchmark.rs2
-rw-r--r--generic/threadshare/examples/standalone/main.rs2
-rw-r--r--generic/threadshare/examples/udpsrc_benchmark_sender.rs2
-rw-r--r--generic/threadshare/tests/jitterbuffer.rs57
-rw-r--r--generic/threadshare/tests/pad.rs2
-rw-r--r--generic/threadshare/tests/pipeline.rs78
-rw-r--r--generic/threadshare/tests/proxy.rs15
-rw-r--r--generic/threadshare/tests/queue.rs9
-rw-r--r--generic/threadshare/tests/tcpclientsrc.rs16
14 files changed, 167 insertions, 163 deletions
diff --git a/generic/fmp4/examples/hls_live.rs b/generic/fmp4/examples/hls_live.rs
index f9459325a..f1d9ed6d1 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::<gst_app::AppSink>().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::<gst_app::AppSink>().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 50a164a4a..4a2533cd1 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::<gst_app::AppSink>().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::<gst_app::AppSink>().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 1da10de15..301c5443d 100644
--- a/generic/sodium/examples/decrypt_example.rs
+++ b/generic/sodium/examples/decrypt_example.rs
@@ -100,7 +100,7 @@ fn main() -> Result<(), Box<dyn Error>> {
.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 ff578b0d8..8a110a6d3 100644
--- a/generic/sodium/examples/encrypt_example.rs
+++ b/generic/sodium/examples/encrypt_example.rs
@@ -103,7 +103,7 @@ fn main() -> Result<(), Box<dyn Error>> {
.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 a489d188f..2e779cda9 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::<gst_app::AppSink>().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 4fb5c0c56..2080b7778 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 23f60279e..a033ef5a0 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 5dfbf523a..196662ac4 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 2904384b7..687ce5f84 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::<gst_app::AppSink>().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])
- .unwrap();
- gst::Element::link_many(&[&src, &queue, &enc, &pay, &jb, &depay, &dec, &sink]).unwrap();
+ .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.upcast_ref(),
+ ])
+ .unwrap();
- let appsink = sink.dynamic_cast::<gst_app::AppSink>().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 e293a2d3f..fb7a3bfa0 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::<ElementSrcTest>(&[]);
diff --git a/generic/threadshare/tests/pipeline.rs b/generic/threadshare/tests/pipeline.rs
index 137d4dc4d..3b8ea46da 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()
- .unwrap();
+ .sync(false)
+ .async_(false)
+ .build();
- pipeline.add_many(&[&src, &queue, &sink]).unwrap();
- gst::Element::link_many(&[&src, &queue, &sink]).unwrap();
+ pipeline
+ .add_many(&[&src, &queue, sink.upcast_ref()])
+ .unwrap();
+ gst::Element::link_many(&[&src, &queue, sink.upcast_ref()]).unwrap();
- let appsink = sink.dynamic_cast::<gst_app::AppSink>().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::<gst_app::AppSink>().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::<gst_app::AppSink>().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::<gst_app::AppSink>().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 5b68a8691..49eb64e6a 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::<gst_app::AppSink>().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 682f7175d..321f3cd5d 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::<gst_app::AppSink>().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 3ad1330d6..f8b8c2f26 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::<gst_app::AppSink>().unwrap();
let samples_clone = samples.clone();
appsink.set_callbacks(
gst_app::AppSinkCallbacks::builder()