From 01a551f2ac69eaad0e293149e5e3a68c09e49b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 16 Oct 2021 15:28:40 +0300 Subject: [PATCH] rav1enc/gifenc: Add VideoMeta to the supported metas in propose_allocation() --- video/gif/src/gifenc/imp.rs | 13 +++++++++++-- video/rav1e/src/rav1enc/imp.rs | 9 +++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/video/gif/src/gifenc/imp.rs b/video/gif/src/gifenc/imp.rs index 8e0f1ebb..481c3a59 100644 --- a/video/gif/src/gifenc/imp.rs +++ b/video/gif/src/gifenc/imp.rs @@ -274,6 +274,15 @@ impl VideoEncoderImpl for GifEnc { Ok(()) } + fn propose_allocation( + &self, + element: &Self::Type, + mut query: gst::query::Allocation<&mut gst::QueryRef>, + ) -> Result<(), gst::ErrorMessage> { + query.add_allocation_meta::(None); + self.parent_propose_allocation(element, query) + } + fn set_format( &self, element: &Self::Type, @@ -456,8 +465,8 @@ impl GifEnc { /// tightly packed rgb(a) buffer, ready for consumption by the gif encoder. fn tightly_packed_framebuffer(frame: &gst_video::VideoFrameRef<&gst::BufferRef>) -> Vec { assert_eq!(frame.n_planes(), 1); // RGB and RGBA are tightly packed - let line_size = (frame.info().width() * frame.n_components()) as usize; - let line_stride = frame.info().stride()[0] as usize; + let line_size = (frame.width() * frame.n_components()) as usize; + let line_stride = frame.plane_stride()[0] as usize; let mut raw_frame: Vec = Vec::with_capacity(line_size * frame.info().height() as usize); // copy gstreamer frame to tightly packed rgb(a) frame. diff --git a/video/rav1e/src/rav1enc/imp.rs b/video/rav1e/src/rav1enc/imp.rs index 9a313340..1c939341 100644 --- a/video/rav1e/src/rav1enc/imp.rs +++ b/video/rav1e/src/rav1enc/imp.rs @@ -484,6 +484,15 @@ impl VideoEncoderImpl for Rav1Enc { Ok(()) } + fn propose_allocation( + &self, + element: &Self::Type, + mut query: gst::query::Allocation<&mut gst::QueryRef>, + ) -> Result<(), gst::ErrorMessage> { + query.add_allocation_meta::(None); + self.parent_propose_allocation(element, query) + } + // For the colorimetry mapping below #[allow(clippy::wildcard_in_or_patterns)] fn set_format(