From a418dcbe051f2fd8bcb788466a1714749547a60d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 23 Dec 2019 13:07:05 +0200 Subject: [PATCH] video: Use static inner lifetime for VideoCodecState It does not borrow from anything else and can be safely stored away. Only the VideoCodecState is actively borrowing from the element to ensure that it is only modified during negotiation in a safe way. --- gstreamer-video/src/subclass/video_decoder.rs | 6 +++--- gstreamer-video/src/subclass/video_encoder.rs | 6 +++--- gstreamer-video/src/video_decoder.rs | 4 ++-- gstreamer-video/src/video_encoder.rs | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gstreamer-video/src/subclass/video_decoder.rs b/gstreamer-video/src/subclass/video_decoder.rs index ef67cd463..5e972edf9 100644 --- a/gstreamer-video/src/subclass/video_decoder.rs +++ b/gstreamer-video/src/subclass/video_decoder.rs @@ -53,7 +53,7 @@ pub trait VideoDecoderImpl: VideoDecoderImplExt + ElementImpl + Send + Sync + 's fn set_format( &self, element: &VideoDecoder, - state: &VideoCodecState, + state: &VideoCodecState<'static, Readable>, ) -> Result<(), gst::LoggableError> { self.parent_set_format(element, state) } @@ -137,7 +137,7 @@ pub trait VideoDecoderImplExt { fn parent_set_format( &self, element: &VideoDecoder, - state: &VideoCodecState, + state: &VideoCodecState<'static, Readable>, ) -> Result<(), gst::LoggableError>; fn parent_parse( @@ -295,7 +295,7 @@ impl VideoDecoderImplExt for T { fn parent_set_format( &self, element: &VideoDecoder, - state: &VideoCodecState, + state: &VideoCodecState<'static, Readable>, ) -> Result<(), gst::LoggableError> { unsafe { let data = self.get_type_data(); diff --git a/gstreamer-video/src/subclass/video_encoder.rs b/gstreamer-video/src/subclass/video_encoder.rs index 5f9b6475f..b4e7a66fe 100644 --- a/gstreamer-video/src/subclass/video_encoder.rs +++ b/gstreamer-video/src/subclass/video_encoder.rs @@ -48,7 +48,7 @@ pub trait VideoEncoderImpl: VideoEncoderImplExt + ElementImpl + Send + Sync + 's fn set_format( &self, element: &VideoEncoder, - state: &VideoCodecState, + state: &VideoCodecState<'static, Readable>, ) -> Result<(), gst::LoggableError> { self.parent_set_format(element, state) } @@ -120,7 +120,7 @@ pub trait VideoEncoderImplExt { fn parent_set_format( &self, element: &VideoEncoder, - state: &VideoCodecState, + state: &VideoCodecState<'static, Readable>, ) -> Result<(), gst::LoggableError>; fn parent_handle_frame( @@ -257,7 +257,7 @@ impl VideoEncoderImplExt for T { fn parent_set_format( &self, element: &VideoEncoder, - state: &VideoCodecState, + state: &VideoCodecState<'static, Readable>, ) -> Result<(), gst::LoggableError> { unsafe { let data = self.get_type_data(); diff --git a/gstreamer-video/src/video_decoder.rs b/gstreamer-video/src/video_decoder.rs index 71d070f5d..fe29f3faf 100644 --- a/gstreamer-video/src/video_decoder.rs +++ b/gstreamer-video/src/video_decoder.rs @@ -57,7 +57,7 @@ pub trait VideoDecoderExtManual: 'static { fn get_latency(&self) -> (gst::ClockTime, gst::ClockTime); fn set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime); - fn get_output_state(&self) -> Option>; + fn get_output_state(&self) -> Option>; fn set_output_state( &self, fmt: VideoFormat, @@ -233,7 +233,7 @@ impl> VideoDecoderExtManual for O { } } - fn get_output_state(&self) -> Option> { + fn get_output_state(&self) -> Option> { let state = unsafe { gst_video_sys::gst_video_decoder_get_output_state(self.as_ref().to_glib_none().0) }; diff --git a/gstreamer-video/src/video_encoder.rs b/gstreamer-video/src/video_encoder.rs index 3d9643f24..4aa05869b 100644 --- a/gstreamer-video/src/video_encoder.rs +++ b/gstreamer-video/src/video_encoder.rs @@ -41,7 +41,7 @@ pub trait VideoEncoderExtManual: 'static { fn get_latency(&self) -> (gst::ClockTime, gst::ClockTime); fn set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime); - fn get_output_state(&self) -> Option>; + fn get_output_state(&self) -> Option>; fn set_output_state( &self, caps: gst::Caps, @@ -166,7 +166,7 @@ impl> VideoEncoderExtManual for O { } } - fn get_output_state(&self) -> Option> { + fn get_output_state(&self) -> Option> { let state = unsafe { gst_video_sys::gst_video_encoder_get_output_state(self.as_ref().to_glib_none().0) };