[FFmpeg-cvslog] r20125 - trunk/libavcodec/utils.c

reimar subversion
Thu Oct 1 17:54:55 CEST 2009


Author: reimar
Date: Thu Oct  1 17:54:55 2009
New Revision: 20125

Log:
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.

Modified:
   trunk/libavcodec/utils.c

Modified: trunk/libavcodec/utils.c
==============================================================================
--- trunk/libavcodec/utils.c	Thu Oct  1 17:40:29 2009	(r20124)
+++ trunk/libavcodec/utils.c	Thu Oct  1 17:54:55 2009	(r20125)
@@ -480,6 +480,11 @@ int attribute_align_arg avcodec_open(AVC
     }
 
     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;



More information about the ffmpeg-cvslog mailing list