video: Update for new decide_allocation() signature

This commit is contained in:
Sebastian Dröge 2021-10-16 15:02:11 +03:00
parent 6ec98ec5e4
commit d17c3483c1
3 changed files with 26 additions and 32 deletions

View file

@ -199,20 +199,18 @@ impl VideoDecoderImpl for CdgDec {
fn decide_allocation( fn decide_allocation(
&self, &self,
element: &Self::Type, element: &Self::Type,
query: &mut gst::QueryRef, query: gst::query::Allocation<&mut gst::QueryRef>,
) -> Result<(), gst::ErrorMessage> { ) -> Result<(), gst::ErrorMessage> {
if let gst::query::QueryView::Allocation(allocation) = query.view() { if query
if allocation .find_allocation_meta::<gst_video::VideoMeta>()
.find_allocation_meta::<gst_video::VideoMeta>() .is_some()
.is_some() {
{ let pools = query.allocation_pools();
let pools = allocation.allocation_pools(); if let Some((Some(ref pool), _, _, _)) = pools.first() {
if let Some((Some(ref pool), _, _, _)) = pools.first() { let mut config = pool.config();
let mut config = pool.config(); config.add_option(&gst_video::BUFFER_POOL_OPTION_VIDEO_META);
config.add_option(&gst_video::BUFFER_POOL_OPTION_VIDEO_META); pool.set_config(config)
pool.set_config(config) .map_err(|e| gst::error_msg!(gst::CoreError::Negotiation, [&e.message]))?;
.map_err(|e| gst::error_msg!(gst::CoreError::Negotiation, [&e.message]))?;
}
} }
} }

View file

@ -464,13 +464,11 @@ impl VideoDecoderImpl for Dav1dDec {
fn decide_allocation( fn decide_allocation(
&self, &self,
element: &Self::Type, element: &Self::Type,
query: &mut gst::QueryRef, query: gst::query::Allocation<&mut gst::QueryRef>,
) -> Result<(), gst::ErrorMessage> { ) -> Result<(), gst::ErrorMessage> {
if let gst::query::QueryView::Allocation(allocation) = query.view() { self.negotiation_infos.lock().unwrap().video_meta_supported = query
self.negotiation_infos.lock().unwrap().video_meta_supported = allocation .find_allocation_meta::<gst_video::VideoMeta>()
.find_allocation_meta::<gst_video::VideoMeta>() .is_some();
.is_some();
}
self.parent_decide_allocation(element, query) self.parent_decide_allocation(element, query)
} }

View file

@ -454,21 +454,19 @@ impl VideoDecoderImpl for Ffv1Dec {
fn decide_allocation( fn decide_allocation(
&self, &self,
element: &Self::Type, element: &Self::Type,
query: &mut gst::QueryRef, query: gst::query::Allocation<&mut gst::QueryRef>,
) -> Result<(), gst::ErrorMessage> { ) -> Result<(), gst::ErrorMessage> {
if let gst::query::QueryView::Allocation(allocation) = query.view() { let supported = query
let supported = allocation .find_allocation_meta::<gst_video::VideoMeta>()
.find_allocation_meta::<gst_video::VideoMeta>() .is_some();
.is_some();
let mut state = self.state.lock().unwrap(); let mut state = self.state.lock().unwrap();
if let DecoderState::Started { if let DecoderState::Started {
ref mut video_meta_supported, ref mut video_meta_supported,
.. ..
} = *state } = *state
{ {
*video_meta_supported = supported; *video_meta_supported = supported;
}
} }
self.parent_decide_allocation(element, query) self.parent_decide_allocation(element, query)