analytics: Remove unnecessarily mutable references

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1563>
This commit is contained in:
Sebastian Dröge 2024-10-20 17:40:00 +03:00 committed by GStreamer Marge Bot
parent cea71246dc
commit cfa9ea2dc7
4 changed files with 16 additions and 16 deletions

View file

@ -95,8 +95,8 @@ impl<'a> AnalyticsMtdRef<'a, AnalyticsClassificationMtd> {
#[doc(alias = "gst_analytics_cls_mtd_get_length")] #[doc(alias = "gst_analytics_cls_mtd_get_length")]
pub fn len(&self) -> usize { pub fn len(&self) -> usize {
unsafe { unsafe {
let mut mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self)); let mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self));
ffi::gst_analytics_cls_mtd_get_length(&mut mtd) ffi::gst_analytics_cls_mtd_get_length(&mtd)
} }
} }
@ -109,8 +109,8 @@ impl<'a> AnalyticsMtdRef<'a, AnalyticsClassificationMtd> {
assert!(index < self.len()); assert!(index < self.len());
unsafe { unsafe {
let mut mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self)); let mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self));
ffi::gst_analytics_cls_mtd_get_level(&mut mtd, index) ffi::gst_analytics_cls_mtd_get_level(&mtd, index)
} }
} }
@ -119,8 +119,8 @@ impl<'a> AnalyticsMtdRef<'a, AnalyticsClassificationMtd> {
assert!(index < self.len()); assert!(index < self.len());
unsafe { unsafe {
let mut mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self)); let mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self));
from_glib(ffi::gst_analytics_cls_mtd_get_quark(&mut mtd, index)) from_glib(ffi::gst_analytics_cls_mtd_get_quark(&mtd, index))
} }
} }

View file

@ -84,8 +84,8 @@ impl<'a> AnalyticsMtdRef<'a, AnalyticsODMtd> {
#[doc(alias = "gst_analytics_od_mtd_get_obj_type")] #[doc(alias = "gst_analytics_od_mtd_get_obj_type")]
pub fn obj_type(&self) -> Option<glib::Quark> { pub fn obj_type(&self) -> Option<glib::Quark> {
unsafe { unsafe {
let mut mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self)); let mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self));
let type_ = ffi::gst_analytics_od_mtd_get_obj_type(&mut mtd); let type_ = ffi::gst_analytics_od_mtd_get_obj_type(&mtd);
if type_ == 0 { if type_ == 0 {
None None
} else { } else {
@ -99,9 +99,9 @@ impl<'a> AnalyticsMtdRef<'a, AnalyticsODMtd> {
let mut loc = AnalyticsODLocation::default(); let mut loc = AnalyticsODLocation::default();
let success = unsafe { let success = unsafe {
let mut mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self)); let mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self));
ffi::gst_analytics_od_mtd_get_location( ffi::gst_analytics_od_mtd_get_location(
&mut mtd, &mtd,
&mut loc.x, &mut loc.x,
&mut loc.y, &mut loc.y,
&mut loc.w, &mut loc.w,
@ -120,9 +120,9 @@ impl<'a> AnalyticsMtdRef<'a, AnalyticsODMtd> {
#[doc(alias = "gst_analytics_od_mtd_get_confidence_lvl")] #[doc(alias = "gst_analytics_od_mtd_get_confidence_lvl")]
pub fn confidence_level(&self) -> f32 { pub fn confidence_level(&self) -> f32 {
unsafe { unsafe {
let mut mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self)); let mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self));
let mut lvl: f32 = 0.0; let mut lvl: f32 = 0.0;
ffi::gst_analytics_od_mtd_get_confidence_lvl(&mut mtd, &mut lvl); ffi::gst_analytics_od_mtd_get_confidence_lvl(&mtd, &mut lvl);
lvl lvl
} }
} }

View file

@ -282,8 +282,8 @@ impl<'a, T: AnalyticsMtd> AnalyticsMtdRef<'a, T> {
#[doc(alias = "gst_analytics_mtd_get_mtd_type")] #[doc(alias = "gst_analytics_mtd_get_mtd_type")]
pub fn mtd_type(&self) -> ffi::GstAnalyticsMtdType { pub fn mtd_type(&self) -> ffi::GstAnalyticsMtdType {
unsafe { unsafe {
let mut mtd = ffi::GstAnalyticsMtd::unsafe_from(self); let mtd = ffi::GstAnalyticsMtd::unsafe_from(self);
ffi::gst_analytics_mtd_get_mtd_type(&mut mtd) ffi::gst_analytics_mtd_get_mtd_type(&mtd)
} }
} }
} }

View file

@ -68,9 +68,9 @@ impl<'a> AnalyticsMtdRef<'a, AnalyticsTrackingMtd> {
let mut tracking_lost: i32 = 0; let mut tracking_lost: i32 = 0;
unsafe { unsafe {
let mut mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self)); let mtd = from(ffi::GstAnalyticsMtd::unsafe_from(self));
ffi::gst_analytics_tracking_mtd_get_info( ffi::gst_analytics_tracking_mtd_get_info(
&mut mtd, &mtd,
&mut tracking_id, &mut tracking_id,
&mut tracking_first_seen, &mut tracking_first_seen,
&mut tracking_last_seen, &mut tracking_last_seen,