static int vda_h264_decode_slice(AVCodecContext *avctx,

                                 const uint8_t *buffer,

                                 uint32_t size)

{

    VDAContext *vda                     = avctx->internal->hwaccel_priv_data;

    struct vda_context *vda_ctx         = avctx->hwaccel_context;

    void *tmp;



    if (!vda_ctx->decoder)

        return -1;



    tmp = av_fast_realloc(vda->bitstream,

                          &vda->allocated_size,

                          vda->bitstream_size + size + 4);

    if (!tmp)

        return AVERROR(ENOMEM);



    vda->bitstream = tmp;



    AV_WB32(vda->bitstream + vda->bitstream_size, size);

    memcpy(vda->bitstream + vda->bitstream_size + 4, buffer, size);



    vda->bitstream_size += size + 4;



    return 0;

}

static int vda_h264_decode_slice(AVCodecContext *avctx,

                                 const uint8_t *buffer,

                                 uint32_t size)

{

    VDAContext *vda                     = avctx->internal->hwaccel_priv_data;

    struct vda_context *vda_ctx         = avctx->hwaccel_context;

    void *tmp;



    if (!vda_ctx->decoder)

        return -1;



    tmp = av_fast_realloc(vda->bitstream,

                          &vda->allocated_size,

                          vda->bitstream_size + size + 4);

    if (!tmp)

        return AVERROR(ENOMEM);



    vda->bitstream = tmp;



    AV_WB32(vda->bitstream + vda->bitstream_size, size);

    memcpy(vda->bitstream + vda->bitstream_size + 4, buffer, size);



    vda->bitstream_size += size + 4;



    return 0;

}

static int FUNC_0(AVCodecContext *VAR_0,

                                 const uint8_t *VAR_1,

                                 uint32_t VAR_2)

{

    VDAContext *vda                     = VAR_0->internal->hwaccel_priv_data;

    struct vda_context *VAR_3         = VAR_0->hwaccel_context;

    void *VAR_4;



    if (!VAR_3->decoder)

        return -1;



    VAR_4 = av_fast_realloc(vda->bitstream,

                          &vda->allocated_size,

                          vda->bitstream_size + VAR_2 + 4);

    if (!VAR_4)

        return AVERROR(ENOMEM);



    vda->bitstream = VAR_4;



    AV_WB32(vda->bitstream + vda->bitstream_size, VAR_2);

    memcpy(vda->bitstream + vda->bitstream_size + 4, VAR_1, VAR_2);



    vda->bitstream_size += VAR_2 + 4;



    return 0;

}

static int FUNC_0(AVCodecContext *VAR_0,
const uint8_t *VAR_1,
uint32_t VAR_2)
{ VDAContext *vda                     = VAR_0->internal->hwaccel_priv_data; struct vda_context *VAR_3         = VAR_0->hwaccel_context; void *VAR_4; if (!VAR_3->decoder)
return -1; VAR_4 = av_fast_realloc(vda->bitstream,
&vda->allocated_size,
vda->bitstream_size + VAR_2 + 4); if (!VAR_4)
return AVERROR(ENOMEM); vda->bitstream = VAR_4; AV_WB32(vda->bitstream + vda->bitstream_size, VAR_2); memcpy(vda->bitstream + vda->bitstream_size + 4, VAR_1, VAR_2); vda->bitstream_size += VAR_2 + 4; return 0; }