Guillaume Desmottes 2023-12-04 15:54:00 +01:00
parent c7f961cc22
commit 6dfd1c1496
16 changed files with 23 additions and 28 deletions

View file

@ -36,7 +36,7 @@ fn run() -> Result<(), Error> {
let uri = &args[1]; let uri = &args[1];
let hrir = &args[2]; 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 ! "uridecodebin uri={uri} ! audioconvert ! audio/x-raw,channels=1 !
hrtfrender hrir-file={hrir} name=hrtf ! audioresample ! autoaudiosink" hrtfrender hrir-file={hrir} name=hrtf ! audioresample ! autoaudiosink"
))? ))?

View file

@ -39,7 +39,7 @@ fn run_test(
}; };
let pipeline = if let Some(second_input) = second_input { 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.", "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, first_input = first_input,
second_input = second_input, second_input = second_input,
@ -49,7 +49,7 @@ fn run_test(
format = format, format = format,
)) ))
} else { } 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", "audiotestsrc {first_input} num-buffers={num_buffers} samplesperbuffer={samples_per_buffer} ! {format} ! audioloudnorm ! appsink name=sink",
)) ))
} }

View file

@ -75,9 +75,9 @@ const CSD: &str = "
fn create_pipeline() -> Result<gst::Pipeline, Box<dyn Error>> { fn create_pipeline() -> Result<gst::Pipeline, Box<dyn Error>> {
let pipeline = gst::Pipeline::default(); 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") let csoundfilter = gst::ElementFactory::make("csoundfilter")
.property("csd-text", CSD) .property("csd-text", CSD)

View file

@ -15,8 +15,8 @@ fn toplevel(obj: &gst::Object) -> gst::Object {
async fn main() -> Result<(), Error> { async fn main() -> Result<(), Error> {
gst::init()?; gst::init()?;
let src_pipeline = gst::parse_launch("videotestsrc is-live=true ! intersink")?; let src_pipeline = gst::parse::launch("videotestsrc is-live=true ! intersink")?;
let sink_pipeline = gst::parse_launch("intersrc ! videoconvert ! autovideosink")?; let sink_pipeline = gst::parse::launch("intersrc ! videoconvert ! autovideosink")?;
let mut stream = select_all([ let mut stream = select_all([
src_pipeline.bus().unwrap().stream(), src_pipeline.bus().unwrap().stream(),

View file

@ -145,8 +145,7 @@ fn monitor_pipeline(pipeline: &gst::Pipeline, base_time: gst::ClockTime) -> Resu
} }
MessageView::StateChanged(sc) => { MessageView::StateChanged(sc) => {
if msg.src() == Some(pipeline.upcast_ref()) { if msg.src() == Some(pipeline.upcast_ref()) {
gst::debug_bin_to_dot_file( pipeline.debug_to_dot_file(
pipeline.upcast_ref::<gst::Bin>(),
gst::DebugGraphDetails::all(), gst::DebugGraphDetails::all(),
format!("{}-{:?}-{:?}", pipeline.name(), sc.old(), sc.current()), format!("{}-{:?}-{:?}", pipeline.name(), sc.old(), sc.current()),
); );

View file

@ -43,7 +43,7 @@ fn main() -> Result<(), Error> {
path: PathBuf::from("dash_stream"), 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::<gst::Pipeline>().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::<gst::Pipeline>().unwrap();
let sink = pipeline let sink = pipeline
.by_name("sink") .by_name("sink")

View file

@ -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. \ "videotestsrc num-buffers=99 ! x264enc ! mux. \
audiotestsrc num-buffers=140 ! fdkaacenc ! mux. \ audiotestsrc num-buffers=140 ! fdkaacenc ! mux. \
isomp4mux name=mux ! filesink name=sink \ isomp4mux name=mux ! filesink name=sink \

View file

@ -127,7 +127,7 @@ async fn run(args: Args) -> Result<(), Error> {
args.uri args.uri
); );
let pipeline = gst::parse_launch(&pipeline_str)?; let pipeline = gst::parse::launch(&pipeline_str)?;
let ws = pipeline let ws = pipeline
.downcast_ref::<gst::Bin>() .downcast_ref::<gst::Bin>()
.unwrap() .unwrap()

View file

@ -817,7 +817,7 @@ impl EncodingChainBuilder {
elements.push(match self.codec.is_video() { elements.push(match self.codec.is_video() {
true => make_converter_for_video_caps(&self.input_caps, &self.codec)?.upcast(), true => make_converter_for_video_caps(&self.input_caps, &self.codec)?.upcast(),
false => { false => {
gst::parse_bin_from_description("audioresample ! audioconvert", true)?.upcast() gst::parse::bin_from_description("audioresample ! audioconvert", true)?.upcast()
} }
}); });

View file

@ -22,10 +22,10 @@ const FALLBACK_PIPELINE: &str = "videotestsrc is-live=true pattern=snow";
fn create_pipeline() -> (gst::Pipeline, gst::Pad, gst::Element) { fn create_pipeline() -> (gst::Pipeline, gst::Pad, gst::Element) {
let pipeline = gst::Pipeline::default(); 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()
.upcast(); .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() .unwrap()
.upcast(); .upcast();

View file

@ -32,7 +32,7 @@ impl Drop for DroppingProbe {
} }
fn create_pipeline() -> gst::Pipeline { fn create_pipeline() -> gst::Pipeline {
gst::parse_launch( gst::parse::launch(
r#"videotestsrc name=vsrc is-live=1 r#"videotestsrc name=vsrc is-live=1
! video/x-raw,framerate=60/1,width=800,height=600 ! video/x-raw,framerate=60/1,width=800,height=600
! identity single-segment=1 ! identity single-segment=1

View file

@ -211,17 +211,13 @@ impl PipelineSnapshot {
let dump_name = format!("{}{}", settings.dot_prefix, pipeline.name()); let dump_name = format!("{}{}", settings.dot_prefix, pipeline.name());
if settings.dot_ts { if settings.dot_ts {
gst::debug_bin_to_dot_file_with_ts( pipeline.debug_to_dot_file_with_ts(
&pipeline,
gst::DebugGraphDetails::all(), gst::DebugGraphDetails::all(),
&dump_name, &dump_name,
); );
} else { } else {
gst::debug_bin_to_dot_file( pipeline
&pipeline, .debug_to_dot_file(gst::DebugGraphDetails::all(), &dump_name);
gst::DebugGraphDetails::all(),
&dump_name,
);
} }
} }
} }

View file

@ -43,13 +43,13 @@ fn create_pipeline(uris: Vec<String>, iterations: u32) -> anyhow::Result<gst::Pi
let pad_name = src_pad.name(); let pad_name = src_pad.name();
let sink = if pad_name.starts_with("audio") { let sink = if pad_name.starts_with("audio") {
gst::parse_bin_from_description( gst::parse::bin_from_description(
"queue ! audioconvert ! audioresample ! autoaudiosink", "queue ! audioconvert ! audioresample ! autoaudiosink",
true, true,
) )
.unwrap() .unwrap()
} else if pad_name.starts_with("video") { } else if pad_name.starts_with("video") {
gst::parse_bin_from_description("queue ! videoconvert ! autovideosink", true).unwrap() gst::parse::bin_from_description("queue ! videoconvert ! autovideosink", true).unwrap()
} else { } else {
unimplemented!(); unimplemented!();
}; };

View file

@ -35,7 +35,7 @@ fn test_decode(name: &str) {
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
path.push(format!("tests/ffv1_v3_{name}.mkv")); path.push(format!("tests/ffv1_v3_{name}.mkv"));
let bin = gst::parse_bin_from_description( let bin = gst::parse::bin_from_description(
&format!( &format!(
"filesrc location={path:?} ! matroskademux name=m m.video_0 ! ffv1dec name=ffv1dec" "filesrc location={path:?} ! matroskademux name=m m.video_0 ! ffv1dec name=ffv1dec"
), ),

View file

@ -16,7 +16,7 @@ fn main() {
gst::init().unwrap(); gst::init().unwrap();
gstgif::plugin_register_static().expect("Failed to register gif plugin"); gstgif::plugin_register_static().expect("Failed to register gif plugin");
let pipeline = gst::parse_launch(ENCODE_PIPELINE).unwrap(); let pipeline = gst::parse::launch(ENCODE_PIPELINE).unwrap();
let bus = pipeline.bus().unwrap(); let bus = pipeline.bus().unwrap();
pipeline pipeline

View file

@ -17,7 +17,7 @@ fn main() {
gst::init().unwrap(); gst::init().unwrap();
gstrspng::plugin_register_static().expect("Failed to register gif plugin"); gstrspng::plugin_register_static().expect("Failed to register gif plugin");
let pipeline = gst::parse_launch(ENCODE_PIPELINE).unwrap(); let pipeline = gst::parse::launch(ENCODE_PIPELINE).unwrap();
let bus = pipeline.bus().unwrap(); let bus = pipeline.bus().unwrap();
pipeline pipeline