rav1enc/gifenc: Add VideoMeta to the supported metas in propose_allocation()

This commit is contained in:
Sebastian Dröge 2021-10-16 15:28:40 +03:00
parent fe0075ad15
commit 01a551f2ac
2 changed files with 20 additions and 2 deletions

View file

@ -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::<gst_video::VideoMeta>(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<u8> {
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<u8> = Vec::with_capacity(line_size * frame.info().height() as usize);
// copy gstreamer frame to tightly packed rgb(a) frame.

View file

@ -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::<gst_video::VideoMeta>(None);
self.parent_propose_allocation(element, query)
}
// For the colorimetry mapping below
#[allow(clippy::wildcard_in_or_patterns)]
fn set_format(