mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-04-15 04:14:07 +00:00
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:
parent
25e1714cfe
commit
ab3347ef24
2 changed files with 10 additions and 6 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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")]
|
||||
|
|
Loading…
Reference in a new issue