video: Use static inner lifetime for VideoCodecState<Readable>

It does not borrow from anything else and can be safely stored away.

Only the VideoCodecState<InNegotiation> is actively borrowing from the
element to ensure that it is only modified during negotiation in a safe
way.
This commit is contained in:
Sebastian Dröge 2019-12-23 13:07:05 +02:00
parent 68e7a4078e
commit a418dcbe05
4 changed files with 10 additions and 10 deletions

View file

@ -53,7 +53,7 @@ pub trait VideoDecoderImpl: VideoDecoderImplExt + ElementImpl + Send + Sync + 's
fn set_format(
&self,
element: &VideoDecoder,
state: &VideoCodecState<Readable>,
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<Readable>,
state: &VideoCodecState<'static, Readable>,
) -> Result<(), gst::LoggableError>;
fn parent_parse(
@ -295,7 +295,7 @@ impl<T: VideoDecoderImpl + ObjectImpl> VideoDecoderImplExt for T {
fn parent_set_format(
&self,
element: &VideoDecoder,
state: &VideoCodecState<Readable>,
state: &VideoCodecState<'static, Readable>,
) -> Result<(), gst::LoggableError> {
unsafe {
let data = self.get_type_data();

View file

@ -48,7 +48,7 @@ pub trait VideoEncoderImpl: VideoEncoderImplExt + ElementImpl + Send + Sync + 's
fn set_format(
&self,
element: &VideoEncoder,
state: &VideoCodecState<Readable>,
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<Readable>,
state: &VideoCodecState<'static, Readable>,
) -> Result<(), gst::LoggableError>;
fn parent_handle_frame(
@ -257,7 +257,7 @@ impl<T: VideoEncoderImpl + ObjectImpl> VideoEncoderImplExt for T {
fn parent_set_format(
&self,
element: &VideoEncoder,
state: &VideoCodecState<Readable>,
state: &VideoCodecState<'static, Readable>,
) -> Result<(), gst::LoggableError> {
unsafe {
let data = self.get_type_data();

View file

@ -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<VideoCodecState<Readable>>;
fn get_output_state(&self) -> Option<VideoCodecState<'static, Readable>>;
fn set_output_state(
&self,
fmt: VideoFormat,
@ -233,7 +233,7 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExtManual for O {
}
}
fn get_output_state(&self) -> Option<VideoCodecState<Readable>> {
fn get_output_state(&self) -> Option<VideoCodecState<'static, Readable>> {
let state = unsafe {
gst_video_sys::gst_video_decoder_get_output_state(self.as_ref().to_glib_none().0)
};

View file

@ -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<VideoCodecState<Readable>>;
fn get_output_state(&self) -> Option<VideoCodecState<'static, Readable>>;
fn set_output_state(
&self,
caps: gst::Caps,
@ -166,7 +166,7 @@ impl<O: IsA<VideoEncoder>> VideoEncoderExtManual for O {
}
}
fn get_output_state(&self) -> Option<VideoCodecState<Readable>> {
fn get_output_state(&self) -> Option<VideoCodecState<'static, Readable>> {
let state = unsafe {
gst_video_sys::gst_video_encoder_get_output_state(self.as_ref().to_glib_none().0)
};