mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-09-03 10:23:48 +00:00
audio-info: Add API for creating a builder from an existing AudioInfo
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1666>
This commit is contained in:
parent
31d99a91c6
commit
69fd8c33ed
1 changed files with 13 additions and 0 deletions
|
@ -185,6 +185,19 @@ impl AudioInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn builder_from_info(info: &AudioInfo) -> AudioInfoBuilder<'_> {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
|
|
||||||
|
AudioInfoBuilder {
|
||||||
|
format: info.format(),
|
||||||
|
rate: info.rate(),
|
||||||
|
channels: info.channels(),
|
||||||
|
positions: info.positions(),
|
||||||
|
flags: Some(info.flags()),
|
||||||
|
layout: Some(info.layout()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_valid(&self) -> bool {
|
pub fn is_valid(&self) -> bool {
|
||||||
!self.0.finfo.is_null() && self.0.channels > 0 && self.0.rate > 0 && self.0.bpf > 0
|
!self.0.finfo.is_null() && self.0.channels > 0 && self.0.rate > 0 && self.0.bpf > 0
|
||||||
|
|
Loading…
Reference in a new issue