Various minor cleanups

This commit is contained in:
Sebastian Dröge 2022-10-22 19:06:29 +03:00
parent f3546819ed
commit f058a5e229
30 changed files with 246 additions and 252 deletions

View file

@ -66,7 +66,7 @@ fn run_test(
.downcast::<gst_app::AppSink>() .downcast::<gst_app::AppSink>()
.unwrap(); .unwrap();
sink.set_property("sync", false); sink.set_sync(false);
let caps = gst_audio::AudioInfo::builder(gst_audio::AUDIO_FORMAT_F64, 192_000, channels) let caps = gst_audio::AudioInfo::builder(gst_audio::AUDIO_FORMAT_F64, 192_000, channels)
.build() .build()
.unwrap() .unwrap()

View file

@ -73,7 +73,7 @@ const CSD: &str = "
</CsoundSynthesizer>"; </CsoundSynthesizer>";
fn create_pipeline() -> Result<gst::Pipeline, Box<dyn Error>> { fn create_pipeline() -> Result<gst::Pipeline, Box<dyn Error>> {
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let audio_src = gst::parse_bin_from_description(AUDIO_SRC, true)?.upcast(); let audio_src = gst::parse_bin_from_description(AUDIO_SRC, true)?.upcast();

View file

@ -234,8 +234,6 @@ fn setup_appsink(appsink: &gst_app::AppSink, name: &str, path: &Path, is_video:
segment_index: 0, segment_index: 0,
})); }));
appsink.set_buffer_list(true);
appsink.set_callbacks( appsink.set_callbacks(
gst_app::AppSinkCallbacks::builder() gst_app::AppSinkCallbacks::builder()
.new_sample(move |sink| { .new_sample(move |sink| {
@ -395,20 +393,37 @@ impl VideoStream {
.property("is-live", true) .property("is-live", true)
.build()?; .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 timeoverlay = gst::ElementFactory::make("timeoverlay").build()?;
let enc = gst::ElementFactory::make("x264enc") let enc = gst::ElementFactory::make("x264enc")
.property("bframes", 0u32) .property("bframes", 0u32)
.property("bitrate", self.bitrate as u32 / 1000u32) .property("bitrate", self.bitrate as u32 / 1000u32)
.property_from_str("tune", "zerolatency") .property_from_str("tune", "zerolatency")
.build()?; .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") let mux = gst::ElementFactory::make("cmafmux")
.property("fragment-duration", 2500.mseconds()) .property("fragment-duration", 2500.mseconds())
.property_from_str("header-update-mode", "update") .property_from_str("header-update-mode", "update")
.property("write-mehd", true) .property("write-mehd", true)
.build()?; .build()?;
let appsink = gst::ElementFactory::make("appsink").build()?; let appsink = gst_app::AppSink::builder().buffer_list(true).build();
pipeline.add_many(&[ pipeline.add_many(&[
&src, &src,
@ -417,26 +432,9 @@ impl VideoStream {
&enc, &enc,
&h264_capsfilter, &h264_capsfilter,
&mux, &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(&[ gst::Element::link_many(&[
&src, &src,
&raw_capsfilter, &raw_capsfilter,
@ -444,13 +442,11 @@ impl VideoStream {
&enc, &enc,
&h264_capsfilter, &h264_capsfilter,
&mux, &mux,
&appsink, appsink.upcast_ref(),
])?; ])?;
probe_encoder(state, enc); probe_encoder(state, enc);
let appsink = appsink.downcast::<gst_app::AppSink>().unwrap();
setup_appsink(&appsink, &self.name, path, true); setup_appsink(&appsink, &self.name, path, true);
Ok(()) Ok(())
@ -474,16 +470,14 @@ impl AudioStream {
.property_from_str("header-update-mode", "update") .property_from_str("header-update-mode", "update")
.property("write-mehd", true) .property("write-mehd", true)
.build()?; .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); probe_encoder(state, enc);
let appsink = appsink.downcast::<gst_app::AppSink>().unwrap();
setup_appsink(&appsink, &self.name, path, false); setup_appsink(&appsink, &self.name, path, false);
Ok(()) Ok(())
@ -497,7 +491,7 @@ fn main() -> Result<(), Error> {
let path = PathBuf::from("hls_live_stream"); 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"); std::fs::create_dir_all(&path).expect("failed to create directory");

View file

@ -136,8 +136,6 @@ fn setup_appsink(appsink: &gst_app::AppSink, name: &str, path: &Path, is_video:
path, path,
})); }));
appsink.set_buffer_list(true);
let state_clone = state.clone(); let state_clone = state.clone();
appsink.set_callbacks( appsink.set_callbacks(
gst_app::AppSinkCallbacks::builder() gst_app::AppSinkCallbacks::builder()
@ -289,19 +287,36 @@ impl VideoStream {
let src = gst::ElementFactory::make("videotestsrc") let src = gst::ElementFactory::make("videotestsrc")
.property("num-buffers", 300) .property("num-buffers", 300)
.build()?; .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 timeoverlay = gst::ElementFactory::make("timeoverlay").build()?;
let enc = gst::ElementFactory::make("x264enc") let enc = gst::ElementFactory::make("x264enc")
.property("bframes", 0u32) .property("bframes", 0u32)
.property("bitrate", self.bitrate as u32 / 1000u32) .property("bitrate", self.bitrate as u32 / 1000u32)
.build()?; .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") let mux = gst::ElementFactory::make("cmafmux")
.property("fragment-duration", 2500.mseconds()) .property("fragment-duration", 2500.mseconds())
.property_from_str("header-update-mode", "update") .property_from_str("header-update-mode", "update")
.property("write-mehd", true) .property("write-mehd", true)
.build()?; .build()?;
let appsink = gst::ElementFactory::make("appsink").build()?; let appsink = gst_app::AppSink::builder().buffer_list(true).build();
pipeline.add_many(&[ pipeline.add_many(&[
&src, &src,
@ -310,7 +325,7 @@ impl VideoStream {
&enc, &enc,
&h264_capsfilter, &h264_capsfilter,
&mux, &mux,
&appsink, appsink.upcast_ref(),
])?; ])?;
gst::Element::link_many(&[ gst::Element::link_many(&[
@ -320,30 +335,11 @@ impl VideoStream {
&enc, &enc,
&h264_capsfilter, &h264_capsfilter,
&mux, &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); probe_encoder(state, enc);
let appsink = appsink.downcast::<gst_app::AppSink>().unwrap();
setup_appsink(&appsink, &self.name, path, true); setup_appsink(&appsink, &self.name, path, true);
Ok(()) Ok(())
@ -362,28 +358,26 @@ impl AudioStream {
.property("samplesperbuffer", 4410) .property("samplesperbuffer", 4410)
.property_from_str("wave", &self.wave) .property_from_str("wave", &self.wave)
.build()?; .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 enc = gst::ElementFactory::make("avenc_aac").build()?;
let mux = gst::ElementFactory::make("cmafmux") let mux = gst::ElementFactory::make("cmafmux")
.property("fragment-duration", 2500.mseconds()) .property("fragment-duration", 2500.mseconds())
.property_from_str("header-update-mode", "update") .property_from_str("header-update-mode", "update")
.property("write-mehd", true) .property("write-mehd", true)
.build()?; .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])?; gst::Element::link_many(&[&src, &raw_capsfilter, &enc, &mux, appsink.upcast_ref()])?;
raw_capsfilter.set_property(
"caps",
gst_audio::AudioCapsBuilder::new().rate(44100).build(),
);
probe_encoder(state, enc); probe_encoder(state, enc);
let appsink = appsink.downcast::<gst_app::AppSink>().unwrap();
setup_appsink(&appsink, &self.name, path, false); setup_appsink(&appsink, &self.name, path, false);
Ok(()) Ok(())
@ -397,7 +391,7 @@ fn main() -> Result<(), Error> {
let path = PathBuf::from("hls_vod_stream"); 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"); std::fs::create_dir_all(&path).expect("failed to create directory");

View file

@ -100,7 +100,7 @@ fn main() -> Result<(), Box<dyn Error>> {
.build() .build()
.unwrap(); .unwrap();
let pipeline = gst::Pipeline::new(Some("test-pipeline")); let pipeline = gst::Pipeline::builder().name("test-pipeline").build();
pipeline pipeline
.add_many(&[&filesrc, &decrypter, &typefind, &filesink]) .add_many(&[&filesrc, &decrypter, &typefind, &filesink])
.expect("failed to add elements to the pipeline"); .expect("failed to add elements to the pipeline");

View file

@ -103,7 +103,7 @@ fn main() -> Result<(), Box<dyn Error>> {
.build() .build()
.unwrap(); .unwrap();
let pipeline = gst::Pipeline::new(Some("test-pipeline")); let pipeline = gst::Pipeline::builder().name("test-pipeline").build();
pipeline pipeline
.add_many(&[&filesrc, &encrypter, &filesink]) .add_many(&[&filesrc, &encrypter, &filesink])
.expect("failed to add elements to the pipeline"); .expect("failed to add elements to the pipeline");

View file

@ -61,7 +61,9 @@ fn init() {
fn test_pipeline() { fn test_pipeline() {
init(); init();
let pipeline = gst::Pipeline::new(Some("sodium-decrypter-test")); let pipeline = gst::Pipeline::builder()
.name("sodium-decrypter-test")
.build();
let input_path = { let input_path = {
let mut r = PathBuf::new(); let mut r = PathBuf::new();
@ -86,17 +88,16 @@ fn test_pipeline() {
// the typefind element here is cause the decrypter only supports // the typefind element here is cause the decrypter only supports
// operating in pull mode bu the filesink wants push-mode. // operating in pull mode bu the filesink wants push-mode.
let typefind = gst::ElementFactory::make("typefind").build().unwrap(); let typefind = gst::ElementFactory::make("typefind").build().unwrap();
let sink = gst::ElementFactory::make("appsink").build().unwrap(); let sink = gst_app::AppSink::builder().build();
pipeline pipeline
.add_many(&[&filesrc, &dec, &typefind, &sink]) .add_many(&[&filesrc, &dec, &typefind, sink.upcast_ref()])
.expect("failed to add elements to the pipeline"); .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"); .expect("failed to link the elements");
let adapter = Arc::new(Mutex::new(gst_base::UniqueAdapter::new())); let adapter = Arc::new(Mutex::new(gst_base::UniqueAdapter::new()));
let sink = sink.downcast::<gst_app::AppSink>().unwrap();
let adapter_clone = adapter.clone(); let adapter_clone = adapter.clone();
sink.set_callbacks( sink.set_callbacks(
gst_app::AppSinkCallbacks::builder() gst_app::AppSinkCallbacks::builder()
@ -154,7 +155,9 @@ fn test_pipeline() {
fn test_pull_range() { fn test_pull_range() {
init(); 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 input_path = {
let mut r = PathBuf::new(); let mut r = PathBuf::new();
r.push(env!("CARGO_MANIFEST_DIR")); r.push(env!("CARGO_MANIFEST_DIR"));

View file

@ -71,7 +71,7 @@ fn main() {
.build(); .build();
let l = glib::MainLoop::new(None, false); 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)); let counter = Arc::new(AtomicU64::new(0));
for i in 0..n_streams { for i in 0..n_streams {

View file

@ -128,7 +128,7 @@ fn main() {
let args = args(); let args = args();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
for i in 0..args.streams { for i in 0..args.streams {
let ctx_name = format!("standalone {}", i % args.groups); let ctx_name = format!("standalone {}", i % args.groups);

View file

@ -90,7 +90,7 @@ fn send_rtp_buffers(n_streams: u16) {
} }
let l = glib::MainLoop::new(None, false); let l = glib::MainLoop::new(None, false);
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
for i in 0..n_streams { for i in 0..n_streams {
let src = gst::ElementFactory::make("audiotestsrc") let src = gst::ElementFactory::make("audiotestsrc")
.name(format!("audiotestsrc-{}", i).as_str()) .name(format!("audiotestsrc-{}", i).as_str())

View file

@ -49,7 +49,7 @@ fn jb_pipeline() {
const LATENCY: u32 = 20; const LATENCY: u32 = 20;
const BUFFER_NB: i32 = 3; const BUFFER_NB: i32 = 3;
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let src = gst::ElementFactory::make("audiotestsrc") let src = gst::ElementFactory::make("audiotestsrc")
.name("audiotestsrc") .name("audiotestsrc")
@ -84,21 +84,19 @@ fn jb_pipeline() {
.build() .build()
.unwrap(); .unwrap();
let sink = gst::ElementFactory::make("appsink") let sink = gst_app::AppSink::builder()
.name("appsink") .name("appsink")
.property("sync", false) .sync(false)
.property("async", false) .async_(false)
.build() .build();
.unwrap();
pipeline pipeline
.add_many(&[&src, &enc, &pay, &jb, &depay, &dec, &sink]) .add_many(&[&src, &enc, &pay, &jb, &depay, &dec, sink.upcast_ref()])
.unwrap(); .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(); let (sender, receiver) = mpsc::channel();
appsink.set_callbacks( sink.set_callbacks(
gst_app::AppSinkCallbacks::builder() gst_app::AppSinkCallbacks::builder()
.new_sample(move |appsink| { .new_sample(move |appsink| {
let _sample = appsink.pull_sample().unwrap(); let _sample = appsink.pull_sample().unwrap();
@ -128,7 +126,7 @@ fn jb_ts_pipeline() {
const LATENCY: u32 = 20; const LATENCY: u32 = 20;
const BUFFER_NB: i32 = 3; const BUFFER_NB: i32 = 3;
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let src = gst::ElementFactory::make("audiotestsrc") let src = gst::ElementFactory::make("audiotestsrc")
.name("audiotestsrc") .name("audiotestsrc")
@ -170,21 +168,38 @@ fn jb_ts_pipeline() {
.build() .build()
.unwrap(); .unwrap();
let sink = gst::ElementFactory::make("appsink") let sink = gst_app::AppSink::builder()
.name("appsink") .name("appsink")
.property("sync", false) .sync(false)
.property("async", false) .async_(false)
.build() .build();
.unwrap();
pipeline 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.upcast_ref(),
])
.unwrap(); .unwrap();
gst::Element::link_many(&[&src, &queue, &enc, &pay, &jb, &depay, &dec, &sink]).unwrap();
let appsink = sink.dynamic_cast::<gst_app::AppSink>().unwrap();
let (sender, receiver) = mpsc::channel(); let (sender, receiver) = mpsc::channel();
appsink.set_callbacks( sink.set_callbacks(
gst_app::AppSinkCallbacks::builder() gst_app::AppSinkCallbacks::builder()
.new_sample(move |appsink| { .new_sample(move |appsink| {
let _sample = appsink.pull_sample().unwrap(); let _sample = appsink.pull_sample().unwrap();

View file

@ -693,7 +693,7 @@ fn setup(
) { ) {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
// Src // Src
let src_element = glib::Object::new::<ElementSrcTest>(&[]); let src_element = glib::Object::new::<ElementSrcTest>(&[]);

View file

@ -58,7 +58,7 @@ fn multiple_contexts_queue() {
const FIRST_PORT: u16 = 40000; const FIRST_PORT: u16 = 40000;
let l = glib::MainLoop::new(None, false); let l = glib::MainLoop::new(None, false);
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let (sender, receiver) = mpsc::channel(); let (sender, receiver) = mpsc::channel();
@ -78,19 +78,19 @@ fn multiple_contexts_queue() {
.build() .build()
.unwrap(); .unwrap();
let sink = gst::ElementFactory::make("appsink") let sink = gst_app::AppSink::builder()
.name(format!("sink-{}", i).as_str()) .name(format!("sink-{}", i).as_str())
.property("sync", false) .sync(false)
.property("async", false) .async_(false)
.build() .build();
pipeline
.add_many(&[&src, &queue, sink.upcast_ref()])
.unwrap(); .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::<gst_app::AppSink>().unwrap();
let sender_clone = sender.clone(); let sender_clone = sender.clone();
appsink.set_callbacks( sink.set_callbacks(
gst_app::AppSinkCallbacks::builder() gst_app::AppSinkCallbacks::builder()
.new_sample(move |appsink| { .new_sample(move |appsink| {
let _sample = appsink.pull_sample().unwrap(); let _sample = appsink.pull_sample().unwrap();
@ -192,7 +192,7 @@ fn multiple_contexts_proxy() {
const FIRST_PORT: u16 = 40000 + OFFSET; const FIRST_PORT: u16 = 40000 + OFFSET;
let l = glib::MainLoop::new(None, false); let l = glib::MainLoop::new(None, false);
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let (sender, receiver) = mpsc::channel(); let (sender, receiver) = mpsc::channel();
@ -223,22 +223,20 @@ fn multiple_contexts_proxy() {
.build() .build()
.unwrap(); .unwrap();
let sink = gst::ElementFactory::make("appsink") let sink = gst_app::AppSink::builder()
.name(format!("sink-{}", pipeline_index).as_str()) .name(format!("sink-{}", pipeline_index).as_str())
.property("sync", false) .sync(false)
.property("async", false) .async_(false)
.build() .build();
.unwrap();
pipeline pipeline
.add_many(&[&src, &proxysink, &proxysrc, &sink]) .add_many(&[&src, &proxysink, &proxysrc, sink.upcast_ref()])
.unwrap(); .unwrap();
src.link(&proxysink).unwrap(); src.link(&proxysink).unwrap();
proxysrc.link(&sink).unwrap(); proxysrc.link(&sink).unwrap();
let appsink = sink.dynamic_cast::<gst_app::AppSink>().unwrap();
let sender_clone = sender.clone(); let sender_clone = sender.clone();
appsink.set_callbacks( sink.set_callbacks(
gst_app::AppSinkCallbacks::builder() gst_app::AppSinkCallbacks::builder()
.new_sample(move |appsink| { .new_sample(move |appsink| {
let _sample = appsink.pull_sample().unwrap(); let _sample = appsink.pull_sample().unwrap();
@ -330,7 +328,7 @@ fn eos() {
init(); init();
let l = glib::MainLoop::new(None, false); 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(); let caps = gst::Caps::builder("foo/bar").build();
@ -348,20 +346,20 @@ fn eos() {
.build() .build()
.unwrap(); .unwrap();
let appsink = gst::ElementFactory::make("appsink") let sink = gst_app::AppSink::builder()
.name("sink-eos") .name("sink-eos")
.property("sync", false) .sync(false)
.property("async", false) .async_(false)
.build() .build();
.unwrap();
pipeline.add_many(&[&src, &queue, &appsink]).unwrap(); pipeline
gst::Element::link_many(&[&src, &queue, &appsink]).unwrap(); .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 (sample_notifier, sample_notif_rcv) = mpsc::channel();
let (eos_notifier, eos_notif_rcv) = mpsc::channel(); let (eos_notifier, eos_notif_rcv) = mpsc::channel();
let appsink = appsink.dynamic_cast::<gst_app::AppSink>().unwrap(); sink.set_callbacks(
appsink.set_callbacks(
gst_app::AppSinkCallbacks::builder() gst_app::AppSinkCallbacks::builder()
.new_sample(move |appsink| { .new_sample(move |appsink| {
gst::debug!(CAT, obj: appsink, "eos: pulling sample"); gst::debug!(CAT, obj: appsink, "eos: pulling sample");
@ -461,7 +459,7 @@ fn premature_shutdown() {
const QUEUE_ITEMS_CAPACITY: u32 = 1; const QUEUE_ITEMS_CAPACITY: u32 = 1;
let l = glib::MainLoop::new(None, false); 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(); let caps = gst::Caps::builder("foo/bar").build();
@ -482,20 +480,20 @@ fn premature_shutdown() {
.build() .build()
.unwrap(); .unwrap();
let appsink = gst::ElementFactory::make("appsink") let sink = gst_app::AppSink::builder()
.name("sink-ps") .name("sink-ps")
.property("sync", false) .sync(false)
.property("async", false) .async_(false)
.build() .build();
.unwrap();
pipeline.add_many(&[&src, &queue, &appsink]).unwrap(); pipeline
gst::Element::link_many(&[&src, &queue, &appsink]).unwrap(); .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_sender, appsink_receiver) = mpsc::channel();
let appsink = appsink.dynamic_cast::<gst_app::AppSink>().unwrap(); sink.set_callbacks(
appsink.set_callbacks(
gst_app::AppSinkCallbacks::builder() gst_app::AppSinkCallbacks::builder()
.new_sample(move |appsink| { .new_sample(move |appsink| {
gst::debug!(CAT, obj: appsink, "premature_shutdown: pulling sample"); gst::debug!(CAT, obj: appsink, "premature_shutdown: pulling sample");
@ -620,7 +618,7 @@ fn socket_play_null_play() {
init(); init();
let l = glib::MainLoop::new(None, false); let l = glib::MainLoop::new(None, false);
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let socket = gio::Socket::new( let socket = gio::Socket::new(
SocketFamily::Ipv4, SocketFamily::Ipv4,

View file

@ -35,7 +35,7 @@ fn init() {
fn test_push() { fn test_push() {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let fakesrc = gst::ElementFactory::make("fakesrc") let fakesrc = gst::ElementFactory::make("fakesrc")
.property("num-buffers", 3i32) .property("num-buffers", 3i32)
.build() .build()
@ -51,17 +51,16 @@ fn test_push() {
.property("context", "proxy::test") .property("context", "proxy::test")
.build() .build()
.unwrap(); .unwrap();
let appsink = gst::ElementFactory::make("appsink").build().unwrap(); let appsink = gst_app::AppSink::builder().build();
pipeline pipeline
.add_many(&[&fakesrc, &proxysink, &proxysrc, &appsink]) .add_many(&[&fakesrc, &proxysink, &proxysrc, appsink.upcast_ref()])
.unwrap(); .unwrap();
fakesrc.link(&proxysink).unwrap(); fakesrc.link(&proxysink).unwrap();
proxysrc.link(&appsink).unwrap(); proxysrc.link(&appsink).unwrap();
let samples = Arc::new(Mutex::new(Vec::new())); let samples = Arc::new(Mutex::new(Vec::new()));
let appsink = appsink.dynamic_cast::<gst_app::AppSink>().unwrap();
let samples_clone = samples.clone(); let samples_clone = samples.clone();
appsink.set_callbacks( appsink.set_callbacks(
gst_app::AppSinkCallbacks::builder() gst_app::AppSinkCallbacks::builder()
@ -106,7 +105,7 @@ fn test_push() {
fn test_from_pipeline_to_pipeline() { fn test_from_pipeline_to_pipeline() {
init(); init();
let pipe_1 = gst::Pipeline::new(None); let pipe_1 = gst::Pipeline::default();
let fakesrc = gst::ElementFactory::make("fakesrc").build().unwrap(); let fakesrc = gst::ElementFactory::make("fakesrc").build().unwrap();
let pxsink = gst::ElementFactory::make("ts-proxysink") let pxsink = gst::ElementFactory::make("ts-proxysink")
.name("proxysink::test2") .name("proxysink::test2")
@ -114,7 +113,7 @@ fn test_from_pipeline_to_pipeline() {
.build() .build()
.unwrap(); .unwrap();
let pipe_2 = gst::Pipeline::new(None); let pipe_2 = gst::Pipeline::default();
let pxsrc = gst::ElementFactory::make("ts-proxysrc") let pxsrc = gst::ElementFactory::make("ts-proxysrc")
.name("proxysrc::test2") .name("proxysrc::test2")
.property("proxy-context", "proxy::test2_proxy") .property("proxy-context", "proxy::test2_proxy")
@ -144,7 +143,7 @@ fn test_from_pipeline_to_pipeline() {
fn test_from_pipeline_to_pipeline_and_back() { fn test_from_pipeline_to_pipeline_and_back() {
init(); init();
let pipe_1 = gst::Pipeline::new(None); let pipe_1 = gst::Pipeline::default();
let pxsrc_1 = gst::ElementFactory::make("ts-proxysrc") let pxsrc_1 = gst::ElementFactory::make("ts-proxysrc")
.name("proxysrc1::test3") .name("proxysrc1::test3")
.property("proxy-context", "proxy::test3_proxy1") .property("proxy-context", "proxy::test3_proxy1")
@ -157,7 +156,7 @@ fn test_from_pipeline_to_pipeline_and_back() {
.build() .build()
.unwrap(); .unwrap();
let pipe_2 = gst::Pipeline::new(None); let pipe_2 = gst::Pipeline::default();
let pxsrc_2 = gst::ElementFactory::make("ts-proxysrc") let pxsrc_2 = gst::ElementFactory::make("ts-proxysrc")
.name("proxysrc2::test3") .name("proxysrc2::test3")
.property("proxy-context", "proxy::test3_proxy2") .property("proxy-context", "proxy::test3_proxy2")

View file

@ -35,21 +35,22 @@ fn init() {
fn test_push() { fn test_push() {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let fakesrc = gst::ElementFactory::make("fakesrc") let fakesrc = gst::ElementFactory::make("fakesrc")
.property("num-buffers", 3i32) .property("num-buffers", 3i32)
.build() .build()
.unwrap(); .unwrap();
let queue = gst::ElementFactory::make("ts-queue").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(); fakesrc.link(&queue).unwrap();
queue.link(&appsink).unwrap(); queue.link(&appsink).unwrap();
let samples = Arc::new(Mutex::new(Vec::new())); let samples = Arc::new(Mutex::new(Vec::new()));
let appsink = appsink.dynamic_cast::<gst_app::AppSink>().unwrap();
let samples_clone = samples.clone(); let samples_clone = samples.clone();
appsink.set_callbacks( appsink.set_callbacks(
gst_app::AppSinkCallbacks::builder() gst_app::AppSinkCallbacks::builder()

View file

@ -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 caps = gst::Caps::builder("foo/bar").build();
let tcpclientsrc = gst::ElementFactory::make("ts-tcpclientsrc") let tcpclientsrc = gst::ElementFactory::make("ts-tcpclientsrc")
@ -62,18 +62,18 @@ fn test_push() {
.property("port", 5000i32) .property("port", 5000i32)
.build() .build()
.unwrap(); .unwrap();
let appsink = gst::ElementFactory::make("appsink") let appsink = gst_app::AppSink::builder()
.property("sync", false) .sync(false)
.property("async", false) .async_(false)
.build() .build();
.unwrap();
pipeline.add_many(&[&tcpclientsrc, &appsink]).unwrap(); pipeline
.add_many(&[&tcpclientsrc, appsink.upcast_ref()])
.unwrap();
tcpclientsrc.link(&appsink).unwrap(); tcpclientsrc.link(&appsink).unwrap();
let samples = Arc::new(Mutex::new(Vec::new())); let samples = Arc::new(Mutex::new(Vec::new()));
let appsink = appsink.dynamic_cast::<gst_app::AppSink>().unwrap();
let samples_clone = samples.clone(); let samples_clone = samples.clone();
appsink.set_callbacks( appsink.set_callbacks(
gst_app::AppSinkCallbacks::builder() gst_app::AppSinkCallbacks::builder()

View file

@ -105,7 +105,7 @@ fn test_hlssink3_element_with_video_content() -> Result<(), ()> {
const BUFFER_NB: i32 = 250; 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"); let video_src = try_create_element!("videotestsrc");
video_src.set_property("is-live", true); video_src.set_property("is-live", true);
@ -253,7 +253,7 @@ fn test_hlssink3_element_with_audio_content() -> Result<(), ()> {
const BUFFER_NB: i32 = 100; 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"); let audio_src = try_create_element!("audiotestsrc");
audio_src.set_property("is-live", true); audio_src.set_property("is-live", true);
@ -316,7 +316,7 @@ fn test_hlssink3_write_correct_playlist_content() -> Result<(), ()> {
const BUFFER_NB: i32 = 50; 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"); let video_src = try_create_element!("videotestsrc");
video_src.set_property("is-live", true); video_src.set_property("is-live", true);

View file

@ -312,7 +312,7 @@ fn make_converter_for_video_caps(caps: &gst::Caps) -> Result<gst::Element, Error
let video_info = gst_video::VideoInfo::from_caps(caps)?; let video_info = gst_video::VideoInfo::from_caps(caps)?;
let ret = gst::Bin::new(None); let ret = gst::Bin::default();
let (head, mut tail) = { let (head, mut tail) = {
if let Some(feature) = caps.features(0) { if let Some(feature) = caps.features(0) {
@ -1403,7 +1403,9 @@ impl WebRTCSink {
session_id session_id
); );
let pipeline = gst::Pipeline::new(Some(&format!("session-pipeline-{}", session_id))); let pipeline = gst::Pipeline::builder()
.name(&format!("session-pipeline-{}", session_id))
.build();
let webrtcbin = make_element("webrtcbin", Some(&format!("webrtcbin-{}", session_id))) let webrtcbin = make_element("webrtcbin", Some(&format!("webrtcbin-{}", session_id)))
.map_err(|err| WebRTCSinkError::SessionPipelineError { .map_err(|err| WebRTCSinkError::SessionPipelineError {
@ -2068,7 +2070,7 @@ impl WebRTCSink {
codec: &Codec, codec: &Codec,
caps: &gst::Caps, caps: &gst::Caps,
) -> Result<gst::Structure, Error> { ) -> Result<gst::Structure, Error> {
let pipe = PipelineWrapper(gst::Pipeline::new(None)); let pipe = PipelineWrapper(gst::Pipeline::default());
let src = if codec.is_video() { let src = if codec.is_video() {
make_element("videotestsrc", None)? make_element("videotestsrc", None)?

View file

@ -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"; //const FALLBACK_PIPELINE: &str = "videotestsrc is-live=true pattern=snow ! x264enc tune=zerolatency";
fn create_pipeline() -> (gst::Pipeline, gst::Pad, gst::Element) { 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) let video_src = gst::parse_bin_from_description(MAIN_PIPELINE, true)
.unwrap() .unwrap()

View file

@ -893,7 +893,7 @@ impl BinImpl for FallbackSrc {
impl FallbackSrc { impl FallbackSrc {
fn create_dummy_audio_source(filter_caps: &gst::Caps, min_latency: gst::ClockTime) -> gst::Bin { 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") let audiotestsrc = gst::ElementFactory::make("audiotestsrc")
.name("audiosrc") .name("audiosrc")
@ -952,7 +952,7 @@ impl FallbackSrc {
} }
fn create_dummy_video_source(filter_caps: &gst::Caps, min_latency: gst::ClockTime) -> gst::Bin { 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") let videotestsrc = gst::ElementFactory::make("videotestsrc")
.name("videosrc") .name("videosrc")
@ -1011,7 +1011,7 @@ impl FallbackSrc {
} }
fn create_main_input(&self, source: &Source, buffer_duration: i64) -> SourceBin { 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 { let source = match source {
Source::Uri(ref uri) => { Source::Uri(ref uri) => {
@ -1104,7 +1104,7 @@ impl FallbackSrc {
None => return None, None => return None,
}; };
let bin = gst::Bin::new(None); let bin = gst::Bin::default();
bin.add(&source).unwrap(); bin.add(&source).unwrap();
@ -1585,7 +1585,7 @@ impl FallbackSrc {
return imagefreeze; return imagefreeze;
} }
let bin = gst::Bin::new(None); let bin = gst::Bin::default();
let videoconvert = gst::ElementFactory::make("videoconvert") let videoconvert = gst::ElementFactory::make("videoconvert")
.name("video_videoconvert") .name("video_videoconvert")
.build() .build()
@ -1633,7 +1633,7 @@ impl FallbackSrc {
.expect("No identity found"); .expect("No identity found");
} }
let bin = gst::Bin::new(None); let bin = gst::Bin::default();
let videoconvert = gst::ElementFactory::make("videoconvert") let videoconvert = gst::ElementFactory::make("videoconvert")
.name("video_videoconvert") .name("video_videoconvert")
.build() .build()
@ -1681,7 +1681,7 @@ impl FallbackSrc {
.expect("No identity found"); .expect("No identity found");
} }
let bin = gst::Bin::new(None); let bin = gst::Bin::default();
let audioconvert = gst::ElementFactory::make("audioconvert") let audioconvert = gst::ElementFactory::make("audioconvert")
.name("audio_audioconvert") .name("audio_audioconvert")
.build() .build()

View file

@ -464,7 +464,7 @@ fn setup_pipeline(
let clock = gst_check::TestClock::new(); let clock = gst_check::TestClock::new();
clock.set_time(gst::ClockTime::ZERO); 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 // 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 // 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_base_time(gst::ClockTime::SECOND);
pipeline.set_start_time(gst::ClockTime::NONE); pipeline.set_start_time(gst::ClockTime::NONE);
let src = gst::ElementFactory::make("appsrc") let src = gst_app::AppSrc::builder()
.name("src") .name("src")
.build() .is_live(true)
.unwrap() .format(gst::Format::Time)
.downcast::<gst_app::AppSrc>() .min_latency(LATENCY.nseconds() as i64)
.unwrap(); .caps(
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() &gst_video::VideoCapsBuilder::new()
.format(gst_video::VideoFormat::Argb) .format(gst_video::VideoFormat::Argb)
.width(320) .width(320)
.height(240) .height(240)
.framerate((0, 1).into()) .framerate((0, 1).into())
.build(), .build(),
)); )
.build();
let switch = gst::ElementFactory::make("fallbackswitch") let switch = gst::ElementFactory::make("fallbackswitch")
.name("switch") .name("switch")
@ -504,13 +501,7 @@ fn setup_pipeline(
switch.set_property("auto-switch", auto_switch); switch.set_property("auto-switch", auto_switch);
} }
let sink = gst::ElementFactory::make("appsink") let sink = gst_app::AppSink::builder().name("sink").sync(false).build();
.name("sink")
.build()
.unwrap()
.downcast::<gst_app::AppSink>()
.unwrap();
sink.set_sync(false);
let queue = gst::ElementFactory::make("queue").build().unwrap(); let queue = gst::ElementFactory::make("queue").build().unwrap();
@ -525,23 +516,20 @@ fn setup_pipeline(
sink_pad.set_property("priority", 0u32); sink_pad.set_property("priority", 0u32);
if let Some(live) = with_live_fallback { if let Some(live) = with_live_fallback {
let fallback_src = gst::ElementFactory::make("appsrc") let fallback_src = gst_app::AppSrc::builder()
.name("fallback-src") .name("fallback-src")
.build() .is_live(live)
.unwrap() .format(gst::Format::Time)
.downcast::<gst_app::AppSrc>() .min_latency(LATENCY.nseconds() as i64)
.unwrap(); .caps(
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() &gst_video::VideoCapsBuilder::new()
.format(gst_video::VideoFormat::Argb) .format(gst_video::VideoFormat::Argb)
.width(160) .width(160)
.height(120) .height(120)
.framerate((0, 1).into()) .framerate((0, 1).into())
.build(), .build(),
)); )
.build();
pipeline.add(&fallback_src).unwrap(); pipeline.add(&fallback_src).unwrap();

View file

@ -21,7 +21,7 @@ fn create_pipeline() -> (
gst::Element, gst::Element,
gst::Element, gst::Element,
) { ) {
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let video_src = gst::ElementFactory::make("videotestsrc") let video_src = gst::ElementFactory::make("videotestsrc")
.property("is-live", true) .property("is-live", true)

View file

@ -275,7 +275,7 @@ fn test_create_pads() {
fn test_one_stream_open() { fn test_one_stream_open() {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap();
pipeline.add(&togglerecord).unwrap(); pipeline.add(&togglerecord).unwrap();
@ -307,7 +307,7 @@ fn test_one_stream_open() {
fn test_one_stream_gaps_open() { fn test_one_stream_gaps_open() {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap();
pipeline.add(&togglerecord).unwrap(); pipeline.add(&togglerecord).unwrap();
@ -340,7 +340,7 @@ fn test_one_stream_gaps_open() {
fn test_one_stream_close_open() { fn test_one_stream_close_open() {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap();
pipeline.add(&togglerecord).unwrap(); pipeline.add(&togglerecord).unwrap();
@ -374,7 +374,7 @@ fn test_one_stream_close_open() {
fn test_one_stream_open_close() { fn test_one_stream_open_close() {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap();
pipeline.add(&togglerecord).unwrap(); pipeline.add(&togglerecord).unwrap();
@ -409,7 +409,7 @@ fn test_one_stream_open_close() {
fn test_one_stream_open_close_open() { fn test_one_stream_open_close_open() {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap();
pipeline.add(&togglerecord).unwrap(); pipeline.add(&togglerecord).unwrap();
@ -453,7 +453,7 @@ fn test_one_stream_open_close_open() {
fn test_two_stream_open() { fn test_two_stream_open() {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap();
pipeline.add(&togglerecord).unwrap(); pipeline.add(&togglerecord).unwrap();
@ -506,7 +506,7 @@ fn test_two_stream_open() {
fn test_two_stream_open_shift() { fn test_two_stream_open_shift() {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap();
pipeline.add(&togglerecord).unwrap(); pipeline.add(&togglerecord).unwrap();
@ -563,7 +563,7 @@ fn test_two_stream_open_shift() {
fn test_two_stream_open_shift_main() { fn test_two_stream_open_shift_main() {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap();
pipeline.add(&togglerecord).unwrap(); pipeline.add(&togglerecord).unwrap();
@ -628,7 +628,7 @@ fn test_two_stream_open_shift_main() {
fn test_two_stream_open_close() { fn test_two_stream_open_close() {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap();
pipeline.add(&togglerecord).unwrap(); pipeline.add(&togglerecord).unwrap();
@ -697,7 +697,7 @@ fn test_two_stream_open_close() {
fn test_two_stream_close_open() { fn test_two_stream_close_open() {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap();
pipeline.add(&togglerecord).unwrap(); pipeline.add(&togglerecord).unwrap();
@ -766,7 +766,7 @@ fn test_two_stream_close_open() {
fn test_two_stream_open_close_open() { fn test_two_stream_open_close_open() {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap();
pipeline.add(&togglerecord).unwrap(); pipeline.add(&togglerecord).unwrap();
@ -860,7 +860,7 @@ fn test_two_stream_open_close_open() {
fn test_two_stream_open_close_open_gaps() { fn test_two_stream_open_close_open_gaps() {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap();
pipeline.add(&togglerecord).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() { fn test_two_stream_close_open_close_delta() {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap();
pipeline.add(&togglerecord).unwrap(); pipeline.add(&togglerecord).unwrap();
@ -1049,7 +1049,7 @@ fn test_two_stream_close_open_close_delta() {
fn test_three_stream_open_close_open() { fn test_three_stream_open_close_open() {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap();
pipeline.add(&togglerecord).unwrap(); pipeline.add(&togglerecord).unwrap();
@ -1173,7 +1173,7 @@ fn test_three_stream_open_close_open() {
fn test_two_stream_main_eos() { fn test_two_stream_main_eos() {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap();
pipeline.add(&togglerecord).unwrap(); pipeline.add(&togglerecord).unwrap();
@ -1248,7 +1248,7 @@ fn test_two_stream_main_eos() {
fn test_two_stream_secondary_eos_first() { fn test_two_stream_secondary_eos_first() {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap();
pipeline.add(&togglerecord).unwrap(); pipeline.add(&togglerecord).unwrap();
@ -1316,7 +1316,7 @@ fn test_two_stream_secondary_eos_first() {
fn test_three_stream_main_eos() { fn test_three_stream_main_eos() {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap();
pipeline.add(&togglerecord).unwrap(); pipeline.add(&togglerecord).unwrap();
@ -1417,7 +1417,7 @@ fn test_three_stream_main_eos() {
fn test_three_stream_main_and_second_eos() { fn test_three_stream_main_and_second_eos() {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap();
pipeline.add(&togglerecord).unwrap(); pipeline.add(&togglerecord).unwrap();
@ -1518,7 +1518,7 @@ fn test_three_stream_main_and_second_eos() {
fn test_three_stream_secondary_eos_first() { fn test_three_stream_secondary_eos_first() {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap(); let togglerecord = gst::ElementFactory::make("togglerecord").build().unwrap();
pipeline.add(&togglerecord).unwrap(); pipeline.add(&togglerecord).unwrap();

View file

@ -24,7 +24,7 @@ struct Opt {
} }
fn create_pipeline(uris: Vec<String>, iterations: u32) -> anyhow::Result<gst::Pipeline> { fn create_pipeline(uris: Vec<String>, iterations: u32) -> anyhow::Result<gst::Pipeline> {
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let playlist = gst::ElementFactory::make("uriplaylistbin") let playlist = gst::ElementFactory::make("uriplaylistbin")
.property("uris", &uris) .property("uris", &uris)
.property("iterations", &iterations) .property("iterations", &iterations)

View file

@ -85,7 +85,7 @@ fn test(
let uris: Vec<String> = medias.iter().map(|t| t.uri.clone()).collect(); let uris: Vec<String> = 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") let playlist = gst::ElementFactory::make("uriplaylistbin")
.property("uris", &uris) .property("uris", &uris)
.property("iterations", &iterations) .property("iterations", &iterations)

View file

@ -25,7 +25,7 @@ fn init() {
fn test_cdgdec() { fn test_cdgdec() {
init(); init();
let pipeline = gst::Pipeline::new(Some("cdgdec-test")); let pipeline = gst::Pipeline::builder().name("cdgdec-test").build();
let input_path = { let input_path = {
let mut r = PathBuf::new(); let mut r = PathBuf::new();
@ -50,14 +50,14 @@ fn test_cdgdec() {
let parse = gst::ElementFactory::make("cdgparse").build().unwrap(); let parse = gst::ElementFactory::make("cdgparse").build().unwrap();
let dec = gst::ElementFactory::make("cdgdec").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 pipeline
.add_many(&[&filesrc, &parse, &dec, &sink]) .add_many(&[&filesrc, &parse, &dec, sink.upcast_ref()])
.expect("failed to add elements to the pipeline"); .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::<gst_app::AppSink>().unwrap();
sink.set_callbacks( sink.set_callbacks(
gst_app::AppSinkCallbacks::builder() gst_app::AppSinkCallbacks::builder()
// Add a handler to the "new-sample" signal. // Add a handler to the "new-sample" signal.

View file

@ -442,8 +442,8 @@ impl TranscriberBin {
} }
fn build_state(&self) -> Result<State, Error> { fn build_state(&self) -> Result<State, Error> {
let internal_bin = gst::Bin::new(Some("internal")); let internal_bin = gst::Bin::builder().name("internal").build();
let transcription_bin = gst::Bin::new(Some("transcription-bin")); let transcription_bin = gst::Bin::builder().name("transcription-bin").build();
let audio_tee = gst::ElementFactory::make("tee") let audio_tee = gst::ElementFactory::make("tee")
// Protect passthrough enable (and resulting dynamic reconfigure) // Protect passthrough enable (and resulting dynamic reconfigure)
// from non-streaming thread // from non-streaming thread

View file

@ -6,7 +6,7 @@ use gtk::{gdk, gio, glib};
use std::cell::RefCell; use std::cell::RefCell;
fn create_ui(app: &gtk::Application) { fn create_ui(app: &gtk::Application) {
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let src = gst::ElementFactory::make("videotestsrc").build().unwrap(); let src = gst::ElementFactory::make("videotestsrc").build().unwrap();
let overlay = gst::ElementFactory::make("clockoverlay") let overlay = gst::ElementFactory::make("clockoverlay")

View file

@ -21,7 +21,7 @@ fn init() {
#[test] #[test]
fn test_red_color() { fn test_red_color() {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
let src = gst::ElementFactory::make("videotestsrc") let src = gst::ElementFactory::make("videotestsrc")
.property_from_str("pattern", "red") .property_from_str("pattern", "red")

View file

@ -60,7 +60,7 @@ fn test_can_find_similar_frames() {
let max_distance = 0.0f64; let max_distance = 0.0f64;
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
setup_pipeline( setup_pipeline(
&pipeline, &pipeline,
"red", "red",
@ -106,7 +106,7 @@ fn test_can_find_similar_frames() {
fn test_do_not_send_message_when_image_not_found() { fn test_do_not_send_message_when_image_not_found() {
init(); init();
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
setup_pipeline(&pipeline, "snow", "red", 0f64, HashAlgorithm::Blockhash); setup_pipeline(&pipeline, "snow", "red", 0f64, HashAlgorithm::Blockhash);
pipeline.set_state(gst::State::Playing).unwrap(); 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 max_distance = 0.0f64;
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::default();
setup_pipeline(&pipeline, "red", "red", max_distance, HashAlgorithm::Dssim); setup_pipeline(&pipeline, "red", "red", max_distance, HashAlgorithm::Dssim);
pipeline.set_state(gst::State::Playing).unwrap(); pipeline.set_state(gst::State::Playing).unwrap();