static int qsv_get_buffer(AVCodecContext *s, AVFrame *frame, int flags)

{

    InputStream *ist = s->opaque;

    QSVContext  *qsv = ist->hwaccel_ctx;

    int i;



    for (i = 0; i < qsv->nb_surfaces; i++) {

        if (qsv->surface_used[i])

            continue;



        frame->buf[0] = av_buffer_create((uint8_t*)qsv->surface_ptrs[i], sizeof(*qsv->surface_ptrs[i]),

                                         buffer_release, &qsv->surface_used[i], 0);

        if (!frame->buf[0])

            return AVERROR(ENOMEM);

        frame->data[3]       = (uint8_t*)qsv->surface_ptrs[i];

        qsv->surface_used[i] = 1;

        return 0;

    }



    return AVERROR(ENOMEM);

}

static int qsv_get_buffer(AVCodecContext *s, AVFrame *frame, int flags)

{

    InputStream *ist = s->opaque;

    QSVContext  *qsv = ist->hwaccel_ctx;

    int i;



    for (i = 0; i < qsv->nb_surfaces; i++) {

        if (qsv->surface_used[i])

            continue;



        frame->buf[0] = av_buffer_create((uint8_t*)qsv->surface_ptrs[i], sizeof(*qsv->surface_ptrs[i]),

                                         buffer_release, &qsv->surface_used[i], 0);

        if (!frame->buf[0])

            return AVERROR(ENOMEM);

        frame->data[3]       = (uint8_t*)qsv->surface_ptrs[i];

        qsv->surface_used[i] = 1;

        return 0;

    }



    return AVERROR(ENOMEM);

}

static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1, int VAR_2)

{

    InputStream *ist = VAR_0->opaque;

    QSVContext  *qsv = ist->hwaccel_ctx;

    int VAR_3;



    for (VAR_3 = 0; VAR_3 < qsv->nb_surfaces; VAR_3++) {

        if (qsv->surface_used[VAR_3])

            continue;



        VAR_1->buf[0] = av_buffer_create((uint8_t*)qsv->surface_ptrs[VAR_3], sizeof(*qsv->surface_ptrs[VAR_3]),

                                         buffer_release, &qsv->surface_used[VAR_3], 0);

        if (!VAR_1->buf[0])

            return AVERROR(ENOMEM);

        VAR_1->data[3]       = (uint8_t*)qsv->surface_ptrs[VAR_3];

        qsv->surface_used[VAR_3] = 1;

        return 0;

    }



    return AVERROR(ENOMEM);

}

static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1, int VAR_2)
{ InputStream *ist = VAR_0->opaque; QSVContext  *qsv = ist->hwaccel_ctx; int VAR_3; for (VAR_3 = 0; VAR_3 < qsv->nb_surfaces; VAR_3++) { if (qsv->surface_used[VAR_3])
continue; VAR_1->buf[0] = av_buffer_create((uint8_t*)qsv->surface_ptrs[VAR_3], sizeof(*qsv->surface_ptrs[VAR_3]),
buffer_release, &qsv->surface_used[VAR_3], 0); if (!VAR_1->buf[0])
return AVERROR(ENOMEM); VAR_1->data[3]       = (uint8_t*)qsv->surface_ptrs[VAR_3]; qsv->surface_used[VAR_3] = 1; return 0; } return AVERROR(ENOMEM); }