---
 ffmpeg_opt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index c217462..84b312d 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -618,7 +618,7 @@ static AVCodec *find_codec_or_die(const char *name, enum 
AVMediaType type, int e
         av_log(NULL, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name);
         exit_program(1);
     }
-    if (codec->type != type) {
+    if (codec->type != type && type != AVMEDIA_TYPE_UNKNOWN) {
         av_log(NULL, AV_LOG_FATAL, "Invalid %s type '%s'\n", codec_string, 
name);
         exit_program(1);
     }
@@ -633,6 +633,7 @@ static AVCodec *choose_decoder(OptionsContext *o, 
AVFormatContext *s, AVStream *
     if (codec_name) {
         AVCodec *codec = find_codec_or_die(codec_name, st->codec->codec_type, 
0);
         st->codec->codec_id = codec->id;
+        st->codec->codec_type = codec->type;
         return codec;
     } else
         return avcodec_find_decoder(st->codec->codec_id);
-- 
2.8.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to