From cae4f4b77e7dc037ad5dfcc7bc636788f1420ba9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Thu, 3 Nov 2011 11:40:13 +0200
Subject: [PATCH] avcodec: Make sure codec_type is set by
 avcodec_get_context_defaults2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This function used to set codec_type. With the current fallback
implementation based on avcodec_get_context_defaults3, codec_type
won't be set to the value passed in, but will be set to
AVMEDIA_TYPE_UNKNOWN. Legacy callers of this function might expect
this field to be set to the value passed in.

Signed-off-by: Martin Storsjö <martin@martin.st>
---
 libavcodec/options.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/options.c b/libavcodec/options.c
index fdc8a71337a..a08ed98cce9 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -539,6 +539,7 @@ static const AVClass av_codec_context_class = {
 #if FF_API_ALLOC_CONTEXT
 void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_type){
     avcodec_get_context_defaults3(s, NULL);
+    s->codec_type = codec_type;
 }
 #endif
 
-- 
GitLab