mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 19:11:06 +00:00
gstreamer: Add bin/pipeline builders
And also implement the Default trait for them.
This commit is contained in:
parent
2a4e1069a1
commit
a1165a7456
26 changed files with 189 additions and 25 deletions
|
@ -35,7 +35,7 @@ struct ErrorMessage {
|
||||||
fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
||||||
gst::init()?;
|
gst::init()?;
|
||||||
|
|
||||||
let pipeline = gst::Pipeline::new(None);
|
let pipeline = gst::Pipeline::default();
|
||||||
let src = gst::ElementFactory::make("audiotestsrc").build()?;
|
let src = gst::ElementFactory::make("audiotestsrc").build()?;
|
||||||
let appsink = gst_app::AppSink::builder()
|
let appsink = gst_app::AppSink::builder()
|
||||||
// Tell the appsink what format we want. It will then be the audiotestsrc's job to
|
// Tell the appsink what format we want. It will then be the audiotestsrc's job to
|
||||||
|
|
|
@ -33,7 +33,7 @@ const HEIGHT: usize = 240;
|
||||||
fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
||||||
gst::init()?;
|
gst::init()?;
|
||||||
|
|
||||||
let pipeline = gst::Pipeline::new(None);
|
let pipeline = gst::Pipeline::default();
|
||||||
|
|
||||||
// Specify the format we want to provide as application into the pipeline
|
// Specify the format we want to provide as application into the pipeline
|
||||||
// by creating a video info with the given format and creating caps from it for the appsrc element.
|
// by creating a video info with the given format and creating caps from it for the appsrc element.
|
||||||
|
|
|
@ -566,7 +566,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
||||||
gst::init()?;
|
gst::init()?;
|
||||||
|
|
||||||
// Create our pipeline with the compositor and two input streams.
|
// Create our pipeline with the compositor and two input streams.
|
||||||
let pipeline = gst::Pipeline::new(None);
|
let pipeline = gst::Pipeline::default();
|
||||||
let src1 = gst::ElementFactory::make("videotestsrc")
|
let src1 = gst::ElementFactory::make("videotestsrc")
|
||||||
.property_from_str("pattern", "ball")
|
.property_from_str("pattern", "ball")
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
|
@ -181,7 +181,7 @@ fn example_main() {
|
||||||
gst::init().unwrap();
|
gst::init().unwrap();
|
||||||
|
|
||||||
// This creates a pipeline with appsrc and appsink.
|
// This creates a pipeline with appsrc and appsink.
|
||||||
let pipeline = gst::Pipeline::new(None);
|
let pipeline = gst::Pipeline::default();
|
||||||
let appsrc = gst_app::AppSrc::builder().build();
|
let appsrc = gst_app::AppSrc::builder().build();
|
||||||
let appsink = gst_app::AppSink::builder().build();
|
let appsink = gst_app::AppSink::builder().build();
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ fn example_main() -> Result<(), Error> {
|
||||||
std::process::exit(-1)
|
std::process::exit(-1)
|
||||||
};
|
};
|
||||||
|
|
||||||
let pipeline = gst::Pipeline::new(None);
|
let pipeline = gst::Pipeline::default();
|
||||||
let src = gst::ElementFactory::make("filesrc")
|
let src = gst::ElementFactory::make("filesrc")
|
||||||
.property("location", uri)
|
.property("location", uri)
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
|
@ -85,7 +85,7 @@ fn example_main() -> Result<(), Error> {
|
||||||
std::process::exit(-1)
|
std::process::exit(-1)
|
||||||
};
|
};
|
||||||
|
|
||||||
let pipeline = gst::Pipeline::new(None);
|
let pipeline = gst::Pipeline::default();
|
||||||
let src = gst::ElementFactory::make("uridecodebin")
|
let src = gst::ElementFactory::make("uridecodebin")
|
||||||
.property("uri", uri)
|
.property("uri", uri)
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
|
@ -46,7 +46,7 @@ fn create_receiver_pipeline(
|
||||||
) -> Result<gst::Pipeline, Error> {
|
) -> Result<gst::Pipeline, Error> {
|
||||||
let caps = video_info.to_caps()?;
|
let caps = video_info.to_caps()?;
|
||||||
|
|
||||||
let pipeline = gst::Pipeline::new(None);
|
let pipeline = gst::Pipeline::default();
|
||||||
let src = gst_app::AppSrc::builder()
|
let src = gst_app::AppSrc::builder()
|
||||||
.caps(&caps)
|
.caps(&caps)
|
||||||
.do_timestamp(true)
|
.do_timestamp(true)
|
||||||
|
@ -117,7 +117,7 @@ fn create_sender_pipeline(
|
||||||
let sender = Arc::new(Mutex::new(sender));
|
let sender = Arc::new(Mutex::new(sender));
|
||||||
let caps = video_info.to_caps()?;
|
let caps = video_info.to_caps()?;
|
||||||
|
|
||||||
let pipeline = gst::Pipeline::new(None);
|
let pipeline = gst::Pipeline::default();
|
||||||
let src = gst::ElementFactory::make("videotestsrc")
|
let src = gst::ElementFactory::make("videotestsrc")
|
||||||
.property("num-buffers", 250i32)
|
.property("num-buffers", 250i32)
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
|
@ -19,7 +19,7 @@ use gtk::prelude::*;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
|
||||||
fn create_ui(app: >k::Application) {
|
fn create_ui(app: >k::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();
|
||||||
// Create the gtk sink and retrieve the widget from it. The sink element will be used
|
// Create the gtk sink and retrieve the widget from it. The sink element will be used
|
||||||
// in the pipeline, and the widget will be embedded in our gui.
|
// in the pipeline, and the widget will be embedded in our gui.
|
||||||
|
|
|
@ -101,7 +101,7 @@ fn set_window_handle(video_overlay: &gst_video::VideoOverlay, gdk_window: &gdk::
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_ui(app: >k::Application) {
|
fn create_ui(app: >k::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();
|
||||||
|
|
||||||
// Since using the window system to overlay our gui window is making
|
// Since using the window system to overlay our gui window is making
|
||||||
|
|
|
@ -53,7 +53,7 @@ unsafe impl Send for LayoutWrapper {}
|
||||||
fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
||||||
gst::init()?;
|
gst::init()?;
|
||||||
|
|
||||||
let pipeline = gst::Pipeline::new(None);
|
let pipeline = gst::Pipeline::default();
|
||||||
|
|
||||||
// The videotestsrc supports multiple test patterns. In this example, we will use the
|
// The videotestsrc supports multiple test patterns. In this example, we will use the
|
||||||
// pattern with a white ball moving around the video's center point.
|
// pattern with a white ball moving around the video's center point.
|
||||||
|
|
|
@ -56,7 +56,7 @@ unsafe impl Send for LayoutWrapper {}
|
||||||
fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
||||||
gst::init()?;
|
gst::init()?;
|
||||||
|
|
||||||
let pipeline = gst::Pipeline::new(None);
|
let pipeline = gst::Pipeline::default();
|
||||||
let src = gst::ElementFactory::make("videotestsrc")
|
let src = gst::ElementFactory::make("videotestsrc")
|
||||||
// The videotestsrc supports multiple test patterns. In this example, we will use the
|
// The videotestsrc supports multiple test patterns. In this example, we will use the
|
||||||
// pattern with a white ball moving around the video's center point.
|
// pattern with a white ball moving around the video's center point.
|
||||||
|
|
|
@ -87,7 +87,7 @@ fn example_main() -> Result<(), Error> {
|
||||||
|
|
||||||
let drop_probability = args[2].parse::<f32>()?;
|
let drop_probability = args[2].parse::<f32>()?;
|
||||||
|
|
||||||
let pipeline = gst::Pipeline::new(None);
|
let pipeline = gst::Pipeline::default();
|
||||||
|
|
||||||
let rtp_caps = gst::Caps::builder("application/x-rtp")
|
let rtp_caps = gst::Caps::builder("application/x-rtp")
|
||||||
.field("clock-rate", 90000i32)
|
.field("clock-rate", 90000i32)
|
||||||
|
|
|
@ -77,7 +77,7 @@ fn example_main() -> Result<(), Error> {
|
||||||
|
|
||||||
let video_caps = gst::Caps::builder("video/x-raw").build();
|
let video_caps = gst::Caps::builder("video/x-raw").build();
|
||||||
|
|
||||||
let pipeline = gst::Pipeline::new(None);
|
let pipeline = gst::Pipeline::default();
|
||||||
let src = gst::ElementFactory::make("uridecodebin")
|
let src = gst::ElementFactory::make("uridecodebin")
|
||||||
.property_from_str("pattern", "ball")
|
.property_from_str("pattern", "ball")
|
||||||
.property("expose-all-streams", false)
|
.property("expose-all-streams", false)
|
||||||
|
|
|
@ -120,7 +120,7 @@ mod media_factory {
|
||||||
impl RTSPMediaFactoryImpl for Factory {
|
impl RTSPMediaFactoryImpl for Factory {
|
||||||
fn create_element(&self, _url: &gst_rtsp::RTSPUrl) -> Option<gst::Element> {
|
fn create_element(&self, _url: &gst_rtsp::RTSPUrl) -> Option<gst::Element> {
|
||||||
// Create a simple VP8 videotestsrc input
|
// Create a simple VP8 videotestsrc input
|
||||||
let bin = gst::Bin::new(None);
|
let bin = gst::Bin::default();
|
||||||
let src = gst::ElementFactory::make("videotestsrc")
|
let src = gst::ElementFactory::make("videotestsrc")
|
||||||
// Configure the videotestsrc live
|
// Configure the videotestsrc live
|
||||||
.property("is-live", true)
|
.property("is-live", true)
|
||||||
|
|
|
@ -244,7 +244,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
||||||
gst::init()?;
|
gst::init()?;
|
||||||
|
|
||||||
// Create our pipeline with the custom element
|
// Create our pipeline with the custom element
|
||||||
let pipeline = gst::Pipeline::new(None);
|
let pipeline = gst::Pipeline::default();
|
||||||
let src = gst::ElementFactory::make("audiotestsrc")
|
let src = gst::ElementFactory::make("audiotestsrc")
|
||||||
.property_from_str("wave", "white-noise")
|
.property_from_str("wave", "white-noise")
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
|
@ -27,7 +27,7 @@ fn example_main() {
|
||||||
std::process::exit(-1)
|
std::process::exit(-1)
|
||||||
};
|
};
|
||||||
|
|
||||||
let pipeline = gst::Pipeline::new(None);
|
let pipeline = gst::Pipeline::default();
|
||||||
let src = gst::ElementFactory::make("filesrc")
|
let src = gst::ElementFactory::make("filesrc")
|
||||||
.property("location", uri)
|
.property("location", uri)
|
||||||
.build()
|
.build()
|
||||||
|
|
|
@ -52,7 +52,7 @@ fn example_main() -> Result<(), Error> {
|
||||||
std::process::exit(-1)
|
std::process::exit(-1)
|
||||||
};
|
};
|
||||||
|
|
||||||
let pipeline = gst::Pipeline::new(None);
|
let pipeline = gst::Pipeline::default();
|
||||||
let src = gst::Element::make_from_uri(gst::URIType::Src, uri, None)
|
let src = gst::Element::make_from_uri(gst::URIType::Src, uri, None)
|
||||||
.expect("We do not seem to support this uri");
|
.expect("We do not seem to support this uri");
|
||||||
let typefinder = gst::ElementFactory::make("typefind").build()?;
|
let typefinder = gst::ElementFactory::make("typefind").build()?;
|
||||||
|
|
|
@ -530,7 +530,7 @@ impl App {
|
||||||
fn create_pipeline(
|
fn create_pipeline(
|
||||||
gl_element: Option<&gst::Element>,
|
gl_element: Option<&gst::Element>,
|
||||||
) -> Result<(gst::Pipeline, gst_app::AppSink, gst::Element), Error> {
|
) -> Result<(gst::Pipeline, gst_app::AppSink, gst::Element), Error> {
|
||||||
let pipeline = gst::Pipeline::new(None);
|
let pipeline = gst::Pipeline::default();
|
||||||
let src = gst::ElementFactory::make("videotestsrc").build()?;
|
let src = gst::ElementFactory::make("videotestsrc").build()?;
|
||||||
|
|
||||||
let caps = gst_video::VideoCapsBuilder::new()
|
let caps = gst_video::VideoCapsBuilder::new()
|
||||||
|
|
|
@ -15,6 +15,16 @@ use std::boxed::Box as Box_;
|
||||||
use std::mem::transmute;
|
use std::mem::transmute;
|
||||||
use std::path;
|
use std::path;
|
||||||
|
|
||||||
|
impl Bin {
|
||||||
|
// rustdoc-stripper-ignore-next
|
||||||
|
/// Creates a new builder-pattern struct instance to construct [`Bin`] objects.
|
||||||
|
///
|
||||||
|
/// This method returns an instance of [`BinBuilder`](crate::builders::BinBuilder) which can be used to create [`Bin`] objects.
|
||||||
|
pub fn builder() -> BinBuilder {
|
||||||
|
BinBuilder::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub trait GstBinExtManual: 'static {
|
pub trait GstBinExtManual: 'static {
|
||||||
#[doc(alias = "gst_bin_add_many")]
|
#[doc(alias = "gst_bin_add_many")]
|
||||||
fn add_many<E: IsA<Element>>(&self, elements: &[&E]) -> Result<(), glib::BoolError>;
|
fn add_many<E: IsA<Element>>(&self, elements: &[&E]) -> Result<(), glib::BoolError>;
|
||||||
|
@ -215,6 +225,64 @@ impl<O: IsA<Bin>> GstBinExtManual for O {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for Bin {
|
||||||
|
fn default() -> Self {
|
||||||
|
glib::object::Object::new::<Self>(&[])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Default)]
|
||||||
|
// rustdoc-stripper-ignore-next
|
||||||
|
/// A [builder-pattern] type to construct [`Bin`] objects.
|
||||||
|
///
|
||||||
|
/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
|
||||||
|
#[must_use = "The builder must be built to be used"]
|
||||||
|
pub struct BinBuilder {
|
||||||
|
async_handling: Option<bool>,
|
||||||
|
message_forward: Option<bool>,
|
||||||
|
name: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl BinBuilder {
|
||||||
|
// rustdoc-stripper-ignore-next
|
||||||
|
/// Create a new [`BinBuilder`].
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self::default()
|
||||||
|
}
|
||||||
|
|
||||||
|
// rustdoc-stripper-ignore-next
|
||||||
|
/// Build the [`Bin`].
|
||||||
|
#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
|
||||||
|
pub fn build(self) -> Bin {
|
||||||
|
let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
|
||||||
|
if let Some(ref async_handling) = self.async_handling {
|
||||||
|
properties.push(("async-handling", async_handling));
|
||||||
|
}
|
||||||
|
if let Some(ref message_forward) = self.message_forward {
|
||||||
|
properties.push(("message-forward", message_forward));
|
||||||
|
}
|
||||||
|
if let Some(ref name) = self.name {
|
||||||
|
properties.push(("name", name));
|
||||||
|
}
|
||||||
|
glib::Object::new::<Bin>(&properties)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn async_handling(mut self, async_handling: bool) -> Self {
|
||||||
|
self.async_handling = Some(async_handling);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn message_forward(mut self, message_forward: bool) -> Self {
|
||||||
|
self.message_forward = Some(message_forward);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn name(mut self, name: &str) -> Self {
|
||||||
|
self.name = Some(name.to_string());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn do_latency_trampoline<
|
unsafe extern "C" fn do_latency_trampoline<
|
||||||
P,
|
P,
|
||||||
F: Fn(&P) -> Result<(), LoggableError> + Send + Sync + 'static,
|
F: Fn(&P) -> Result<(), LoggableError> + Send + Sync + 'static,
|
||||||
|
|
|
@ -3,8 +3,19 @@
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
|
|
||||||
|
use crate::Pipeline;
|
||||||
use crate::PipelineFlags;
|
use crate::PipelineFlags;
|
||||||
|
|
||||||
|
impl Pipeline {
|
||||||
|
// rustdoc-stripper-ignore-next
|
||||||
|
/// Creates a new builder-pattern struct instance to construct [`Pipeline`] objects.
|
||||||
|
///
|
||||||
|
/// This method returns an instance of [`PipelineBuilder`](crate::builders::PipelineBuilder) which can be used to create [`Pipeline`] objects.
|
||||||
|
pub fn builder() -> PipelineBuilder {
|
||||||
|
PipelineBuilder::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub trait GstPipelineExtManual: 'static {
|
pub trait GstPipelineExtManual: 'static {
|
||||||
fn set_pipeline_flags(&self, flags: PipelineFlags);
|
fn set_pipeline_flags(&self, flags: PipelineFlags);
|
||||||
|
|
||||||
|
@ -39,3 +50,88 @@ impl<O: IsA<crate::Pipeline>> GstPipelineExtManual for O {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for Pipeline {
|
||||||
|
fn default() -> Self {
|
||||||
|
glib::object::Object::new::<Self>(&[])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Default)]
|
||||||
|
// rustdoc-stripper-ignore-next
|
||||||
|
/// A [builder-pattern] type to construct [`Pipeline`] objects.
|
||||||
|
///
|
||||||
|
/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
|
||||||
|
#[must_use = "The builder must be built to be used"]
|
||||||
|
pub struct PipelineBuilder {
|
||||||
|
auto_flush_bus: Option<bool>,
|
||||||
|
delay: Option<u64>,
|
||||||
|
latency: Option<u64>,
|
||||||
|
async_handling: Option<bool>,
|
||||||
|
message_forward: Option<bool>,
|
||||||
|
name: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PipelineBuilder {
|
||||||
|
// rustdoc-stripper-ignore-next
|
||||||
|
/// Create a new [`PipelineBuilder`].
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self::default()
|
||||||
|
}
|
||||||
|
|
||||||
|
// rustdoc-stripper-ignore-next
|
||||||
|
/// Build the [`Pipeline`].
|
||||||
|
#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
|
||||||
|
pub fn build(self) -> Pipeline {
|
||||||
|
let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
|
||||||
|
if let Some(ref auto_flush_bus) = self.auto_flush_bus {
|
||||||
|
properties.push(("auto-flush-bus", auto_flush_bus));
|
||||||
|
}
|
||||||
|
if let Some(ref delay) = self.delay {
|
||||||
|
properties.push(("delay", delay));
|
||||||
|
}
|
||||||
|
if let Some(ref latency) = self.latency {
|
||||||
|
properties.push(("latency", latency));
|
||||||
|
}
|
||||||
|
if let Some(ref async_handling) = self.async_handling {
|
||||||
|
properties.push(("async-handling", async_handling));
|
||||||
|
}
|
||||||
|
if let Some(ref message_forward) = self.message_forward {
|
||||||
|
properties.push(("message-forward", message_forward));
|
||||||
|
}
|
||||||
|
if let Some(ref name) = self.name {
|
||||||
|
properties.push(("name", name));
|
||||||
|
}
|
||||||
|
glib::Object::new::<Pipeline>(&properties)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn auto_flush_bus(mut self, auto_flush_bus: bool) -> Self {
|
||||||
|
self.auto_flush_bus = Some(auto_flush_bus);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn delay(mut self, delay: u64) -> Self {
|
||||||
|
self.delay = Some(delay);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn latency(mut self, latency: u64) -> Self {
|
||||||
|
self.latency = Some(latency);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn async_handling(mut self, async_handling: bool) -> Self {
|
||||||
|
self.async_handling = Some(async_handling);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn message_forward(mut self, message_forward: bool) -> Self {
|
||||||
|
self.message_forward = Some(message_forward);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn name(mut self, name: &str) -> Self {
|
||||||
|
self.name = Some(name.to_string());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ fn tutorial_main() {
|
||||||
.expect("Could not create sink element");
|
.expect("Could not create sink element");
|
||||||
|
|
||||||
// Create the empty pipeline
|
// Create the empty pipeline
|
||||||
let pipeline = gst::Pipeline::new(Some("test-pipeline"));
|
let pipeline = gst::Pipeline::builder().name("test-pipeline").build();
|
||||||
|
|
||||||
// Build the pipeline
|
// Build the pipeline
|
||||||
pipeline.add_many(&[&source, &sink]).unwrap();
|
pipeline.add_many(&[&source, &sink]).unwrap();
|
||||||
|
|
|
@ -31,7 +31,7 @@ fn tutorial_main() {
|
||||||
.expect("Could not create resample element.");
|
.expect("Could not create resample element.");
|
||||||
|
|
||||||
// Create the empty pipeline
|
// Create the empty pipeline
|
||||||
let pipeline = gst::Pipeline::new(Some("test-pipeline"));
|
let pipeline = gst::Pipeline::builder().name("test-pipeline").build();
|
||||||
|
|
||||||
// Build the pipeline Note that we are NOT linking the source at this
|
// Build the pipeline Note that we are NOT linking the source at this
|
||||||
// point. We will do it later.
|
// point. We will do it later.
|
||||||
|
|
|
@ -101,7 +101,7 @@ fn tutorial_main() {
|
||||||
.expect("Failed to create sink element");
|
.expect("Failed to create sink element");
|
||||||
|
|
||||||
// Create the empty pipeline
|
// Create the empty pipeline
|
||||||
let pipeline = gst::Pipeline::new(Some("test-pipeline"));
|
let pipeline = gst::Pipeline::builder().name("test-pipeline").build();
|
||||||
|
|
||||||
pipeline.add_many(&[&source, &sink]).unwrap();
|
pipeline.add_many(&[&source, &sink]).unwrap();
|
||||||
source.link(&sink).expect("Elements could not be linked.");
|
source.link(&sink).expect("Elements could not be linked.");
|
||||||
|
|
|
@ -54,7 +54,7 @@ fn tutorial_main() {
|
||||||
.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(&[
|
.add_many(&[
|
||||||
|
|
|
@ -108,7 +108,7 @@ fn main() {
|
||||||
.name("app_sink")
|
.name("app_sink")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let pipeline = gst::Pipeline::new(Some("test-pipeline"));
|
let pipeline = gst::Pipeline::builder().name("test-pipeline").build();
|
||||||
|
|
||||||
pipeline
|
pipeline
|
||||||
.add_many(&[
|
.add_many(&[
|
||||||
|
|
|
@ -28,7 +28,7 @@ fn tutorial_main() -> Result<(), Error> {
|
||||||
.expect("Could not create autoaudiosink element.");
|
.expect("Could not create autoaudiosink element.");
|
||||||
|
|
||||||
// Create the sink bin, add the elements and link them
|
// Create the sink bin, add the elements and link them
|
||||||
let bin = gst::Bin::new(Some("audio_sink_bin"));
|
let bin = gst::Bin::builder().name("audio_sink_bin").build();
|
||||||
bin.add_many(&[&equalizer, &convert, &sink]).unwrap();
|
bin.add_many(&[&equalizer, &convert, &sink]).unwrap();
|
||||||
gst::Element::link_many(&[&equalizer, &convert, &sink]).expect("Failed to link elements.");
|
gst::Element::link_many(&[&equalizer, &convert, &sink]).expect("Failed to link elements.");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue