[FFmpeg-devel] [PATCH] lavc: Make hardware config method support more explicit for hwaccels
Mark Thompson
sw at jkqxz.net
Sun Dec 10 18:47:13 EET 2017
On 08/12/17 16:22, Thomas Guillem wrote:
> On Fri, Dec 8, 2017, at 17:15, Mark Thompson wrote:
>> From: Thomas Guillem <thomas at gllm.fr>
>>
>> This fixes the use of old ad-hoc methods which are still supported by
>> some
>> hwaccels which also support newer methods (DXVA2, VAAPI, VDPAU,
>> videotoolbox) - without the method being visible here, ff_get_format()
>> would refuse to use it.
>>
>> Signed-off-by: Mark Thompson <sw at jkqxz.net>
>> ---
>> On 07/12/17 12:25, Thomas Guillem wrote:
>>> Add a boolean to specify if an API can work with
>>> AV_CODEC_HW_CONFIG_METHOD_AD_HOC.
>>> ---
>>> libavcodec/hwaccel.h | 17 +++++++++--------
>>> 1 file changed, 9 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/libavcodec/hwaccel.h b/libavcodec/hwaccel.h
>>> index ae55527c2f..16ee822920 100644
>>> --- a/libavcodec/hwaccel.h
>>> +++ b/libavcodec/hwaccel.h
>>> @@ -42,12 +42,13 @@ typedef struct AVCodecHWConfigInternal {
>>>
>>> // These macros are used to simplify AVCodecHWConfigInternal definitions.
>>>
>>> -#define HW_CONFIG_HWACCEL(format, device, name) \
>>> +#define HW_CONFIG_HWACCEL(format, ad_hoc, device, name) \
>>> &(const AVCodecHWConfigInternal) { \
>>> .public = { \
>>> .pix_fmt = AV_PIX_FMT_ ## format, \
>>> .methods = AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX | \
>>> - AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX, \
>>> + AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX | \
>>> + ad_hoc ? AV_CODEC_HW_CONFIG_METHOD_AD_HOC : 0, \
>>> .device_type = AV_HWDEVICE_TYPE_ ## device, \
>>> }, \
>>> .hwaccel = &name, \
>>
>> Once we're having extra arguments in the macros like that I think I would
>> prefer all the methods to be specified explicitly (which conveniently
>> also lets us delete the second macro).
>>
>> How about this?
>
> Fine with me.
Ok, applied.
Thanks,
- Mark
More information about the ffmpeg-devel
mailing list