Commit c8d61bce authored by reimar's avatar reimar

Make avcodec_open set codec_id and codec_type if they haven't been set.

This fixes the API breakage introduced by the check that avctx codec id and type
match the opened codec and should make (almost?) all applications work again.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@20125 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 7cd03486
...@@ -480,6 +480,11 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) ...@@ -480,6 +480,11 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
} }
avctx->codec = codec; avctx->codec = codec;
if ((avctx->codec_type == CODEC_TYPE_UNKNOWN || avctx->codec_type == codec->type) &&
avctx->codec_id == CODEC_ID_NONE) {
avctx->codec_type = codec->type;
avctx->codec_id = codec->id;
}
if(avctx->codec_id != codec->id || avctx->codec_type != codec->type){ if(avctx->codec_id != codec->id || avctx->codec_type != codec->type){
av_log(avctx, AV_LOG_ERROR, "codec type or id mismatches\n"); av_log(avctx, AV_LOG_ERROR, "codec type or id mismatches\n");
goto free_and_end; goto free_and_end;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment