[FFmpeg-devel] [RFC] Add AVFrame::hwaccel_data{, _private} (Was: [PATCH][VAAPI][2/6] Add common data structures and helpers)
Gwenole Beauchesne
gbeauchesne
Mon Mar 2 10:32:07 CET 2009
On Fri, 27 Feb 2009, Michael Niedermayer wrote:
>> +/**
>> + * Allocates HW acceleration private data
>> + */
>> +static void *alloc_hwaccel_data_private(AVCodecContext *avctx)
>> +{
>> + void *pdata = NULL;
>> + assert(avctx->hwaccel);
>> + switch (avctx->hwaccel->pix_fmt) {
>> + case PIX_FMT_VAAPI_MOCO:
>> + case PIX_FMT_VAAPI_IDCT:
>> + case PIX_FMT_VAAPI_VLD:
>> + pdata = ff_alloc_vaapi_render_state_private();
>> + break;
>> + default:
>> + break;
>> + }
>> + return pdata;
>> +}
>
> these probably should be done differently, but i first need to take a
> look at ff_free_vaapi_render_state_private()
> if its just a wraper around a avmalloc() then a priv_data_size field
> in AVHWAccel should do otherwise i guess a open/close in AVHWAccel
> would be better
Yes, I also wondered about that once I shrank the function to
return av_mallocz(sizeof(struct vaapi_render_state_private));
That's true for VA API, but others probably would want to do anything
special. open/close then?
I am also wondering about a means to differentiate encode/decode as I
foresee encode acceleration soon.
> spliting code out belongs in a seperate patch that does only split code
> out, also
> i dont like the name get_buffer() it makes grepping hard as theres
> AVCodecContext.get_buffer()
alloc_frame_buffer() / free_frame_buffer()?
More information about the ffmpeg-devel
mailing list