int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame)

{

    AVFrame *tmp;

    int ret;



    av_assert0(avctx->codec_type == AVMEDIA_TYPE_VIDEO);



    if (!frame->data[0])

        return ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF);



    if (av_frame_is_writable(frame)) {

        frame->pkt_pts = avctx->internal->pkt ? avctx->internal->pkt->pts : AV_NOPTS_VALUE;

        frame->reordered_opaque = avctx->reordered_opaque;

        return 0;

    }



    tmp = av_frame_alloc();

    if (!tmp)

        return AVERROR(ENOMEM);



    av_frame_move_ref(tmp, frame);



    ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF);

    if (ret < 0) {

        av_frame_free(&tmp);

        return ret;

    }



    av_frame_copy(frame, tmp);

    av_frame_free(&tmp);



    return 0;

}

int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame)

{

    AVFrame *tmp;

    int ret;



    av_assert0(avctx->codec_type == AVMEDIA_TYPE_VIDEO);



    if (!frame->data[0])

        return ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF);



    if (av_frame_is_writable(frame)) {

        frame->pkt_pts = avctx->internal->pkt ? avctx->internal->pkt->pts : AV_NOPTS_VALUE;

        frame->reordered_opaque = avctx->reordered_opaque;

        return 0;

    }



    tmp = av_frame_alloc();

    if (!tmp)

        return AVERROR(ENOMEM);



    av_frame_move_ref(tmp, frame);



    ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF);

    if (ret < 0) {

        av_frame_free(&tmp);

        return ret;

    }



    av_frame_copy(frame, tmp);

    av_frame_free(&tmp);



    return 0;

}

int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1)

{

    AVFrame *tmp;

    int VAR_2;



    av_assert0(VAR_0->codec_type == AVMEDIA_TYPE_VIDEO);



    if (!VAR_1->data[0])

        return ff_get_buffer(VAR_0, VAR_1, AV_GET_BUFFER_FLAG_REF);



    if (av_frame_is_writable(VAR_1)) {

        VAR_1->pkt_pts = VAR_0->internal->pkt ? VAR_0->internal->pkt->pts : AV_NOPTS_VALUE;

        VAR_1->reordered_opaque = VAR_0->reordered_opaque;

        return 0;

    }



    tmp = av_frame_alloc();

    if (!tmp)

        return AVERROR(ENOMEM);



    av_frame_move_ref(tmp, VAR_1);



    VAR_2 = ff_get_buffer(VAR_0, VAR_1, AV_GET_BUFFER_FLAG_REF);

    if (VAR_2 < 0) {

        av_frame_free(&tmp);

        return VAR_2;

    }



    av_frame_copy(VAR_1, tmp);

    av_frame_free(&tmp);



    return 0;

}

int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1)
{ AVFrame *tmp; int VAR_2; av_assert0(VAR_0->codec_type == AVMEDIA_TYPE_VIDEO); if (!VAR_1->data[0])
return ff_get_buffer(VAR_0, VAR_1, AV_GET_BUFFER_FLAG_REF); if (av_frame_is_writable(VAR_1)) { VAR_1->pkt_pts = VAR_0->internal->pkt ? VAR_0->internal->pkt->pts : AV_NOPTS_VALUE; VAR_1->reordered_opaque = VAR_0->reordered_opaque; return 0; } tmp = av_frame_alloc(); if (!tmp)
return AVERROR(ENOMEM); av_frame_move_ref(tmp, VAR_1); VAR_2 = ff_get_buffer(VAR_0, VAR_1, AV_GET_BUFFER_FLAG_REF); if (VAR_2 < 0) { av_frame_free(&tmp); return VAR_2; } av_frame_copy(VAR_1, tmp); av_frame_free(&tmp); return 0; }