int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic){

    AVFrame temp_pic;

    int i;



    assert(s->codec_type == AVMEDIA_TYPE_VIDEO);



    if (pic->data[0] && (pic->width != s->width || pic->height != s->height || pic->format != s->pix_fmt)) {

        av_log(s, AV_LOG_WARNING, "Picture changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s in reget buffer()\n",

               pic->width, pic->height, av_get_pix_fmt_name(pic->format), s->width, s->height, av_get_pix_fmt_name(s->pix_fmt));

        s->release_buffer(s, pic);

    }



    /* If no picture return a new buffer */

    if(pic->data[0] == NULL) {

        /* We will copy from buffer, so must be readable */

        pic->buffer_hints |= FF_BUFFER_HINTS_READABLE;

        return s->get_buffer(s, pic);

    }



    /* If internal buffer type return the same buffer */

    if(pic->type == FF_BUFFER_TYPE_INTERNAL) {

        if(s->pkt) pic->pkt_pts= s->pkt->pts;

        else       pic->pkt_pts= AV_NOPTS_VALUE;

        pic->reordered_opaque= s->reordered_opaque;

        return 0;

    }



    /*

     * Not internal type and reget_buffer not overridden, emulate cr buffer

     */

    temp_pic = *pic;

    for(i = 0; i < AV_NUM_DATA_POINTERS; i++)

        pic->data[i] = pic->base[i] = NULL;

    pic->opaque = NULL;

    /* Allocate new frame */

    if (s->get_buffer(s, pic))

        return -1;

    /* Copy image data from old buffer to new buffer */

    av_picture_copy((AVPicture*)pic, (AVPicture*)&temp_pic, s->pix_fmt, s->width,

             s->height);

    s->release_buffer(s, &temp_pic); // Release old frame

    return 0;

}

int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic){

    AVFrame temp_pic;

    int i;



    assert(s->codec_type == AVMEDIA_TYPE_VIDEO);



    if (pic->data[0] && (pic->width != s->width || pic->height != s->height || pic->format != s->pix_fmt)) {

        av_log(s, AV_LOG_WARNING, "Picture changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s in reget buffer()\n",

               pic->width, pic->height, av_get_pix_fmt_name(pic->format), s->width, s->height, av_get_pix_fmt_name(s->pix_fmt));

        s->release_buffer(s, pic);

    }



    

    if(pic->data[0] == NULL) {

        

        pic->buffer_hints |= FF_BUFFER_HINTS_READABLE;

        return s->get_buffer(s, pic);

    }



    

    if(pic->type == FF_BUFFER_TYPE_INTERNAL) {

        if(s->pkt) pic->pkt_pts= s->pkt->pts;

        else       pic->pkt_pts= AV_NOPTS_VALUE;

        pic->reordered_opaque= s->reordered_opaque;

        return 0;

    }



    





    temp_pic = *pic;

    for(i = 0; i < AV_NUM_DATA_POINTERS; i++)

        pic->data[i] = pic->base[i] = NULL;

    pic->opaque = NULL;

    

    if (s->get_buffer(s, pic))

        return -1;

    

    av_picture_copy((AVPicture*)pic, (AVPicture*)&temp_pic, s->pix_fmt, s->width,

             s->height);

    s->release_buffer(s, &temp_pic); 

    return 0;

}

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

    AVFrame temp_pic;

    int VAR_2;



    assert(VAR_0->codec_type == AVMEDIA_TYPE_VIDEO);



    if (VAR_1->data[0] && (VAR_1->width != VAR_0->width || VAR_1->height != VAR_0->height || VAR_1->format != VAR_0->pix_fmt)) {

        av_log(VAR_0, AV_LOG_WARNING, "Picture changed from size:%dx%d fmt:%VAR_0 to size:%dx%d fmt:%VAR_0 in reget buffer()\n",

               VAR_1->width, VAR_1->height, av_get_pix_fmt_name(VAR_1->format), VAR_0->width, VAR_0->height, av_get_pix_fmt_name(VAR_0->pix_fmt));

        VAR_0->release_buffer(VAR_0, VAR_1);

    }



    

    if(VAR_1->data[0] == NULL) {

        

        VAR_1->buffer_hints |= FF_BUFFER_HINTS_READABLE;

        return VAR_0->get_buffer(VAR_0, VAR_1);

    }



    

    if(VAR_1->type == FF_BUFFER_TYPE_INTERNAL) {

        if(VAR_0->pkt) VAR_1->pkt_pts= VAR_0->pkt->pts;

        else       VAR_1->pkt_pts= AV_NOPTS_VALUE;

        VAR_1->reordered_opaque= VAR_0->reordered_opaque;

        return 0;

    }



    





    temp_pic = *VAR_1;

    for(VAR_2 = 0; VAR_2 < AV_NUM_DATA_POINTERS; VAR_2++)

        VAR_1->data[VAR_2] = VAR_1->base[VAR_2] = NULL;

    VAR_1->opaque = NULL;

    

    if (VAR_0->get_buffer(VAR_0, VAR_1))

        return -1;

    

    av_picture_copy((AVPicture*)VAR_1, (AVPicture*)&temp_pic, VAR_0->pix_fmt, VAR_0->width,

             VAR_0->height);

    VAR_0->release_buffer(VAR_0, &temp_pic); 

    return 0;

}

int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1){ AVFrame temp_pic; int VAR_2; assert(VAR_0->codec_type == AVMEDIA_TYPE_VIDEO); if (VAR_1->data[0] && (VAR_1->width != VAR_0->width || VAR_1->height != VAR_0->height || VAR_1->format != VAR_0->pix_fmt)) { av_log(VAR_0, AV_LOG_WARNING, "Picture changed from size:%dx%d fmt:%VAR_0 to size:%dx%d fmt:%VAR_0 in reget buffer()\n",
VAR_1->width, VAR_1->height, av_get_pix_fmt_name(VAR_1->format), VAR_0->width, VAR_0->height, av_get_pix_fmt_name(VAR_0->pix_fmt)); VAR_0->release_buffer(VAR_0, VAR_1); } if(VAR_1->data[0] == NULL) { VAR_1->buffer_hints |= FF_BUFFER_HINTS_READABLE; return VAR_0->get_buffer(VAR_0, VAR_1); } if(VAR_1->type == FF_BUFFER_TYPE_INTERNAL) { if(VAR_0->pkt) VAR_1->pkt_pts= VAR_0->pkt->pts; else       VAR_1->pkt_pts= AV_NOPTS_VALUE; VAR_1->reordered_opaque= VAR_0->reordered_opaque; return 0; } temp_pic = *VAR_1; for(VAR_2 = 0; VAR_2 < AV_NUM_DATA_POINTERS; VAR_2++) VAR_1->data[VAR_2] = VAR_1->base[VAR_2] = NULL; VAR_1->opaque = NULL; if (VAR_0->get_buffer(VAR_0, VAR_1))
return -1; av_picture_copy((AVPicture*)VAR_1, (AVPicture*)&temp_pic, VAR_0->pix_fmt, VAR_0->width,
VAR_0->height); VAR_0->release_buffer(VAR_0, &temp_pic); return 0; }