[FFmpeg-devel] [PATCH] HWAccel infrastructure (take 5)

Ivan Kalvachev ikalvachev
Fri Feb 20 11:45:12 CET 2009


On 2/20/09, Gwenole Beauchesne <gbeauchesne at splitted-desktop.com> wrote:
> Hi,
>
> On Thu, 19 Feb 2009, Michael Niedermayer wrote:
>
>>> +AVHWAccel *ff_query_hwaccel_codec(AVCodecContext *avctx, enum CodecID
>>> codec_id)
>>> +{
>>> +    AVHWAccel *hwaccel;
>>> +    AVHWAccel *hwaccels[PIX_FMT_NB] = { NULL, };
>>> +    enum PixelFormat pix_fmts[PIX_FMT_NB + 1];
>>> +    int pix_fmt, n_pix_fmts = 0;
>>> +
>>
>>> +    /* The user shall override ::get_format() with something sensible
>>> enough */
>>> +    if (!avctx->get_format || avctx->get_format ==
>>> avcodec_default_get_format)
>>> +        return NULL;
>>
>> avctx->get_format being NULL seems invalid, so no need to check for it
>> also i suspect it would be cleaner to make avcodec_default_get_format()
>> skip hw-accel formats.
>
> Implemented with an ff_is_hwaccel_pix_fmt() function. That's intentionally
> internal because users are expected to handle the HW accelerated pix_fmt
> specifically anyway. IMO, this is only useful for lavc.

I think this is wrong.
This makes support for combined (software & hardware) decoders much harder.

Application may want to try out the hardware accelerated formats first
then make second pass for fallback non-accelerated.

Without implementing similar function it would have to check the
array multiple times for each know pix_fmt or check each pix_fmt for the
multiple known formats.




More information about the ffmpeg-devel mailing list