From 5e852fa0ffb603d5e1b3388a9d81a3ece54216f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 4 Jan 2023 17:45:33 +0200 Subject: [PATCH] gstreamer-video: Autogenerate part of the `VideoDecoder` subframe API Part-of: --- gstreamer-video/Gir.toml | 12 ----- gstreamer-video/src/auto/video_decoder.rs | 54 ++++++++++++++++++++++ gstreamer-video/src/video_decoder.rs | 55 ----------------------- 3 files changed, 54 insertions(+), 67 deletions(-) diff --git a/gstreamer-video/Gir.toml b/gstreamer-video/Gir.toml index 541c86c3e..a4f21fa78 100644 --- a/gstreamer-video/Gir.toml +++ b/gstreamer-video/Gir.toml @@ -445,18 +445,6 @@ manual_traits = ["VideoDecoderExtManual"] name = "allocate_output_frame_with_params" ignore = true - [[object.function]] - name = "finish_subframe" - manual = true - - [[object.function]] - name = "drop_subframe" - manual = true - - [[object.function]] - name = "have_last_subframe" - manual = true - [[object.function]] name = "get_processed_subframe_index" manual = true diff --git a/gstreamer-video/src/auto/video_decoder.rs b/gstreamer-video/src/auto/video_decoder.rs index b3db0dcf2..94fe1a2cd 100644 --- a/gstreamer-video/src/auto/video_decoder.rs +++ b/gstreamer-video/src/auto/video_decoder.rs @@ -41,9 +41,19 @@ pub trait VideoDecoderExt: 'static { #[doc(alias = "gst_video_decoder_drop_frame")] fn drop_frame(&self, frame: VideoCodecFrame) -> Result; + #[cfg(any(feature = "v1_20", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] + #[doc(alias = "gst_video_decoder_drop_subframe")] + fn drop_subframe(&self, frame: VideoCodecFrame) -> Result; + #[doc(alias = "gst_video_decoder_finish_frame")] fn finish_frame(&self, frame: VideoCodecFrame) -> Result; + #[cfg(any(feature = "v1_20", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] + #[doc(alias = "gst_video_decoder_finish_subframe")] + fn finish_subframe(&self, frame: VideoCodecFrame) -> Result; + #[doc(alias = "gst_video_decoder_get_buffer_pool")] #[doc(alias = "get_buffer_pool")] fn buffer_pool(&self) -> Option; @@ -91,6 +101,14 @@ pub trait VideoDecoderExt: 'static { #[doc(alias = "gst_video_decoder_have_frame")] fn have_frame(&self) -> Result; + #[cfg(any(feature = "v1_20", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] + #[doc(alias = "gst_video_decoder_have_last_subframe")] + fn have_last_subframe( + &self, + frame: &VideoCodecFrame, + ) -> Result; + #[doc(alias = "gst_video_decoder_merge_tags")] fn merge_tags(&self, tags: Option<&gst::TagList>, mode: gst::TagMergeMode); @@ -252,6 +270,17 @@ impl> VideoDecoderExt for O { } } + #[cfg(any(feature = "v1_20", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] + fn drop_subframe(&self, frame: VideoCodecFrame) -> Result { + unsafe { + try_from_glib(ffi::gst_video_decoder_drop_subframe( + self.as_ref().to_glib_none().0, + frame.into_glib_ptr(), + )) + } + } + fn finish_frame(&self, frame: VideoCodecFrame) -> Result { unsafe { try_from_glib(ffi::gst_video_decoder_finish_frame( @@ -261,6 +290,17 @@ impl> VideoDecoderExt for O { } } + #[cfg(any(feature = "v1_20", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] + fn finish_subframe(&self, frame: VideoCodecFrame) -> Result { + unsafe { + try_from_glib(ffi::gst_video_decoder_finish_subframe( + self.as_ref().to_glib_none().0, + frame.into_glib_ptr(), + )) + } + } + fn buffer_pool(&self) -> Option { unsafe { from_glib_full(ffi::gst_video_decoder_get_buffer_pool( @@ -338,6 +378,20 @@ impl> VideoDecoderExt for O { } } + #[cfg(any(feature = "v1_20", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] + fn have_last_subframe( + &self, + frame: &VideoCodecFrame, + ) -> Result { + unsafe { + try_from_glib(ffi::gst_video_decoder_have_last_subframe( + self.as_ref().to_glib_none().0, + frame.to_glib_none().0, + )) + } + } + fn merge_tags(&self, tags: Option<&gst::TagList>, mode: gst::TagMergeMode) { unsafe { ffi::gst_video_decoder_merge_tags( diff --git a/gstreamer-video/src/video_decoder.rs b/gstreamer-video/src/video_decoder.rs index d417c99b5..155cc2b38 100644 --- a/gstreamer-video/src/video_decoder.rs +++ b/gstreamer-video/src/video_decoder.rs @@ -45,22 +45,6 @@ pub trait VideoDecoderExtManual: 'static { #[doc(alias = "get_allocator")] fn allocator(&self) -> (Option, gst::AllocationParams); - #[cfg(any(feature = "v1_20", feature = "dox"))] - #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] - #[doc(alias = "gst_video_decoder_finish_subframe")] - fn finish_subframe(&self, frame: &VideoCodecFrame) -> Result; - #[cfg(any(feature = "v1_20", feature = "dox"))] - #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] - #[doc(alias = "gst_video_decoder_drop_subframe")] - fn drop_subframe(&self, frame: &VideoCodecFrame) -> Result; - #[cfg(any(feature = "v1_20", feature = "dox"))] - #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] - #[doc(alias = "gst_video_decoder_have_last_subframe")] - fn have_last_subframe( - &self, - frame: &VideoCodecFrame, - ) -> Result; - #[doc(alias = "get_latency")] fn latency(&self) -> (gst::ClockTime, Option); fn set_latency( @@ -340,45 +324,6 @@ impl> VideoDecoderExtManual for O { } } - #[cfg(any(feature = "v1_20", feature = "dox"))] - #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] - #[doc(alias = "gst_video_decoder_finish_subframe")] - fn finish_subframe(&self, frame: &VideoCodecFrame) -> Result { - unsafe { - try_from_glib(ffi::gst_video_decoder_finish_subframe( - self.as_ref().to_glib_none().0, - frame.to_glib_full(), - )) - } - } - - #[cfg(any(feature = "v1_20", feature = "dox"))] - #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] - #[doc(alias = "gst_video_decoder_drop_subframe")] - fn drop_subframe(&self, frame: &VideoCodecFrame) -> Result { - unsafe { - try_from_glib(ffi::gst_video_decoder_drop_subframe( - self.as_ref().to_glib_none().0, - frame.to_glib_full(), - )) - } - } - - #[cfg(any(feature = "v1_20", feature = "dox"))] - #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] - #[doc(alias = "gst_video_decoder_have_last_subframe")] - fn have_last_subframe( - &self, - frame: &VideoCodecFrame, - ) -> Result { - unsafe { - try_from_glib(ffi::gst_video_decoder_have_last_subframe( - self.as_ref().to_glib_none().0, - frame.to_glib_none().0, - )) - } - } - fn sink_pad(&self) -> &gst::Pad { unsafe { let elt = &*(self.as_ptr() as *const ffi::GstVideoDecoder);