# HG changeset patch # User reimar # Date 1254412495 0 # Node ID 294c444866f76b62ff1d74e85482f8595021fa59 # Parent 2b8a327189cde7536690f89ee320123492f317e4 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. diff -r 2b8a327189cd -r 294c444866f7 utils.c --- a/utils.c Thu Oct 01 15:40:29 2009 +0000 +++ b/utils.c Thu Oct 01 15:54:55 2009 +0000 @@ -480,6 +480,11 @@ } 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){ av_log(avctx, AV_LOG_ERROR, "codec type or id mismatches\n"); goto free_and_end;