diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2022-10-22 19:06:29 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2022-10-22 19:50:24 +0300 |
commit | f058a5e2296d69456dae9a2960af79be7becfaa3 (patch) | |
tree | 3b46cc2a541b557e6b493f7b9aa36c13ff529139 /utils | |
parent | f3546819edd26042f9d853a7f1ff7d24771f61a6 (diff) |
Various minor cleanups
Diffstat (limited to 'utils')
-rw-r--r-- | utils/fallbackswitch/examples/gtk_fallbackswitch.rs | 2 | ||||
-rw-r--r-- | utils/fallbackswitch/src/fallbacksrc/imp.rs | 14 | ||||
-rw-r--r-- | utils/fallbackswitch/tests/fallbackswitch.rs | 68 | ||||
-rw-r--r-- | utils/togglerecord/examples/gtk_recording.rs | 2 | ||||
-rw-r--r-- | utils/togglerecord/tests/tests.rs | 38 | ||||
-rw-r--r-- | utils/uriplaylistbin/examples/playlist.rs | 2 | ||||
-rw-r--r-- | utils/uriplaylistbin/tests/uriplaylistbin.rs | 2 |
7 files changed, 58 insertions, 70 deletions
diff --git a/utils/fallbackswitch/examples/gtk_fallbackswitch.rs b/utils/fallbackswitch/examples/gtk_fallbackswitch.rs index 82eab8b8a..d5f5d8c6e 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 0b08217be..becee9a02 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 089d725d7..8257c73d6 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::<gst_app::AppSrc>() - .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::<gst_app::AppSink>() - .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::<gst_app::AppSrc>() - .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 5816eefda..e90241a74 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 e5511f5f3..6836d9c6f 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 6b23a211b..0f3bdfe2b 100644 --- a/utils/uriplaylistbin/examples/playlist.rs +++ b/utils/uriplaylistbin/examples/playlist.rs @@ -24,7 +24,7 @@ struct Opt { } 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") .property("uris", &uris) .property("iterations", &iterations) diff --git a/utils/uriplaylistbin/tests/uriplaylistbin.rs b/utils/uriplaylistbin/tests/uriplaylistbin.rs index fca4fa476..3786ba6c3 100644 --- a/utils/uriplaylistbin/tests/uriplaylistbin.rs +++ b/utils/uriplaylistbin/tests/uriplaylistbin.rs @@ -85,7 +85,7 @@ fn test( 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") .property("uris", &uris) .property("iterations", &iterations) |