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

Gwenole Beauchesne gbeauchesne
Tue Mar 10 23:56:04 CET 2009


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

> [...]
>> +/** Initialize VA API render state */
>> +static int vaapi_render_state_init(struct  
>> vaapi_render_state_private *rds, Picture *pic)
>> +{
>> +    struct vaapi_render_state * const r =  
>> ff_get_vaapi_render_state(pic);
>> +
>> +    assert(r && r->va_context);
>> +    rds->display                = r->va_context->display;
>> +    rds->context_id             = r->va_context->context_id;
>> +    rds->surface                = r->surface;
>
>> +    rds->pic_param_buf_id       = 0;
>> +    rds->iq_matrix_buf_id       = 0;
>> +    rds->bitplane_buf_id        = 0;
>> +    rds->slice_buf_ids          = NULL;
>> +    rds->n_slice_buf_ids        = 0;
>> +    rds->n_slice_buf_ids_alloc  = 0;
>> +    rds->slice_params           = NULL;
>> +    rds->n_slice_params_alloc   = 0;
>> +    rds->slice_count            = 0;
>> +    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 ...

Assuming you really meant av_mallocz() hwaccel_data_private (see other  
patch), here is a new patch.

>> +    if (rds->slice_buf_ids) {
>> +        for (i = 0; i < rds->n_slice_buf_ids; i++) {
>> +            vaDestroyBuffer(rds->display, rds->slice_buf_ids[i]);
>> +            rds->slice_buf_ids[i] = 0;
>> +        }
>> +        av_freep(&rds->slice_buf_ids);
>> +    }
>> +    av_freep(&rds->slice_params);
>> +    return 0;
>> +}
>
> static destroy_buffer(VADisplay display, VABufferID *id){
>    if(*id){
>        vaDestroyBuffer(display, *id);
>        *id=0;
>    }
> }

A destroy_buffers() was preferred.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg.hwaccel.vaapi.common.6.patch
Type: application/octet-stream
Size: 13925 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090310/f4c1ee9d/attachment.obj>
-------------- next part --------------




More information about the ffmpeg-devel mailing list