[FFmpeg-devel] [PATCH] lavc/qsvdec: allow qsv decoders to use initialized device

Rogozhkin, Dmitry V dmitry.v.rogozhkin at intel.com
Thu Sep 3 04:12:17 EEST 2020


On Wed, 2020-09-02 at 20:37 +0100, Mark Thompson wrote:
> > > I still don't see the full picture. What I am looking for at the
> > > first
> > > place is how maintainers and architects envision hwaccel to work
> > > in
> > > general. Basically, there are few ways to specify the device (-
> > > hwaccel,
> > > -init_hw_device, -filter_hw_device), questions are:
> > > 1. What's scope of applicability of each option w/ explanation
> > > why
> > > each
> > > of the option is actually needed (as one of the examples: why -
> > > filter_hw_device is needed and why -init_hw_device can't be used
> > > instead?
> 
> -init_hw_device is a global option which defines a device and adds it
> to the list in ffmpeg; you can have as many of these as you like.
> 
> When setting up a codec which might be able to use a device it tries
> to match against that list, unless you have an explicit
> -hwaccel_device option for that input.  If you do, then it looks for
> the device with that name.
> 
> To maintain compatibility with old command-lines where
> -hwaccel_device took a string interpreted by special code for each
> API in ffmpeg (now removed), if it doesn't find a device with the
> given name then it will try to use it to create a new one.
> 
> (So "-hwaccel foo -hwaccel_device bar" when "bar" hasn't been
> previously defined ends up with the effect of "-init_hw_device
> foo=quux:bar -hwaccel foo -hwaccel_device quux".)
> 
> This doesn't apply to the libmfx decoders, because they have their
> own ad-hoc code.  Getting rid of that so they work in the same way as
> everything else would be a good thing.
> 
> -filter_hw_device selects a device from the list to use while
> filtering (e.g. by hwupload).
> 
> If there is exactly one device in the list when making a filter graph
> then it will use that, but if there are multiple then it has no way
> to guess which one you meant so the option is needed.

Hm. I am pretty sure I saw the case when for one of qsv pipelines when
I was forced to add -filter_hw_device to make things workable thought
there was only one device specified. That's why I was specially asking
about the filter option. This was long ago however and I don't remember
what exactly I ran. Besides, this might have messed up with the fact
that qsv decoder don't work with -init_hw_device... I think I need to
pay attention on this long past use case after we will deal with the
decoder story... If I will note some strange behavior, I'll post
update.

> > > 2. Since there are few methods how component can get a device:
> > > what's
> > > the priority order? (for example, if device can be deducted from
> > > incoming frames, is there a way to override it w/ some command
> > > line
> > > options?)
> 
> Devices from incoming frames have to win, because they are stored on
> that device - it doesn't make sense to select a different device at
> that point (you would need a separate download/upload or mapping step
> to do that).
> 
> - Mark

Thank you, Mark. Your description greatly helps and aligns with
expectations I have.

> 


More information about the ffmpeg-devel mailing list