mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-12-26 10:00:32 +00:00
Some nullability fixes in gstreamer-audio
This commit is contained in:
parent
5fb6ce77ee
commit
0eb32f0483
3 changed files with 7 additions and 8 deletions
|
@ -40,6 +40,10 @@ impl ::AudioFormat {
|
|||
}
|
||||
|
||||
pub fn to_string<'a>(&self) -> &'a str {
|
||||
if *self == ::AudioFormat::Unknown {
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
unsafe {
|
||||
CStr::from_ptr(ffi::gst_audio_format_to_string(self.to_glib()))
|
||||
.to_str()
|
||||
|
|
|
@ -130,7 +130,7 @@ impl AudioInfo {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn from_caps(caps: &gst::Caps) -> Option<Self> {
|
||||
pub fn from_caps(caps: &gst::CapsRef) -> Option<Self> {
|
||||
skip_assert_initialized!();
|
||||
|
||||
unsafe {
|
||||
|
@ -146,12 +146,7 @@ impl AudioInfo {
|
|||
|
||||
pub fn to_caps(&self) -> Option<gst::Caps> {
|
||||
unsafe {
|
||||
let caps = ffi::gst_audio_info_to_caps(&self.0);
|
||||
if caps.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(from_glib_full(caps))
|
||||
}
|
||||
from_glib_full(ffi::gst_audio_info_to_caps(&self.0))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ pub fn audio_buffer_clip(
|
|||
segment: &gst::Segment,
|
||||
rate: u32,
|
||||
channels: u32,
|
||||
) -> gst::Buffer {
|
||||
) -> Option<gst::Buffer> {
|
||||
skip_assert_initialized!();
|
||||
|
||||
unsafe {
|
||||
|
|
Loading…
Reference in a new issue