From 6dfd1c1496ff710a806e4b0a5f30a83ab6b7fe40 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 4 Dec 2023 15:54:00 +0100 Subject: [PATCH] use new debug and parse API Changes from https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1355 Part-of: --- audio/audiofx/examples/hrtfrender.rs | 2 +- audio/audiofx/tests/audioloudnorm.rs | 4 ++-- audio/csound/examples/effect_example.rs | 4 ++-- generic/inter/examples/basic.rs | 4 ++-- generic/inter/examples/plug-and-play.rs | 3 +-- mux/fmp4/examples/dash_vod.rs | 2 +- mux/mp4/tests/tests.rs | 2 +- net/webrtc/examples/webrtcsink-stats-server.rs | 2 +- net/webrtc/src/webrtcsink/imp.rs | 2 +- utils/fallbackswitch/examples/gtk_fallbackswitch.rs | 4 ++-- utils/livesync/examples/gtk_livesync.rs | 2 +- utils/tracers/src/pipeline_snapshot/imp.rs | 10 +++------- utils/uriplaylistbin/examples/playlist.rs | 4 ++-- video/ffv1/tests/ffv1dec.rs | 2 +- video/gif/examples/testvideosrc2gif.rs | 2 +- video/png/examples/pngenc.rs | 2 +- 16 files changed, 23 insertions(+), 28 deletions(-) diff --git a/audio/audiofx/examples/hrtfrender.rs b/audio/audiofx/examples/hrtfrender.rs index 98acc158..cc156e50 100644 --- a/audio/audiofx/examples/hrtfrender.rs +++ b/audio/audiofx/examples/hrtfrender.rs @@ -36,7 +36,7 @@ fn run() -> Result<(), Error> { let uri = &args[1]; let hrir = &args[2]; - let pipeline = gst::parse_launch(&format!( + let pipeline = gst::parse::launch(&format!( "uridecodebin uri={uri} ! audioconvert ! audio/x-raw,channels=1 ! hrtfrender hrir-file={hrir} name=hrtf ! audioresample ! autoaudiosink" ))? diff --git a/audio/audiofx/tests/audioloudnorm.rs b/audio/audiofx/tests/audioloudnorm.rs index 4fd14b0f..e36055c4 100644 --- a/audio/audiofx/tests/audioloudnorm.rs +++ b/audio/audiofx/tests/audioloudnorm.rs @@ -39,7 +39,7 @@ fn run_test( }; let pipeline = if let Some(second_input) = second_input { - gst::parse_launch(&format!( + gst::parse::launch(&format!( "audiotestsrc {first_input} num-buffers={num_buffers} samplesperbuffer={samples_per_buffer} ! {format} ! audiomixer name=mixer output-buffer-duration={output_buffer_duration} ! {format} ! audioloudnorm ! appsink name=sink audiotestsrc {second_input} num-buffers={num_buffers} samplesperbuffer={samples_per_buffer} ! {format} ! mixer.", first_input = first_input, second_input = second_input, @@ -49,7 +49,7 @@ fn run_test( format = format, )) } else { - gst::parse_launch(&format!( + gst::parse::launch(&format!( "audiotestsrc {first_input} num-buffers={num_buffers} samplesperbuffer={samples_per_buffer} ! {format} ! audioloudnorm ! appsink name=sink", )) } diff --git a/audio/csound/examples/effect_example.rs b/audio/csound/examples/effect_example.rs index 39fb1af7..779b7603 100644 --- a/audio/csound/examples/effect_example.rs +++ b/audio/csound/examples/effect_example.rs @@ -75,9 +75,9 @@ const CSD: &str = " fn create_pipeline() -> Result> { 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(); - let audio_sink = gst::parse_bin_from_description(AUDIO_SINK, true)?.upcast(); + let audio_sink = gst::parse::bin_from_description(AUDIO_SINK, true)?.upcast(); let csoundfilter = gst::ElementFactory::make("csoundfilter") .property("csd-text", CSD) diff --git a/generic/inter/examples/basic.rs b/generic/inter/examples/basic.rs index 1afbe8a4..cf0fdc9e 100644 --- a/generic/inter/examples/basic.rs +++ b/generic/inter/examples/basic.rs @@ -15,8 +15,8 @@ fn toplevel(obj: &gst::Object) -> gst::Object { async fn main() -> Result<(), Error> { gst::init()?; - let src_pipeline = gst::parse_launch("videotestsrc is-live=true ! intersink")?; - let sink_pipeline = gst::parse_launch("intersrc ! videoconvert ! autovideosink")?; + let src_pipeline = gst::parse::launch("videotestsrc is-live=true ! intersink")?; + let sink_pipeline = gst::parse::launch("intersrc ! videoconvert ! autovideosink")?; let mut stream = select_all([ src_pipeline.bus().unwrap().stream(), diff --git a/generic/inter/examples/plug-and-play.rs b/generic/inter/examples/plug-and-play.rs index f797e0b4..921f2423 100644 --- a/generic/inter/examples/plug-and-play.rs +++ b/generic/inter/examples/plug-and-play.rs @@ -145,8 +145,7 @@ fn monitor_pipeline(pipeline: &gst::Pipeline, base_time: gst::ClockTime) -> Resu } MessageView::StateChanged(sc) => { if msg.src() == Some(pipeline.upcast_ref()) { - gst::debug_bin_to_dot_file( - pipeline.upcast_ref::(), + pipeline.debug_to_dot_file( gst::DebugGraphDetails::all(), format!("{}-{:?}-{:?}", pipeline.name(), sc.old(), sc.current()), ); diff --git a/mux/fmp4/examples/dash_vod.rs b/mux/fmp4/examples/dash_vod.rs index 71938f4d..7f25094e 100644 --- a/mux/fmp4/examples/dash_vod.rs +++ b/mux/fmp4/examples/dash_vod.rs @@ -43,7 +43,7 @@ fn main() -> Result<(), Error> { path: PathBuf::from("dash_stream"), })); - let pipeline = gst::parse_launch("videotestsrc num-buffers=2500 ! timecodestamper ! video/x-raw,format=I420,width=1280,height=720,framerate=30/1 ! timeoverlay ! x264enc bframes=0 bitrate=2048 ! video/x-h264,profile=main ! cmafmux fragment-duration=10000000000 header-update-mode=update write-mehd=true ! appsink name=sink").unwrap().downcast::().unwrap(); + let pipeline = gst::parse::launch("videotestsrc num-buffers=2500 ! timecodestamper ! video/x-raw,format=I420,width=1280,height=720,framerate=30/1 ! timeoverlay ! x264enc bframes=0 bitrate=2048 ! video/x-h264,profile=main ! cmafmux fragment-duration=10000000000 header-update-mode=update write-mehd=true ! appsink name=sink").unwrap().downcast::().unwrap(); let sink = pipeline .by_name("sink") diff --git a/mux/mp4/tests/tests.rs b/mux/mp4/tests/tests.rs index b4d480f4..fc6e360f 100644 --- a/mux/mp4/tests/tests.rs +++ b/mux/mp4/tests/tests.rs @@ -38,7 +38,7 @@ fn test_basic() { } } - let pipeline = match gst::parse_launch( + let pipeline = match gst::parse::launch( "videotestsrc num-buffers=99 ! x264enc ! mux. \ audiotestsrc num-buffers=140 ! fdkaacenc ! mux. \ isomp4mux name=mux ! filesink name=sink \ diff --git a/net/webrtc/examples/webrtcsink-stats-server.rs b/net/webrtc/examples/webrtcsink-stats-server.rs index e82f63d4..1da38e35 100644 --- a/net/webrtc/examples/webrtcsink-stats-server.rs +++ b/net/webrtc/examples/webrtcsink-stats-server.rs @@ -127,7 +127,7 @@ async fn run(args: Args) -> Result<(), Error> { args.uri ); - let pipeline = gst::parse_launch(&pipeline_str)?; + let pipeline = gst::parse::launch(&pipeline_str)?; let ws = pipeline .downcast_ref::() .unwrap() diff --git a/net/webrtc/src/webrtcsink/imp.rs b/net/webrtc/src/webrtcsink/imp.rs index ee3e4bc1..85195da5 100644 --- a/net/webrtc/src/webrtcsink/imp.rs +++ b/net/webrtc/src/webrtcsink/imp.rs @@ -817,7 +817,7 @@ impl EncodingChainBuilder { elements.push(match self.codec.is_video() { true => make_converter_for_video_caps(&self.input_caps, &self.codec)?.upcast(), false => { - gst::parse_bin_from_description("audioresample ! audioconvert", true)?.upcast() + gst::parse::bin_from_description("audioresample ! audioconvert", true)?.upcast() } }); diff --git a/utils/fallbackswitch/examples/gtk_fallbackswitch.rs b/utils/fallbackswitch/examples/gtk_fallbackswitch.rs index da8865d9..ead6d9ab 100644 --- a/utils/fallbackswitch/examples/gtk_fallbackswitch.rs +++ b/utils/fallbackswitch/examples/gtk_fallbackswitch.rs @@ -22,10 +22,10 @@ const FALLBACK_PIPELINE: &str = "videotestsrc is-live=true pattern=snow"; fn create_pipeline() -> (gst::Pipeline, gst::Pad, gst::Element) { 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() .upcast(); - let fallback_video_src = gst::parse_bin_from_description(FALLBACK_PIPELINE, true) + let fallback_video_src = gst::parse::bin_from_description(FALLBACK_PIPELINE, true) .unwrap() .upcast(); diff --git a/utils/livesync/examples/gtk_livesync.rs b/utils/livesync/examples/gtk_livesync.rs index b0a77089..c30da7ab 100644 --- a/utils/livesync/examples/gtk_livesync.rs +++ b/utils/livesync/examples/gtk_livesync.rs @@ -32,7 +32,7 @@ impl Drop for DroppingProbe { } fn create_pipeline() -> gst::Pipeline { - gst::parse_launch( + gst::parse::launch( r#"videotestsrc name=vsrc is-live=1 ! video/x-raw,framerate=60/1,width=800,height=600 ! identity single-segment=1 diff --git a/utils/tracers/src/pipeline_snapshot/imp.rs b/utils/tracers/src/pipeline_snapshot/imp.rs index 9f80912a..4dd75a47 100644 --- a/utils/tracers/src/pipeline_snapshot/imp.rs +++ b/utils/tracers/src/pipeline_snapshot/imp.rs @@ -211,17 +211,13 @@ impl PipelineSnapshot { let dump_name = format!("{}{}", settings.dot_prefix, pipeline.name()); if settings.dot_ts { - gst::debug_bin_to_dot_file_with_ts( - &pipeline, + pipeline.debug_to_dot_file_with_ts( gst::DebugGraphDetails::all(), &dump_name, ); } else { - gst::debug_bin_to_dot_file( - &pipeline, - gst::DebugGraphDetails::all(), - &dump_name, - ); + pipeline + .debug_to_dot_file(gst::DebugGraphDetails::all(), &dump_name); } } } diff --git a/utils/uriplaylistbin/examples/playlist.rs b/utils/uriplaylistbin/examples/playlist.rs index 3e293d3c..a927648a 100644 --- a/utils/uriplaylistbin/examples/playlist.rs +++ b/utils/uriplaylistbin/examples/playlist.rs @@ -43,13 +43,13 @@ fn create_pipeline(uris: Vec, iterations: u32) -> anyhow::Result