diff options
author | Vivia Nikolaidou <vivia@ahiru.eu> | 2022-08-09 14:18:12 +0300 |
---|---|---|
committer | Vivia Nikolaidou <vivia@ahiru.eu> | 2022-08-09 22:01:10 +0300 |
commit | 8ee8ae581aae44860bb891d5be3d567c19e49ef2 (patch) | |
tree | 387173b673798d2f7359c074b098bea33b01e24d /video | |
parent | 247702b76d645c1ccdebe5727b31d461ec7bd598 (diff) |
audio: Use gst_audio::AudioCapsBuilder in some plugins
Simplify caps creation codes
Diffstat (limited to 'video')
-rw-r--r-- | video/flavors/Cargo.toml | 1 | ||||
-rw-r--r-- | video/flavors/src/flvdemux/imp.rs | 16 |
2 files changed, 11 insertions, 6 deletions
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 { |