video: Return a VideoInfo reference instead of a copy in more places

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1698>
This commit is contained in:
Sebastian Dröge 2025-04-04 09:17:24 +03:00
parent 25e1714cfe
commit ab3347ef24
2 changed files with 10 additions and 6 deletions

View file

@ -95,9 +95,9 @@ impl<'a> VideoCodecState<'a, InNegotiation<'a>> {
impl<'a, T: VideoCodecStateContext<'a>> VideoCodecState<'a, T> {
#[doc(alias = "get_info")]
#[inline]
pub fn info(&self) -> VideoInfo {
pub fn info(&self) -> &VideoInfo {
unsafe {
VideoInfo::from_glib_none(&((*self.as_mut_ptr()).info) as *const ffi::GstVideoInfo)
&*(&(*self.as_mut_ptr()).info as *const ffi::GstVideoInfo as *const crate::VideoInfo)
}
}

View file

@ -77,16 +77,20 @@ impl VideoConverter {
#[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
#[doc(alias = "get_in_info")]
#[doc(alias = "gst_video_converter_get_in_info")]
pub fn in_info(&self) -> crate::VideoInfo {
unsafe { from_glib_none(ffi::gst_video_converter_get_in_info(self.0.as_ptr())) }
pub fn in_info(&self) -> &crate::VideoInfo {
unsafe {
&*(ffi::gst_video_converter_get_in_info(self.0.as_ptr()) as *const crate::VideoInfo)
}
}
#[cfg(feature = "v1_22")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
#[doc(alias = "get_out_info")]
#[doc(alias = "gst_video_converter_get_out_info")]
pub fn out_info(&self) -> crate::VideoInfo {
unsafe { from_glib_none(ffi::gst_video_converter_get_out_info(self.0.as_ptr())) }
pub fn out_info(&self) -> &crate::VideoInfo {
unsafe {
&*(ffi::gst_video_converter_get_out_info(self.0.as_ptr()) as *const crate::VideoInfo)
}
}
#[doc(alias = "gst_video_converter_frame")]