mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 11:01:10 +00:00
gstreamer: Directly use fields for DebugCategory
getters
This allows for better optimizations as it doesn't go through an opaque FFI function. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1159>
This commit is contained in:
parent
e8859951d3
commit
a54c234fc6
1 changed files with 4 additions and 8 deletions
|
@ -95,7 +95,7 @@ impl DebugCategory {
|
|||
#[doc(alias = "gst_debug_category_get_threshold")]
|
||||
pub fn threshold(self) -> crate::DebugLevel {
|
||||
match self.0 {
|
||||
Some(cat) => unsafe { from_glib(ffi::gst_debug_category_get_threshold(cat.as_ptr())) },
|
||||
Some(cat) => unsafe { from_glib(cat.as_ref().threshold) },
|
||||
None => crate::DebugLevel::None,
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ impl DebugCategory {
|
|||
#[doc(alias = "gst_debug_category_get_color")]
|
||||
pub fn color(self) -> crate::DebugColorFlags {
|
||||
match self.0 {
|
||||
Some(cat) => unsafe { from_glib(ffi::gst_debug_category_get_color(cat.as_ptr())) },
|
||||
Some(cat) => unsafe { from_glib(cat.as_ref().color) },
|
||||
None => crate::DebugColorFlags::empty(),
|
||||
}
|
||||
}
|
||||
|
@ -127,11 +127,7 @@ impl DebugCategory {
|
|||
#[doc(alias = "gst_debug_category_get_name")]
|
||||
pub fn name<'a>(self) -> &'a str {
|
||||
match self.0 {
|
||||
Some(cat) => unsafe {
|
||||
CStr::from_ptr(ffi::gst_debug_category_get_name(cat.as_ptr()))
|
||||
.to_str()
|
||||
.unwrap()
|
||||
},
|
||||
Some(cat) => unsafe { CStr::from_ptr(cat.as_ref().name).to_str().unwrap() },
|
||||
None => "",
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +138,7 @@ impl DebugCategory {
|
|||
let cat = self.0?;
|
||||
|
||||
unsafe {
|
||||
let ptr = ffi::gst_debug_category_get_description(cat.as_ptr());
|
||||
let ptr = cat.as_ref().description;
|
||||
|
||||
if ptr.is_null() {
|
||||
None
|
||||
|
|
Loading…
Reference in a new issue