int ff_vaapi_commit_slices(FFVAContext *vactx)

{

    VABufferID *slice_buf_ids;

    VABufferID slice_param_buf_id, slice_data_buf_id;



    if (vactx->slice_count == 0)

        return 0;



    slice_buf_ids =

        av_fast_realloc(vactx->slice_buf_ids,

                        &vactx->slice_buf_ids_alloc,

                        (vactx->n_slice_buf_ids + 2) * sizeof(slice_buf_ids[0]));

    if (!slice_buf_ids)

        return -1;

    vactx->slice_buf_ids = slice_buf_ids;



    slice_param_buf_id = 0;

    if (vaCreateBuffer(vactx->display, vactx->context_id,

                       VASliceParameterBufferType,

                       vactx->slice_param_size,

                       vactx->slice_count, vactx->slice_params,

                       &slice_param_buf_id) != VA_STATUS_SUCCESS)

        return -1;

    vactx->slice_count = 0;



    slice_data_buf_id = 0;

    if (vaCreateBuffer(vactx->display, vactx->context_id,

                       VASliceDataBufferType,

                       vactx->slice_data_size,

                       1, (void *)vactx->slice_data,

                       &slice_data_buf_id) != VA_STATUS_SUCCESS)

        return -1;

    vactx->slice_data = NULL;

    vactx->slice_data_size = 0;



    slice_buf_ids[vactx->n_slice_buf_ids++] = slice_param_buf_id;

    slice_buf_ids[vactx->n_slice_buf_ids++] = slice_data_buf_id;

    return 0;

}

int ff_vaapi_commit_slices(FFVAContext *vactx)

{

    VABufferID *slice_buf_ids;

    VABufferID slice_param_buf_id, slice_data_buf_id;



    if (vactx->slice_count == 0)

        return 0;



    slice_buf_ids =

        av_fast_realloc(vactx->slice_buf_ids,

                        &vactx->slice_buf_ids_alloc,

                        (vactx->n_slice_buf_ids + 2) * sizeof(slice_buf_ids[0]));

    if (!slice_buf_ids)

        return -1;

    vactx->slice_buf_ids = slice_buf_ids;



    slice_param_buf_id = 0;

    if (vaCreateBuffer(vactx->display, vactx->context_id,

                       VASliceParameterBufferType,

                       vactx->slice_param_size,

                       vactx->slice_count, vactx->slice_params,

                       &slice_param_buf_id) != VA_STATUS_SUCCESS)

        return -1;

    vactx->slice_count = 0;



    slice_data_buf_id = 0;

    if (vaCreateBuffer(vactx->display, vactx->context_id,

                       VASliceDataBufferType,

                       vactx->slice_data_size,

                       1, (void *)vactx->slice_data,

                       &slice_data_buf_id) != VA_STATUS_SUCCESS)

        return -1;

    vactx->slice_data = NULL;

    vactx->slice_data_size = 0;



    slice_buf_ids[vactx->n_slice_buf_ids++] = slice_param_buf_id;

    slice_buf_ids[vactx->n_slice_buf_ids++] = slice_data_buf_id;

    return 0;

}

int FUNC_0(FFVAContext *VAR_0)

{

    VABufferID *slice_buf_ids;

    VABufferID slice_param_buf_id, slice_data_buf_id;



    if (VAR_0->slice_count == 0)

        return 0;



    slice_buf_ids =

        av_fast_realloc(VAR_0->slice_buf_ids,

                        &VAR_0->slice_buf_ids_alloc,

                        (VAR_0->n_slice_buf_ids + 2) * sizeof(slice_buf_ids[0]));

    if (!slice_buf_ids)

        return -1;

    VAR_0->slice_buf_ids = slice_buf_ids;



    slice_param_buf_id = 0;

    if (vaCreateBuffer(VAR_0->display, VAR_0->context_id,

                       VASliceParameterBufferType,

                       VAR_0->slice_param_size,

                       VAR_0->slice_count, VAR_0->slice_params,

                       &slice_param_buf_id) != VA_STATUS_SUCCESS)

        return -1;

    VAR_0->slice_count = 0;



    slice_data_buf_id = 0;

    if (vaCreateBuffer(VAR_0->display, VAR_0->context_id,

                       VASliceDataBufferType,

                       VAR_0->slice_data_size,

                       1, (void *)VAR_0->slice_data,

                       &slice_data_buf_id) != VA_STATUS_SUCCESS)

        return -1;

    VAR_0->slice_data = NULL;

    VAR_0->slice_data_size = 0;



    slice_buf_ids[VAR_0->n_slice_buf_ids++] = slice_param_buf_id;

    slice_buf_ids[VAR_0->n_slice_buf_ids++] = slice_data_buf_id;

    return 0;

}

int FUNC_0(FFVAContext *VAR_0)
{ VABufferID *slice_buf_ids; VABufferID slice_param_buf_id, slice_data_buf_id; if (VAR_0->slice_count == 0)
return 0; slice_buf_ids =
av_fast_realloc(VAR_0->slice_buf_ids,
&VAR_0->slice_buf_ids_alloc,
(VAR_0->n_slice_buf_ids + 2) * sizeof(slice_buf_ids[0])); if (!slice_buf_ids)
return -1; VAR_0->slice_buf_ids = slice_buf_ids; slice_param_buf_id = 0; if (vaCreateBuffer(VAR_0->display, VAR_0->context_id,
VASliceParameterBufferType,
VAR_0->slice_param_size,
VAR_0->slice_count, VAR_0->slice_params,
&slice_param_buf_id) != VA_STATUS_SUCCESS)
return -1; VAR_0->slice_count = 0; slice_data_buf_id = 0; if (vaCreateBuffer(VAR_0->display, VAR_0->context_id,
VASliceDataBufferType,
VAR_0->slice_data_size,
1, (void *)VAR_0->slice_data,
&slice_data_buf_id) != VA_STATUS_SUCCESS)
return -1; VAR_0->slice_data = NULL; VAR_0->slice_data_size = 0; slice_buf_ids[VAR_0->n_slice_buf_ids++] = slice_param_buf_id; slice_buf_ids[VAR_0->n_slice_buf_ids++] = slice_data_buf_id; return 0; }