make AVCodec.init() optional

Originally committed as revision 8589 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Michael Niedermayer 18 years ago
parent fa1ab87200
commit 6e546aaa24
  1. 2
      libavcodec/utils.c

@ -829,12 +829,14 @@ int avcodec_open(AVCodecContext *avctx, AVCodec *codec)
avctx->codec = codec; avctx->codec = codec;
avctx->codec_id = codec->id; avctx->codec_id = codec->id;
avctx->frame_number = 0; avctx->frame_number = 0;
if(avctx->codec->init){
ret = avctx->codec->init(avctx); ret = avctx->codec->init(avctx);
if (ret < 0) { if (ret < 0) {
av_freep(&avctx->priv_data); av_freep(&avctx->priv_data);
avctx->codec= NULL; avctx->codec= NULL;
goto end; goto end;
} }
}
ret=0; ret=0;
end: end:
entangled_thread_counter--; entangled_thread_counter--;

Loading…
Cancel
Save