[FFmpeg-devel] [PATCH] lavc/qsvdec: hw device should be set

Mark Thompson sw at jkqxz.net
Tue Jan 2 14:40:02 EET 2018


On 02/01/18 11:27, wm4 wrote:
> On Mon, 1 Jan 2018 23:35:42 +0000
> Mark Thompson <sw at jkqxz.net> wrote:
> 
>> On 29/12/17 07:06, Zhong Li wrote:
>>> Add the flag "AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX" to indicate
>>> AVCodecContext.hw_device_ctx should be set before calling
>>> avcodec_open2() for qsv decoding.
>>> It is consistent with examples/qsvdec.c.
>>>
>>> It also can make function "hw_device_match_by_codec()" can find qsv
>>> device successfully.
>>>
>>> Signed-off-by: Zhong Li <zhong.li at intel.com>
>>> ---
>>>  libavcodec/qsvdec.c | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
>>> index 55fe59b..ff1dcf1 100644
>>> --- a/libavcodec/qsvdec.c
>>> +++ b/libavcodec/qsvdec.c
>>> @@ -45,7 +45,8 @@ const AVCodecHWConfigInternal *ff_qsv_hw_configs[] = {
>>>      &(const AVCodecHWConfigInternal) {
>>>          .public = {
>>>              .pix_fmt     = AV_PIX_FMT_QSV,
>>> -            .methods     = AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX |
>>> +            .methods     = AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX |
>>> +                           AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX |
>>>                             AV_CODEC_HW_CONFIG_METHOD_AD_HOC,
>>>              .device_type = AV_HWDEVICE_TYPE_QSV,
>>>          },
>>>   
>>
>> Did you omit a patch implementing this?  The change here is only to the metadata, and it's not currently implemented.
> 
> Haven't looked too closely, but doesn't it do _something_ with it?

It's used to set the device used with software output (NV12/P010), which is orthogonal to the use with hardware output being shown here.  (It can be helpful when multiple instances (a decoder and an encoder, say) are going to use the same device but it can only be opened for exclusive access (e.g. the /dev/dri/cardN DRM master device on older Linux), but is usually unnecessary.)

- Mark


More information about the ffmpeg-devel mailing list