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(
&self,
element: &Self::Type,
query: &mut gst::QueryRef,
query: gst::query::Allocation<&mut gst::QueryRef>,
) -> Result<(), gst::ErrorMessage> {
if let gst::query::QueryView::Allocation(allocation) = query.view() {
if allocation
.find_allocation_meta::<gst_video::VideoMeta>()
.is_some()
{
let pools = allocation.allocation_pools();
if let Some((Some(ref pool), _, _, _)) = pools.first() {
let mut config = pool.config();
config.add_option(&gst_video::BUFFER_POOL_OPTION_VIDEO_META);
pool.set_config(config)
.map_err(|e| gst::error_msg!(gst::CoreError::Negotiation, [&e.message]))?;
}
if query
.find_allocation_meta::<gst_video::VideoMeta>()
.is_some()
{
let pools = query.allocation_pools();
if let Some((Some(ref pool), _, _, _)) = pools.first() {
let mut config = pool.config();
config.add_option(&gst_video::BUFFER_POOL_OPTION_VIDEO_META);
pool.set_config(config)
.map_err(|e| gst::error_msg!(gst::CoreError::Negotiation, [&e.message]))?;
}
}

View file

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

View file

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