From 7a9537c0fd9a36724c314d8f0c9e50286b3e1bd8 Mon Sep 17 00:00:00 2001 From: Vivia Nikolaidou Date: Tue, 9 Aug 2022 14:48:16 +0300 Subject: [PATCH] audio, video: Default values in caps builders AudioCapsBuilder::new() will have the default values for rate/channels/layout/format. Similarly, VideoCapsBuilder::new() will have the default values for format/width/height/framerate. --- gstreamer-audio/src/caps.rs | 7 ++++++- gstreamer-video/src/caps.rs | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gstreamer-audio/src/caps.rs b/gstreamer-audio/src/caps.rs index 605146a62..06353aefc 100644 --- a/gstreamer-audio/src/caps.rs +++ b/gstreamer-audio/src/caps.rs @@ -11,7 +11,12 @@ pub struct AudioCapsBuilder { impl AudioCapsBuilder { pub fn new() -> Self { let builder = Caps::builder("audio/x-raw"); - AudioCapsBuilder { builder } + let builder = AudioCapsBuilder { builder }; + builder + .rate_range(..) + .channels_range(..) + .layout_list([AudioLayout::Interleaved, AudioLayout::NonInterleaved]) + .format_list(AudioFormat::iter_raw()) } pub fn any_features(self) -> AudioCapsBuilder { diff --git a/gstreamer-video/src/caps.rs b/gstreamer-video/src/caps.rs index 9103fa7b6..0d6abdd99 100644 --- a/gstreamer-video/src/caps.rs +++ b/gstreamer-video/src/caps.rs @@ -11,7 +11,12 @@ pub struct VideoCapsBuilder { impl VideoCapsBuilder { pub fn new() -> Self { let builder = Caps::builder("video/x-raw"); - VideoCapsBuilder { builder } + let builder = VideoCapsBuilder { builder }; + builder + .format_list(VideoFormat::iter_raw()) + .width_range(..) + .height_range(..) + .framerate_range(..) } pub fn any_features(self) -> VideoCapsBuilder {