diff options
-rw-r--r-- | audio/audiofx/src/audioecho/imp.rs | 16 | ||||
-rw-r--r-- | audio/audiofx/src/audioloudnorm/imp.rs | 9 | ||||
-rw-r--r-- | audio/audiofx/src/audiornnoise/imp.rs | 9 | ||||
-rw-r--r-- | audio/audiofx/src/ebur128level/imp.rs | 26 | ||||
-rw-r--r-- | audio/claxon/src/claxondec/imp.rs | 23 | ||||
-rw-r--r-- | audio/claxon/tests/claxondec.rs | 10 | ||||
-rw-r--r-- | audio/csound/src/filter/imp.rs | 8 | ||||
-rw-r--r-- | video/flavors/Cargo.toml | 1 | ||||
-rw-r--r-- | video/flavors/src/flvdemux/imp.rs | 16 |
9 files changed, 54 insertions, 64 deletions
diff --git a/audio/audiofx/src/audioecho/imp.rs b/audio/audiofx/src/audioecho/imp.rs index d44874a37..1108f8817 100644 --- a/audio/audiofx/src/audioecho/imp.rs +++ b/audio/audiofx/src/audioecho/imp.rs @@ -12,7 +12,7 @@ use gst::subclass::prelude::*; use gst_base::subclass::prelude::*; use std::sync::Mutex; -use std::{cmp, i32, u64}; +use std::{cmp, u64}; use byte_slice_cast::*; @@ -209,17 +209,9 @@ impl ElementImpl for AudioEcho { fn pad_templates() -> &'static [gst::PadTemplate] { static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| { - 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("rate", gst::IntRange::new(0, i32::MAX)) - .field("channels", gst::IntRange::new(0, i32::MAX)) - .field("layout", "interleaved") + let caps = gst_audio::AudioCapsBuilder::new() + .format_list([gst_audio::AUDIO_FORMAT_F32, gst_audio::AUDIO_FORMAT_F64]) + .layout(gst_audio::AudioLayout::Interleaved) .build(); let src_pad_template = gst::PadTemplate::new( "src", diff --git a/audio/audiofx/src/audioloudnorm/imp.rs b/audio/audiofx/src/audioloudnorm/imp.rs index 63aced37f..44b2618e9 100644 --- a/audio/audiofx/src/audioloudnorm/imp.rs +++ b/audio/audiofx/src/audioloudnorm/imp.rs @@ -1880,11 +1880,10 @@ impl ElementImpl for AudioLoudNorm { fn pad_templates() -> &'static [gst::PadTemplate] { static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| { - let caps = gst::Caps::builder("audio/x-raw") - .field("format", gst_audio::AUDIO_FORMAT_F64.to_str()) - .field("rate", 192_000i32) - .field("channels", gst::IntRange::new(1, std::i32::MAX)) - .field("layout", "interleaved") + let caps = gst_audio::AudioCapsBuilder::new() + .format(gst_audio::AUDIO_FORMAT_F64) + .rate(192_000) + .layout(gst_audio::AudioLayout::Interleaved) .build(); let src_pad_template = gst::PadTemplate::new( "src", diff --git a/audio/audiofx/src/audiornnoise/imp.rs b/audio/audiofx/src/audiornnoise/imp.rs index 3633ec351..d27bf0634 100644 --- a/audio/audiofx/src/audiornnoise/imp.rs +++ b/audio/audiofx/src/audiornnoise/imp.rs @@ -224,11 +224,10 @@ impl ElementImpl for AudioRNNoise { fn pad_templates() -> &'static [gst::PadTemplate] { static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| { - let caps = gst::Caps::builder("audio/x-raw") - .field("format", gst_audio::AUDIO_FORMAT_F32.to_str()) - .field("rate", 48000) - .field("channels", gst::IntRange::new(1, std::i32::MAX)) - .field("layout", "interleaved") + let caps = gst_audio::AudioCapsBuilder::new() + .format(gst_audio::AUDIO_FORMAT_F32) + .rate(48000) + .layout(gst_audio::AudioLayout::Interleaved) .build(); let src_pad_template = gst::PadTemplate::new( "src", diff --git a/audio/audiofx/src/ebur128level/imp.rs b/audio/audiofx/src/ebur128level/imp.rs index a8b176cc3..989c5f7bc 100644 --- a/audio/audiofx/src/ebur128level/imp.rs +++ b/audio/audiofx/src/ebur128level/imp.rs @@ -250,21 +250,21 @@ impl ElementImpl for EbuR128Level { fn pad_templates() -> &'static [gst::PadTemplate] { static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| { - let caps = gst::Caps::builder("audio/x-raw") - .field( - "format", - gst::List::new([ - gst_audio::AUDIO_FORMAT_S16.to_str(), - gst_audio::AUDIO_FORMAT_S32.to_str(), - gst_audio::AUDIO_FORMAT_F32.to_str(), - gst_audio::AUDIO_FORMAT_F64.to_str(), - ]), - ) - .field("layout", gst::List::new(["interleaved", "non-interleaved"])) + let caps = gst_audio::AudioCapsBuilder::new() + .format_list([ + gst_audio::AUDIO_FORMAT_S16, + gst_audio::AUDIO_FORMAT_S32, + gst_audio::AUDIO_FORMAT_F32, + gst_audio::AUDIO_FORMAT_F64, + ]) // Limit from ebur128 - .field("rate", gst::IntRange::new(1i32, 2_822_400)) + .rate_range(1..2_822_400) // Limit from ebur128 - .field("channels", gst::IntRange::new(1i32, 64)) + .channels_range(1..64) + .layout_list([ + gst_audio::AudioLayout::Interleaved, + gst_audio::AudioLayout::NonInterleaved, + ]) .build(); let src_pad_template = gst::PadTemplate::new( "src", diff --git a/audio/claxon/src/claxondec/imp.rs b/audio/claxon/src/claxondec/imp.rs index 76ae65f10..d2c05f6e0 100644 --- a/audio/claxon/src/claxondec/imp.rs +++ b/audio/claxon/src/claxondec/imp.rs @@ -76,19 +76,16 @@ impl ElementImpl for ClaxonDec { ) .unwrap(); - let src_caps = gst::Caps::builder("audio/x-raw") - .field( - "format", - gst::List::new([ - gst_audio::AudioFormat::S8.to_str(), - gst_audio::AUDIO_FORMAT_S16.to_str(), - gst_audio::AUDIO_FORMAT_S2432.to_str(), - gst_audio::AUDIO_FORMAT_S32.to_str(), - ]), - ) - .field("rate", gst::IntRange::new(1i32, 655_350)) - .field("channels", gst::IntRange::new(1i32, 8)) - .field("layout", "interleaved") + let src_caps = gst_audio::AudioCapsBuilder::new() + .format_list([ + gst_audio::AudioFormat::S8, + gst_audio::AUDIO_FORMAT_S16, + gst_audio::AUDIO_FORMAT_S2432, + gst_audio::AUDIO_FORMAT_S32, + ]) + .rate_range(1..655_350) + .channels_range(1..8) + .layout(gst_audio::AudioLayout::Interleaved) .build(); let src_pad_template = gst::PadTemplate::new( "src", diff --git a/audio/claxon/tests/claxondec.rs b/audio/claxon/tests/claxondec.rs index 307dd197e..31b327ead 100644 --- a/audio/claxon/tests/claxondec.rs +++ b/audio/claxon/tests/claxondec.rs @@ -31,11 +31,11 @@ fn test_mono_s16() { assert_eq!( caps, - gst::Caps::builder("audio/x-raw") - .field("format", gst_audio::AUDIO_FORMAT_S16.to_str()) - .field("rate", 44_100i32) - .field("channels", 1i32) - .field("layout", "interleaved") + gst_audio::AudioCapsBuilder::new() + .layout(gst_audio::AudioLayout::Interleaved) + .format(gst_audio::AUDIO_FORMAT_S16) + .rate(44_100) + .channels(1) .build() ); } diff --git a/audio/csound/src/filter/imp.rs b/audio/csound/src/filter/imp.rs index 2761f7e8a..4972fea3a 100644 --- a/audio/csound/src/filter/imp.rs +++ b/audio/csound/src/filter/imp.rs @@ -453,11 +453,9 @@ impl ElementImpl for CsoundFilter { fn pad_templates() -> &'static [gst::PadTemplate] { static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| { - let caps = gst::Caps::builder("audio/x-raw") - .field("format", gst_audio::AUDIO_FORMAT_F64.to_str()) - .field("rate", gst::IntRange::new(1, i32::MAX)) - .field("channels", gst::IntRange::new(1, i32::MAX)) - .field("layout", "interleaved") + let caps = gst_audio::AudioCapsBuilder::new() + .format(gst_audio::AUDIO_FORMAT_F64) + .layout(gst_audio::AudioLayout::Interleaved) .build(); let src_pad_template = gst::PadTemplate::new( "src", diff --git a/video/flavors/Cargo.toml b/video/flavors/Cargo.toml index df8decec5..092b898c6 100644 --- a/video/flavors/Cargo.toml +++ b/video/flavors/Cargo.toml @@ -11,6 +11,7 @@ description = "Rust FLV Plugin" [dependencies] gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } +gst-audio = { package = "gstreamer-audio", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } num-rational = { version = "0.4", default-features = false, features = [] } nom = "7" flavors = { git = "https://github.com/rust-av/flavors" } diff --git a/video/flavors/src/flvdemux/imp.rs b/video/flavors/src/flvdemux/imp.rs index 36d010a38..44a33db3b 100644 --- a/video/flavors/src/flvdemux/imp.rs +++ b/video/flavors/src/flvdemux/imp.rs @@ -215,9 +215,9 @@ impl ElementImpl for FlvDemux { .build(), ); caps.append( - gst::Caps::builder("audio/x-raw") - .field("layout", "interleaved") - .field("format", gst::List::new(["U8", "S16LE"])) + gst_audio::AudioCapsBuilder::new() + .layout(gst_audio::AudioLayout::Interleaved) + .format_list([gst_audio::AudioFormat::U8, gst_audio::AudioFormat::S16le]) .build(), ); caps.append( @@ -1280,9 +1280,13 @@ impl AudioFormat { // Assume little-endian for "PCM_NE", it's probably more common and we have no // way to know what the endianness of the system creating the stream was Some( - gst::Caps::builder("audio/x-raw") - .field("layout", "interleaved") - .field("format", if self.width == 8 { "U8" } else { "S16LE" }) + gst_audio::AudioCapsBuilder::new() + .layout(gst_audio::AudioLayout::Interleaved) + .format(if self.width == 8 { + gst_audio::AudioFormat::U8 + } else { + gst_audio::AudioFormat::S16le + }) .build(), ) } else { |