fprintf(stderr, "get_buffer() failed\n");
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size){    FFV1Context *f = avctx->priv_data;    CABACContext * const c= &f->c;    const int width= f->width;    const int height= f->height;    AVFrame * const p= &f->picture;    int bytes_read;    AVFrame *picture = data;    *data_size = 0;    /* no supplementary picture */    if (buf_size == 0)        return 0;    ff_init_cabac_decoder(c, buf, buf_size);    ff_init_cabac_states(c, ff_h264_lps_range, ff_h264_mps_state, ff_h264_lps_state, 64);    p->pict_type= FF_I_TYPE; //FIXME I vs. P    if(get_cabac_bypass(c)){        p->key_frame= 1;        read_header(f);        clear_state(f);    }else{        p->key_frame= 0;    }    p->reference= 0;    if(avctx->get_buffer(avctx, p) < 0){        fprintf(stderr, "get_buffer() failed\n");        return -1;    }    if(avctx->debug&FF_DEBUG_PICT_INFO)        printf("keyframe:%d coder:%d\n", p->key_frame, f->ac);        if(!f->ac){        bytes_read = get_cabac_terminate(c);        if(bytes_read ==0) printf("error at end of AC stream\n");//printf("pos=%d\n", bytes_read);        init_get_bits(&f->gb, buf + bytes_read, buf_size - bytes_read);    } else {        bytes_read = 0; /* avoid warning */    }        if(f->colorspace==0){        const int chroma_width = -((-width )>>f->chroma_h_shift);        const int chroma_height= -((-height)>>f->chroma_v_shift);        decode_plane(f, p->data[0], width, height, p->linesize[0], 0);                decode_plane(f, p->data[1], chroma_width, chroma_height, p->linesize[1], 1);        decode_plane(f, p->data[2], chroma_width, chroma_height, p->linesize[2], 1);    }else{        decode_rgb_frame(f, (uint32_t*)p->data[0], width, height, p->linesize[0]/4);    }            emms_c();    f->picture_number++;    *picture= *p;        avctx->release_buffer(avctx, p); //FIXME    *data_size = sizeof(AVFrame);        if(f->ac){        bytes_read= get_cabac_terminate(c);        if(bytes_read ==0) printf("error at end of frame\n");    }else{        bytes_read+= (get_bits_count(&f->gb)+7)/8;    }    return bytes_read;}