audio, video: Use AudioCapsBuilder::new_interleaved where applicable

Further code simplification
This commit is contained in:
Vivia Nikolaidou 2022-08-10 13:45:52 +03:00
parent bdaa39e267
commit 07cbc2f025
7 changed files with 8 additions and 16 deletions

View file

@ -209,9 +209,8 @@ impl ElementImpl for AudioEcho {
fn pad_templates() -> &'static [gst::PadTemplate] {
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
let caps = gst_audio::AudioCapsBuilder::new()
let caps = gst_audio::AudioCapsBuilder::new_interleaved()
.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",

View file

@ -1880,10 +1880,9 @@ impl ElementImpl for AudioLoudNorm {
fn pad_templates() -> &'static [gst::PadTemplate] {
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
let caps = gst_audio::AudioCapsBuilder::new()
let caps = gst_audio::AudioCapsBuilder::new_interleaved()
.format(gst_audio::AUDIO_FORMAT_F64)
.rate(192_000)
.layout(gst_audio::AudioLayout::Interleaved)
.build();
let src_pad_template = gst::PadTemplate::new(
"src",

View file

@ -224,10 +224,9 @@ impl ElementImpl for AudioRNNoise {
fn pad_templates() -> &'static [gst::PadTemplate] {
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
let caps = gst_audio::AudioCapsBuilder::new()
let caps = gst_audio::AudioCapsBuilder::new_interleaved()
.format(gst_audio::AUDIO_FORMAT_F32)
.rate(48000)
.layout(gst_audio::AudioLayout::Interleaved)
.build();
let src_pad_template = gst::PadTemplate::new(
"src",

View file

@ -76,7 +76,7 @@ impl ElementImpl for ClaxonDec {
)
.unwrap();
let src_caps = gst_audio::AudioCapsBuilder::new()
let src_caps = gst_audio::AudioCapsBuilder::new_interleaved()
.format_list([
gst_audio::AudioFormat::S8,
gst_audio::AUDIO_FORMAT_S16,
@ -85,7 +85,6 @@ impl ElementImpl for ClaxonDec {
])
.rate_range(1..655_350)
.channels_range(1..8)
.layout(gst_audio::AudioLayout::Interleaved)
.build();
let src_pad_template = gst::PadTemplate::new(
"src",

View file

@ -31,8 +31,7 @@ fn test_mono_s16() {
assert_eq!(
caps,
gst_audio::AudioCapsBuilder::new()
.layout(gst_audio::AudioLayout::Interleaved)
gst_audio::AudioCapsBuilder::new_interleaved()
.format(gst_audio::AUDIO_FORMAT_S16)
.rate(44_100)
.channels(1)

View file

@ -453,9 +453,8 @@ impl ElementImpl for CsoundFilter {
fn pad_templates() -> &'static [gst::PadTemplate] {
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
let caps = gst_audio::AudioCapsBuilder::new()
let caps = gst_audio::AudioCapsBuilder::new_interleaved()
.format(gst_audio::AUDIO_FORMAT_F64)
.layout(gst_audio::AudioLayout::Interleaved)
.build();
let src_pad_template = gst::PadTemplate::new(
"src",

View file

@ -215,8 +215,7 @@ impl ElementImpl for FlvDemux {
.build(),
);
caps.append(
gst_audio::AudioCapsBuilder::new()
.layout(gst_audio::AudioLayout::Interleaved)
gst_audio::AudioCapsBuilder::new_interleaved()
.format_list([gst_audio::AudioFormat::U8, gst_audio::AudioFormat::S16le])
.build(),
);
@ -1280,8 +1279,7 @@ 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_audio::AudioCapsBuilder::new()
.layout(gst_audio::AudioLayout::Interleaved)
gst_audio::AudioCapsBuilder::new_interleaved()
.format(if self.width == 8 {
gst_audio::AudioFormat::U8
} else {