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

github.com/sdroege/gst-plugin-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/net/ndi
diff options
context:
space:
mode:
authorVivia Nikolaidou <vivia.nikolaidou@ltnglobal.com>2022-10-12 16:03:07 +0300
committerSebastian Dröge <sebastian@centricular.com>2022-10-12 21:29:07 +0300
commitfedd67dcaab71642d71873cd4605030e0e5e3bd4 (patch)
treed5d769bebe02a4e0b4452a81c8a9d05841f0b65d /net/ndi
parent95e8deded92492169937be74de941de62fcacb1e (diff)
ndi: Use AudioCapsBuilder and VideoCapsBuilder
Simplify caps creation codes
Diffstat (limited to 'net/ndi')
-rw-r--r--net/ndi/src/ndisinkcombiner/imp.rs45
1 files changed, 16 insertions, 29 deletions
diff --git a/net/ndi/src/ndisinkcombiner/imp.rs b/net/ndi/src/ndisinkcombiner/imp.rs
index 0a4a67bf..1511e192 100644
--- a/net/ndi/src/ndisinkcombiner/imp.rs
+++ b/net/ndi/src/ndisinkcombiner/imp.rs
@@ -81,30 +81,19 @@ impl ElementImpl for NdiSinkCombiner {
fn pad_templates() -> &'static [gst::PadTemplate] {
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
- let caps = gst::Caps::builder("video/x-raw")
- .field(
- "format",
- &gst::List::new(&[
- &gst_video::VideoFormat::Uyvy.to_str(),
- &gst_video::VideoFormat::I420.to_str(),
- &gst_video::VideoFormat::Nv12.to_str(),
- &gst_video::VideoFormat::Nv21.to_str(),
- &gst_video::VideoFormat::Yv12.to_str(),
- &gst_video::VideoFormat::Bgra.to_str(),
- &gst_video::VideoFormat::Bgrx.to_str(),
- &gst_video::VideoFormat::Rgba.to_str(),
- &gst_video::VideoFormat::Rgbx.to_str(),
- ]),
- )
- .field("width", &gst::IntRange::<i32>::new(1, i32::MAX))
- .field("height", &gst::IntRange::<i32>::new(1, i32::MAX))
- .field(
- "framerate",
- &gst::FractionRange::new(
- gst::Fraction::new(1, i32::MAX),
- gst::Fraction::new(i32::MAX, 1),
- ),
- )
+ let caps = gst_video::VideoCapsBuilder::new()
+ .format_list([
+ gst_video::VideoFormat::Uyvy,
+ gst_video::VideoFormat::I420,
+ gst_video::VideoFormat::Nv12,
+ gst_video::VideoFormat::Nv21,
+ gst_video::VideoFormat::Yv12,
+ gst_video::VideoFormat::Bgra,
+ gst_video::VideoFormat::Bgrx,
+ gst_video::VideoFormat::Rgba,
+ gst_video::VideoFormat::Rgbx,
+ ])
+ .framerate_range(gst::Fraction::new(1, i32::MAX)..gst::Fraction::new(i32::MAX, 1))
.build();
let src_pad_template = gst::PadTemplate::with_gtype(
"src",
@@ -124,11 +113,9 @@ impl ElementImpl for NdiSinkCombiner {
)
.unwrap();
- let caps = gst::Caps::builder("audio/x-raw")
- .field("format", &gst_audio::AUDIO_FORMAT_F32.to_str())
- .field("rate", &gst::IntRange::<i32>::new(1, i32::MAX))
- .field("channels", &gst::IntRange::<i32>::new(1, i32::MAX))
- .field("layout", &"interleaved")
+ let caps = gst_audio::AudioCapsBuilder::new_interleaved()
+ .format(gst_audio::AUDIO_FORMAT_F32)
+ .rate_range(1..i32::MAX)
.build();
let audio_sink_pad_template = gst::PadTemplate::with_gtype(
"audio",