diff --git a/gstreamer-audio/Gir.toml b/gstreamer-audio/Gir.toml index 7675a8f12..babf9a029 100644 --- a/gstreamer-audio/Gir.toml +++ b/gstreamer-audio/Gir.toml @@ -244,6 +244,10 @@ manual_traits = ["AudioEncoderExtManual"] name = "tolerance" mandatory = true + [[object.function]] + name = "set_headers" + manual = true + [[object]] name = "GstAudio.AudioFlags" status = "generate" diff --git a/gstreamer-audio/src/audio_encoder.rs b/gstreamer-audio/src/audio_encoder.rs index d14ced233..9992211c9 100644 --- a/gstreamer-audio/src/audio_encoder.rs +++ b/gstreamer-audio/src/audio_encoder.rs @@ -24,6 +24,9 @@ pub trait AudioEncoderExtManual: 'static { #[doc(alias = "gst_audio_encoder_get_allocator")] fn allocator(&self) -> (Option, gst::AllocationParams); + #[doc(alias = "gst_audio_encoder_set_headers")] + fn set_headers(&self, headers: impl IntoIterator); + fn sink_pad(&self) -> &gst::Pad; fn src_pad(&self) -> &gst::Pad; @@ -84,6 +87,18 @@ impl> AudioEncoderExtManual for O { } } + fn set_headers(&self, headers: impl IntoIterator) { + unsafe { + ffi::gst_audio_encoder_set_headers( + self.as_ref().to_glib_none().0, + headers + .into_iter() + .collect::>() + .into_glib_ptr(), + ); + } + } + fn sink_pad(&self) -> &gst::Pad { unsafe { let elt = &*(self.as_ptr() as *const ffi::GstAudioEncoder); diff --git a/gstreamer-audio/src/auto/audio_encoder.rs b/gstreamer-audio/src/auto/audio_encoder.rs index 7bc29f610..ebf022d6d 100644 --- a/gstreamer-audio/src/auto/audio_encoder.rs +++ b/gstreamer-audio/src/auto/audio_encoder.rs @@ -106,9 +106,6 @@ pub trait AudioEncoderExt: 'static { #[doc(alias = "gst_audio_encoder_set_hard_resync")] fn set_hard_resync(&self, enabled: bool); - #[doc(alias = "gst_audio_encoder_set_headers")] - fn set_headers(&self, headers: Vec); - #[doc(alias = "gst_audio_encoder_set_latency")] fn set_latency(&self, min: gst::ClockTime, max: impl Into>); @@ -322,15 +319,6 @@ impl> AudioEncoderExt for O { } } - fn set_headers(&self, headers: Vec) { - unsafe { - ffi::gst_audio_encoder_set_headers( - self.as_ref().to_glib_none().0, - headers.into_glib_ptr(), - ); - } - } - fn set_latency(&self, min: gst::ClockTime, max: impl Into>) { unsafe { ffi::gst_audio_encoder_set_latency( diff --git a/gstreamer-video/Gir.toml b/gstreamer-video/Gir.toml index 13b469b82..3d7858ae3 100644 --- a/gstreamer-video/Gir.toml +++ b/gstreamer-video/Gir.toml @@ -573,6 +573,10 @@ manual_traits = ["VideoEncoderExtManual"] name = "get_allocator" manual = true + [[object.function]] + name = "set_headers" + manual = true + [[object]] name = "GstVideo.VideoFieldOrder" status = "generate" diff --git a/gstreamer-video/src/auto/video_encoder.rs b/gstreamer-video/src/auto/video_encoder.rs index e42e79383..62de8544d 100644 --- a/gstreamer-video/src/auto/video_encoder.rs +++ b/gstreamer-video/src/auto/video_encoder.rs @@ -50,9 +50,6 @@ pub trait VideoEncoderExt: 'static { #[doc(alias = "gst_video_encoder_proxy_getcaps")] fn proxy_getcaps(&self, caps: Option<&gst::Caps>, filter: Option<&gst::Caps>) -> gst::Caps; - #[doc(alias = "gst_video_encoder_set_headers")] - fn set_headers(&self, headers: Vec); - #[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] #[doc(alias = "gst_video_encoder_set_min_force_key_unit_interval")] @@ -137,15 +134,6 @@ impl> VideoEncoderExt for O { } } - fn set_headers(&self, headers: Vec) { - unsafe { - ffi::gst_video_encoder_set_headers( - self.as_ref().to_glib_none().0, - headers.into_glib_ptr(), - ); - } - } - #[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] fn set_min_force_key_unit_interval(&self, interval: impl Into>) { diff --git a/gstreamer-video/src/video_encoder.rs b/gstreamer-video/src/video_encoder.rs index 6bd2b430b..9e86cf961 100644 --- a/gstreamer-video/src/video_encoder.rs +++ b/gstreamer-video/src/video_encoder.rs @@ -69,6 +69,9 @@ pub trait VideoEncoderExtManual: 'static { output_state: VideoCodecState<'a, InNegotiation<'a>>, ) -> Result<(), gst::FlowError>; + #[doc(alias = "gst_video_encoder_set_headers")] + fn set_headers(&self, headers: impl IntoIterator); + fn sink_pad(&self) -> &gst::Pad; fn src_pad(&self) -> &gst::Pad; @@ -254,6 +257,18 @@ impl> VideoEncoderExtManual for O { } } + fn set_headers(&self, headers: impl IntoIterator) { + unsafe { + ffi::gst_video_encoder_set_headers( + self.as_ref().to_glib_none().0, + headers + .into_iter() + .collect::>() + .into_glib_ptr(), + ); + } + } + fn sink_pad(&self) -> &gst::Pad { unsafe { let elt = &*(self.as_ptr() as *const ffi::GstVideoEncoder); diff --git a/gstreamer/src/date_time.rs b/gstreamer/src/date_time.rs index 9a7066794..12e75fee8 100644 --- a/gstreamer/src/date_time.rs +++ b/gstreamer/src/date_time.rs @@ -502,14 +502,14 @@ impl fmt::Display for DateTime { impl<'a> From<&'a glib::DateTime> for DateTime { fn from(v: &'a glib::DateTime) -> DateTime { skip_assert_initialized!(); - DateTime::from_g_date_time(v) + DateTime::from_g_date_time(v.clone()) } } impl From for DateTime { fn from(v: glib::DateTime) -> DateTime { skip_assert_initialized!(); - DateTime::from_g_date_time(&v) + DateTime::from_g_date_time(v) } }