static int video_get_buffer(AVCodecContext *s, AVFrame *pic)

{

    FramePool *pool = s->internal->pool;

    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pic->format);

    int i;



    if (pic->data[0]) {

        av_log(s, AV_LOG_ERROR, "pic->data[0]!=NULL in avcodec_default_get_buffer\n");

        return -1;

    }



    if (!desc) {

        av_log(s, AV_LOG_ERROR,

            "Unable to get pixel format descriptor for format %s\n",

            av_get_pix_fmt_name(pic->format));

        return AVERROR(EINVAL);

    }



    memset(pic->data, 0, sizeof(pic->data));

    pic->extended_data = pic->data;



    for (i = 0; i < 4 && pool->pools[i]; i++) {

        pic->linesize[i] = pool->linesize[i];



        pic->buf[i] = av_buffer_pool_get(pool->pools[i]);

        if (!pic->buf[i])

            goto fail;



        pic->data[i] = pic->buf[i]->data;

    }

    for (; i < AV_NUM_DATA_POINTERS; i++) {

        pic->data[i] = NULL;

        pic->linesize[i] = 0;

    }

    if (desc->flags & AV_PIX_FMT_FLAG_PAL ||

        desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)

        avpriv_set_systematic_pal2((uint32_t *)pic->data[1], pic->format);



    if (s->debug & FF_DEBUG_BUFFERS)

        av_log(s, AV_LOG_DEBUG, "default_get_buffer called on pic %p\n", pic);



    return 0;

fail:

    av_frame_unref(pic);

    return AVERROR(ENOMEM);

}

static int video_get_buffer(AVCodecContext *s, AVFrame *pic)

{

    FramePool *pool = s->internal->pool;

    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pic->format);

    int i;



    if (pic->data[0]) {

        av_log(s, AV_LOG_ERROR, "pic->data[0]!=NULL in avcodec_default_get_buffer\n");

        return -1;

    }



    if (!desc) {

        av_log(s, AV_LOG_ERROR,

            "Unable to get pixel format descriptor for format %s\n",

            av_get_pix_fmt_name(pic->format));

        return AVERROR(EINVAL);

    }



    memset(pic->data, 0, sizeof(pic->data));

    pic->extended_data = pic->data;



    for (i = 0; i < 4 && pool->pools[i]; i++) {

        pic->linesize[i] = pool->linesize[i];



        pic->buf[i] = av_buffer_pool_get(pool->pools[i]);

        if (!pic->buf[i])

            goto fail;



        pic->data[i] = pic->buf[i]->data;

    }

    for (; i < AV_NUM_DATA_POINTERS; i++) {

        pic->data[i] = NULL;

        pic->linesize[i] = 0;

    }

    if (desc->flags & AV_PIX_FMT_FLAG_PAL ||

        desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)

        avpriv_set_systematic_pal2((uint32_t *)pic->data[1], pic->format);



    if (s->debug & FF_DEBUG_BUFFERS)

        av_log(s, AV_LOG_DEBUG, "default_get_buffer called on pic %p\n", pic);



    return 0;

fail:

    av_frame_unref(pic);

    return AVERROR(ENOMEM);

}

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

{

    FramePool *pool = VAR_0->internal->pool;

    const AVPixFmtDescriptor *VAR_2 = av_pix_fmt_desc_get(VAR_1->format);

    int VAR_3;



    if (VAR_1->data[0]) {

        av_log(VAR_0, AV_LOG_ERROR, "VAR_1->data[0]!=NULL in avcodec_default_get_buffer\n");

        return -1;

    }



    if (!VAR_2) {

        av_log(VAR_0, AV_LOG_ERROR,

            "Unable to get pixel format descriptor for format %VAR_0\n",

            av_get_pix_fmt_name(VAR_1->format));

        return AVERROR(EINVAL);

    }



    memset(VAR_1->data, 0, sizeof(VAR_1->data));

    VAR_1->extended_data = VAR_1->data;



    for (VAR_3 = 0; VAR_3 < 4 && pool->pools[VAR_3]; VAR_3++) {

        VAR_1->linesize[VAR_3] = pool->linesize[VAR_3];



        VAR_1->buf[VAR_3] = av_buffer_pool_get(pool->pools[VAR_3]);

        if (!VAR_1->buf[VAR_3])

            goto fail;



        VAR_1->data[VAR_3] = VAR_1->buf[VAR_3]->data;

    }

    for (; VAR_3 < AV_NUM_DATA_POINTERS; VAR_3++) {

        VAR_1->data[VAR_3] = NULL;

        VAR_1->linesize[VAR_3] = 0;

    }

    if (VAR_2->flags & AV_PIX_FMT_FLAG_PAL ||

        VAR_2->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)

        avpriv_set_systematic_pal2((uint32_t *)VAR_1->data[1], VAR_1->format);



    if (VAR_0->debug & FF_DEBUG_BUFFERS)

        av_log(VAR_0, AV_LOG_DEBUG, "default_get_buffer called on VAR_1 %p\n", VAR_1);



    return 0;

fail:

    av_frame_unref(VAR_1);

    return AVERROR(ENOMEM);

}

static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1)
{ FramePool *pool = VAR_0->internal->pool; const AVPixFmtDescriptor *VAR_2 = av_pix_fmt_desc_get(VAR_1->format); int VAR_3; if (VAR_1->data[0]) { av_log(VAR_0, AV_LOG_ERROR, "VAR_1->data[0]!=NULL in avcodec_default_get_buffer\n"); return -1; } if (!VAR_2) { av_log(VAR_0, AV_LOG_ERROR,
"Unable to get pixel format descriptor for format %VAR_0\n",
av_get_pix_fmt_name(VAR_1->format)); return AVERROR(EINVAL); } memset(VAR_1->data, 0, sizeof(VAR_1->data)); VAR_1->extended_data = VAR_1->data; for (VAR_3 = 0; VAR_3 < 4 && pool->pools[VAR_3]; VAR_3++) { VAR_1->linesize[VAR_3] = pool->linesize[VAR_3]; VAR_1->buf[VAR_3] = av_buffer_pool_get(pool->pools[VAR_3]); if (!VAR_1->buf[VAR_3])
goto fail; VAR_1->data[VAR_3] = VAR_1->buf[VAR_3]->data; } for (; VAR_3 < AV_NUM_DATA_POINTERS; VAR_3++) { VAR_1->data[VAR_3] = NULL; VAR_1->linesize[VAR_3] = 0; } if (VAR_2->flags & AV_PIX_FMT_FLAG_PAL ||
VAR_2->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)
avpriv_set_systematic_pal2((uint32_t *)VAR_1->data[1], VAR_1->format); if (VAR_0->debug & FF_DEBUG_BUFFERS)
av_log(VAR_0, AV_LOG_DEBUG, "default_get_buffer called on VAR_1 %p\n", VAR_1); return 0; fail:
av_frame_unref(VAR_1); return AVERROR(ENOMEM); }