[FFmpeg-devel] [PATCH][VAAPI][2/6] Add common data structures and helpers (take 5)

Gwenole Beauchesne gbeauchesne
Tue Mar 10 22:50:06 CET 2009


Le 10 mars 09 ? 22:20, Michael Niedermayer a ?crit :

>> +    rds->slice_data             = NULL;
>> +    rds->slice_data_size        = 0;
>
> memset(0) seems simpler if these are not guranteed to be allocated by
> av_mallocz() or another zeroing alloc, but guranteeing this seems like
> the best choice ...

So, you are suggesting to av_mallocz() hwaccel_data_private? That's  
fine with me.

>> [...]
>> +    slice_params = rds->slice_params;
>> +    if (rds->slice_count >= rds->n_slice_params_alloc) {
>> +        rds->n_slice_params_alloc += 16;
>> +        slice_params = av_realloc(rds->slice_params,
>> +                                  rds->n_slice_params_alloc * rds- 
>> >slice_param_size);
>> +        if (!slice_params) {
>> +            av_free(rds->slice_params);
>> +            return NULL;
>> +        }
>> +        rds->slice_params = slice_params;
>> +    }
>
> av_fast_realloc() might be usefull for this

It needs a size arg but I'd like to deal with a length arg.

>> +    if ((rds = ff_get_vaapi_render_state_private(s- 
>> >current_picture_ptr)) == NULL)
>> +        return -1;
>
> how can this be NULL?
> if it cant the check is unneeded

It can't be NULL, this shall be allocated prior to the  
AVCodecContext.get_buffer() call.



More information about the ffmpeg-devel mailing list