[SCM] libav/experimental: 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.

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:52:20 UTC 2013


The following commit has been merged in the experimental branch:
commit 681c180dc441bf9fea1bb363c75c5d443f11a53a
Author: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
Date:   Thu Oct 1 15:54:55 2009 +0000

    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

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 4ab0c35..c3df903 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -480,6 +480,11 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *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){
         av_log(avctx, AV_LOG_ERROR, "codec type or id mismatches\n");
         goto free_and_end;

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list