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.
This commit is contained in:
Vivia Nikolaidou 2022-08-09 14:48:16 +03:00
parent 751a5b4788
commit 7a9537c0fd
2 changed files with 12 additions and 2 deletions

View file

@ -11,7 +11,12 @@ pub struct AudioCapsBuilder<T> {
impl AudioCapsBuilder<gst::caps::NoFeature> {
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<gst::caps::HasFeatures> {

View file

@ -11,7 +11,12 @@ pub struct VideoCapsBuilder<T> {
impl VideoCapsBuilder<gst::caps::NoFeature> {
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<gst::caps::HasFeatures> {