1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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.

Originally committed as revision 20125 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Reimar Döffinger 2009-10-01 15:54:55 +00:00
parent 43d7c6118d
commit 681c180dc4

View File

@ -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;