Mercurial > libavcodec.hg
comparison utils.c @ 4523:6af87c369a8e libavcodec
doxy for avcodec_encode_video()
author | michael |
---|---|
date | Wed, 14 Feb 2007 10:50:01 +0000 |
parents | 18a88f830d1a |
children | 30b8672a2357 |
comparison
equal
deleted
inserted
replaced
4522:895b076101a8 | 4523:6af87c369a8e |
---|---|
858 return ret; | 858 return ret; |
859 }else | 859 }else |
860 return 0; | 860 return 0; |
861 } | 861 } |
862 | 862 |
863 /** | |
864 * encode a frame. | |
865 * @param buf buffer for the bitstream of encoded frame | |
866 * @param buf_size the size of the buffer in bytes | |
867 * @param pict the input picture to encode, in avctx.pix_fmt | |
868 * @return -1 if error | |
869 */ | |
863 int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, | 870 int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, |
864 const AVFrame *pict) | 871 const AVFrame *pict) |
865 { | 872 { |
866 if(buf_size < FF_MIN_BUFFER_SIZE){ | 873 if(buf_size < FF_MIN_BUFFER_SIZE){ |
867 av_log(avctx, AV_LOG_ERROR, "buffer smaller then minimum size\n"); | 874 av_log(avctx, AV_LOG_ERROR, "buffer smaller then minimum size\n"); |
936 return -1; | 943 return -1; |
937 } | 944 } |
938 if(*frame_size_ptr < FF_MIN_BUFFER_SIZE || | 945 if(*frame_size_ptr < FF_MIN_BUFFER_SIZE || |
939 *frame_size_ptr < avctx->channels * avctx->frame_size * sizeof(int16_t) || | 946 *frame_size_ptr < avctx->channels * avctx->frame_size * sizeof(int16_t) || |
940 *frame_size_ptr < buf_size){ | 947 *frame_size_ptr < buf_size){ |
941 av_log(avctx, AV_LOG_ERROR, "buffer too small\n"); | 948 av_log(avctx, AV_LOG_ERROR, "buffer %d too small\n", *frame_size_ptr); |
942 return -1; | 949 return -1; |
943 } | 950 } |
944 if((avctx->codec->capabilities & CODEC_CAP_DELAY) || buf_size){ | 951 if((avctx->codec->capabilities & CODEC_CAP_DELAY) || buf_size){ |
945 ret = avctx->codec->decode(avctx, samples, frame_size_ptr, | 952 ret = avctx->codec->decode(avctx, samples, frame_size_ptr, |
946 buf, buf_size); | 953 buf, buf_size); |