diff --git a/gstreamer-video/Gir.toml b/gstreamer-video/Gir.toml index f5a7bbcc9..fae5edfb3 100644 --- a/gstreamer-video/Gir.toml +++ b/gstreamer-video/Gir.toml @@ -19,7 +19,6 @@ external_libraries = [ generate = [ "GstVideo.VideoCodecFrameFlags", "GstVideo.VideoFormatFlags", - "GstVideo.VideoColorMatrix", "GstVideo.VideoMultiviewMode", "GstVideo.VideoMultiviewFramePacking", "GstVideo.VideoFilter", @@ -551,3 +550,11 @@ status = "generate" manual = true [object.function.return] nullable = false + +[[object]] +name = "GstVideo.VideoColorMatrix" +status = "generate" + [[object.function]] + name = "get_Kr_Kb" + # Function and parameter name capitalization is wrong + ignore = true diff --git a/gstreamer-video/src/lib.rs b/gstreamer-video/src/lib.rs index 233386366..5a37cadb5 100644 --- a/gstreamer-video/src/lib.rs +++ b/gstreamer-video/src/lib.rs @@ -41,6 +41,8 @@ pub use crate::caps_features::{ CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, CAPS_FEATURE_META_GST_VIDEO_META, CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION, }; +mod video_color_matrix; +pub use video_color_matrix::*; mod video_format; pub use crate::video_format::*; mod video_format_info; diff --git a/gstreamer-video/src/video_color_matrix.rs b/gstreamer-video/src/video_color_matrix.rs new file mode 100644 index 000000000..ee215f068 --- /dev/null +++ b/gstreamer-video/src/video_color_matrix.rs @@ -0,0 +1,25 @@ +use std::mem; + +use glib::translate::ToGlib; + +impl crate::VideoColorMatrix { + pub fn get_kr_kb(&self) -> Result<(f64, f64), glib::BoolError> { + assert_initialized_main_thread!(); + unsafe { + let mut kr = mem::MaybeUninit::uninit(); + let mut kb = mem::MaybeUninit::uninit(); + glib::glib_result_from_gboolean!( + ffi::gst_video_color_matrix_get_Kr_Kb( + self.to_glib(), + kr.as_mut_ptr(), + kb.as_mut_ptr(), + ), + "{:?} is not a YUV matrix", + self + )?; + let kr = kr.assume_init(); + let kb = kb.assume_init(); + Ok((kr, kb)) + } + } +}