mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-26 03:21:03 +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 {
|
pub fn to_string<'a>(&self) -> &'a str {
|
||||||
|
if *self == ::AudioFormat::Unknown {
|
||||||
|
return "UNKNOWN";
|
||||||
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
CStr::from_ptr(ffi::gst_audio_format_to_string(self.to_glib()))
|
CStr::from_ptr(ffi::gst_audio_format_to_string(self.to_glib()))
|
||||||
.to_str()
|
.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!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -146,12 +146,7 @@ impl AudioInfo {
|
||||||
|
|
||||||
pub fn to_caps(&self) -> Option<gst::Caps> {
|
pub fn to_caps(&self) -> Option<gst::Caps> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let caps = ffi::gst_audio_info_to_caps(&self.0);
|
from_glib_full(ffi::gst_audio_info_to_caps(&self.0))
|
||||||
if caps.is_null() {
|
|
||||||
None
|
|
||||||
} else {
|
|
||||||
Some(from_glib_full(caps))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ pub fn audio_buffer_clip(
|
||||||
segment: &gst::Segment,
|
segment: &gst::Segment,
|
||||||
rate: u32,
|
rate: u32,
|
||||||
channels: u32,
|
channels: u32,
|
||||||
) -> gst::Buffer {
|
) -> Option<gst::Buffer> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
Loading…
Reference in a new issue