if(buf_size < FF_MIN_BUFFER_SIZE){ av_log(avctx, AV_LOG_ERROR, "buffer smaller then minimum size\n"); return -1; } if(avcodec_check_dimensions(avctx,avctx->width,avctx->height)) return -1;
int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,                          const AVFrame *pict){    if((avctx->codec->capabilities & CODEC_CAP_DELAY) || pict){        int ret = avctx->codec->encode(avctx, buf, buf_size, (void *)pict);        avctx->frame_number++;        emms_c(); //needed to avoid a emms_c() call before every return;            return ret;    }else        return 0;}