Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2021-11-06 10:34:10 +0300
committerSebastian Dröge <sebastian@centricular.com>2021-11-06 10:34:10 +0300
commitd9bda62a4720c0539a443a4e489645e9bb4af1eb (patch)
treed59eef871715fda4a9b37e355909a345dbd598d0 /tutorial/src
parentc99b7785f941fa4f9388a88e52d74c0fa34129ec (diff)
Update for GLib/GStreamer API changes
And clean up a lot of related property/caps/structure code.
Diffstat (limited to 'tutorial/src')
-rw-r--r--tutorial/src/progressbin/imp.rs2
-rw-r--r--tutorial/src/rgb2gray/imp.rs62
-rw-r--r--tutorial/src/sinesrc/imp.rs27
3 files changed, 41 insertions, 50 deletions
diff --git a/tutorial/src/progressbin/imp.rs b/tutorial/src/progressbin/imp.rs
index aebf2f3cf..9546fc400 100644
--- a/tutorial/src/progressbin/imp.rs
+++ b/tutorial/src/progressbin/imp.rs
@@ -64,7 +64,7 @@ impl ObjectSubclass for ProgressBin {
// Create the progressreport element.
let progress = gst::ElementFactory::make("progressreport", Some("progress")).unwrap();
// Don't let progressreport print to stdout itself
- progress.set_property("silent", &true).unwrap();
+ progress.set_property("silent", true).unwrap();
// Return an instance of our struct
Self {
diff --git a/tutorial/src/rgb2gray/imp.rs b/tutorial/src/rgb2gray/imp.rs
index b6ba9a3ed..06d90dc2d 100644
--- a/tutorial/src/rgb2gray/imp.rs
+++ b/tutorial/src/rgb2gray/imp.rs
@@ -205,27 +205,24 @@ impl ElementImpl for Rgb2Gray {
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
// On the src pad, we can produce BGRx and GRAY8 of any
// width/height and with any framerate
- let caps = gst::Caps::new_simple(
- "video/x-raw",
- &[
- (
- "format",
- &gst::List::new(&[
- &gst_video::VideoFormat::Bgrx.to_str(),
- &gst_video::VideoFormat::Gray8.to_str(),
- ]),
+ let caps = gst::Caps::builder("video/x-raw")
+ .field(
+ "format",
+ gst::List::new([
+ gst_video::VideoFormat::Bgrx.to_str(),
+ gst_video::VideoFormat::Gray8.to_str(),
+ ]),
+ )
+ .field("width", gst::IntRange::new(0, i32::MAX))
+ .field("height", gst::IntRange::new(0, i32::MAX))
+ .field(
+ "framerate",
+ gst::FractionRange::new(
+ gst::Fraction::new(0, 1),
+ gst::Fraction::new(i32::MAX, 1),
),
- ("width", &gst::IntRange::<i32>::new(0, i32::MAX)),
- ("height", &gst::IntRange::<i32>::new(0, i32::MAX)),
- (
- "framerate",
- &gst::FractionRange::new(
- gst::Fraction::new(0, 1),
- gst::Fraction::new(i32::MAX, 1),
- ),
- ),
- ],
- );
+ )
+ .build();
// The src pad template must be named "src" for basetransform
// and specific a pad that is always there
let src_pad_template = gst::PadTemplate::new(
@@ -238,21 +235,18 @@ impl ElementImpl for Rgb2Gray {
// On the sink pad, we can accept BGRx of any
// width/height and with any framerate
- let caps = gst::Caps::new_simple(
- "video/x-raw",
- &[
- ("format", &gst_video::VideoFormat::Bgrx.to_str()),
- ("width", &gst::IntRange::<i32>::new(0, i32::MAX)),
- ("height", &gst::IntRange::<i32>::new(0, i32::MAX)),
- (
- "framerate",
- &gst::FractionRange::new(
- gst::Fraction::new(0, 1),
- gst::Fraction::new(i32::MAX, 1),
- ),
+ let caps = gst::Caps::builder("video/x-raw")
+ .field("format", gst_video::VideoFormat::Bgrx.to_str())
+ .field("width", gst::IntRange::new(0, i32::MAX))
+ .field("height", gst::IntRange::new(0, i32::MAX))
+ .field(
+ "framerate",
+ gst::FractionRange::new(
+ gst::Fraction::new(0, 1),
+ gst::Fraction::new(i32::MAX, 1),
),
- ],
- );
+ )
+ .build();
// The sink pad template must be named "sink" for basetransform
// and specific a pad that is always there
let sink_pad_template = gst::PadTemplate::new(
diff --git a/tutorial/src/sinesrc/imp.rs b/tutorial/src/sinesrc/imp.rs
index 938556a7f..4ada4ddd0 100644
--- a/tutorial/src/sinesrc/imp.rs
+++ b/tutorial/src/sinesrc/imp.rs
@@ -360,21 +360,18 @@ impl ElementImpl for SineSrc {
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
// On the src pad, we can produce F32/F64 with any sample rate
// and any number of channels
- let caps = gst::Caps::new_simple(
- "audio/x-raw",
- &[
- (
- "format",
- &gst::List::new(&[
- &gst_audio::AUDIO_FORMAT_F32.to_str(),
- &gst_audio::AUDIO_FORMAT_F64.to_str(),
- ]),
- ),
- ("layout", &"interleaved"),
- ("rate", &gst::IntRange::<i32>::new(1, i32::MAX)),
- ("channels", &gst::IntRange::<i32>::new(1, i32::MAX)),
- ],
- );
+ let caps = gst::Caps::builder("audio/x-raw")
+ .field(
+ "format",
+ gst::List::new([
+ gst_audio::AUDIO_FORMAT_F32.to_str(),
+ gst_audio::AUDIO_FORMAT_F64.to_str(),
+ ]),
+ )
+ .field("layout", "interleaved")
+ .field("rate", gst::IntRange::new(1, i32::MAX))
+ .field("channels", gst::IntRange::new(1, i32::MAX))
+ .build();
// The src pad template must be named "src" for basesrc
// and specific a pad that is always there
let src_pad_template = gst::PadTemplate::new(