comparison utils.c @ 10345:294c444866f7 libavcodec

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.
author reimar
date Thu, 01 Oct 2009 15:54:55 +0000
parents b81ec4ac8f96
children 98501365c3aa
comparison
equal deleted inserted replaced
10344:2b8a327189cd 10345:294c444866f7
478 ret = AVERROR(EINVAL); 478 ret = AVERROR(EINVAL);
479 goto free_and_end; 479 goto free_and_end;
480 } 480 }
481 481
482 avctx->codec = codec; 482 avctx->codec = codec;
483 if ((avctx->codec_type == CODEC_TYPE_UNKNOWN || avctx->codec_type == codec->type) &&
484 avctx->codec_id == CODEC_ID_NONE) {
485 avctx->codec_type = codec->type;
486 avctx->codec_id = codec->id;
487 }
483 if(avctx->codec_id != codec->id || avctx->codec_type != codec->type){ 488 if(avctx->codec_id != codec->id || avctx->codec_type != codec->type){
484 av_log(avctx, AV_LOG_ERROR, "codec type or id mismatches\n"); 489 av_log(avctx, AV_LOG_ERROR, "codec type or id mismatches\n");
485 goto free_and_end; 490 goto free_and_end;
486 } 491 }
487 avctx->frame_number = 0; 492 avctx->frame_number = 0;