[FFmpeg-devel] [PATCH] AVHWAccel infrastructure v2 (take 3)
Gwenole Beauchesne
gbeauchesne
Mon Jan 4 14:09:51 CET 2010
Hi,
On Sun, 15 Nov 2009, Michael Niedermayer wrote:
> On Fri, Nov 13, 2009 at 04:50:11PM +0100, Gwenole Beauchesne wrote:
>> On Mon, 9 Nov 2009, Michael Niedermayer wrote:
>>
>>> [...]
>>>> @@ -2526,6 +2527,14 @@ typedef struct AVCodecContext {
>>>> * - decoding: Set by libavcodec
>>>> */
>>>> enum AVChromaLocation chroma_sample_location;
>>>> +
>>>> + /**
>>>> + * Hardware accelerator configuration attributes.
>>>> + * The array is terminated by HWACCEL_ATTR_NONE.
>>>> + * - encoding: unused
>>>> + * - decoding: Set by user
>>>> + */
>>>> + const uintptr_t *hwaccel_attrs;
>>>> } AVCodecContext;
>>>>
>>>> /**
>>>
>>> uintptr_t is an optional type in C
>>> and i really have a bad feeling about using it in public API, i bet this
>>> will break several compilers
>>>
>>> and this way of passing information/attributes is very odd and there is
>>> no support in AVOptions to deal with that
>>> so i really think a int someflags would be better
>>
>> Do you mean I should use AVOptions directly + add an FF_OPT_TYPE_POINTER?
>> The problem is I don't see any codec using av_get_*() so I don't think that
>> was what you meant or is there another API to access AVOptions?
>
>
> i mean
>
> + int my_flags;
> } AVCodecContext;
In the new model I wanted to use, hwaccel_context was to be solely
maintained by libavcodec. However, it still needed a way to get some
hwaccel context initialized by the user-application. e.g. a VADisplay
(void *), an LPDIRECTXVIDEODECODER, etc.
I felt interesting to pass this information through hwaccel attrs along
with other int attributes.
We might be able to solve this by:
- making that user-provided hwaccel context stick to hwaccel_context
- move what we currently know as hwaccel_context data to an
hwaccel_context_private?
WDYT?
Or we could have ff_init_hwaccel() call some AVCodecContext.get_hwaccel()
function that is user-implemented as follows:
/**
* @param[in] avctx the codec context
* @param[in] codec_id the codec
* @param[out] hwaccel_context the hardware accelerator dependent context
* @return the hardware accelerator ID, or HWACCEL_ID_NONE if none is suitable
*/
enum AVHWAccelID get_hwaccel(AVCodecContext *avctx, enum CodecID codec_id, void **hwaccel_context);
and declare AVCodecContext.hwaccel_context maintained by libavcodec for v2
?
More information about the ffmpeg-devel
mailing list