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
path: root/video
diff options
context:
space:
mode:
authorVivia Nikolaidou <vivia@ahiru.eu>2022-08-09 14:18:12 +0300
committerVivia Nikolaidou <vivia@ahiru.eu>2022-08-09 22:01:10 +0300
commit8ee8ae581aae44860bb891d5be3d567c19e49ef2 (patch)
tree387173b673798d2f7359c074b098bea33b01e24d /video
parent247702b76d645c1ccdebe5727b31d461ec7bd598 (diff)
audio: Use gst_audio::AudioCapsBuilder in some plugins
Simplify caps creation codes
Diffstat (limited to 'video')
-rw-r--r--video/flavors/Cargo.toml1
-rw-r--r--video/flavors/src/flvdemux/imp.rs16
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 {