mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-04-15 04:14:07 +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/1674>
This commit is contained in:
parent
a46d7d18b9
commit
5ac74ce4d4
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]
|
||||
pub fn is_valid(&self) -> bool {
|
||||
!self.0.finfo.is_null() && self.0.channels > 0 && self.0.rate > 0 && self.0.bpf > 0
|
||||
|
|
Loading…
Reference in a new issue