matroskaenc: make sure we don't produce invalid file with no codec ID
authorAurelien Jacobs <aurel@gnuage.org>
Thu, 24 Mar 2011 00:56:26 +0000 (01:56 +0100)
committerAurelien Jacobs <aurel@gnuage.org>
Thu, 24 Mar 2011 00:56:26 +0000 (01:56 +0100)
Signed-off-by: Aurelien Jacobs <aurel@gnuage.org>
libavformat/matroskaenc.c

index c86206b..df192a1 100644 (file)
@@ -630,6 +630,10 @@ static int mkv_write_tracks(AVFormatContext *s)
 
             case AVMEDIA_TYPE_SUBTITLE:
                 put_ebml_uint(pb, MATROSKA_ID_TRACKTYPE, MATROSKA_TRACK_TYPE_SUBTITLE);
+                if (!native_id) {
+                    av_log(s, AV_LOG_ERROR, "Subtitle codec %d is not supported.\n", codec->codec_id);
+                    return AVERROR_NOTSUPP;
+                }
                 break;
             default:
                 av_log(s, AV_LOG_ERROR, "Only audio, video, and subtitles are supported for Matroska.\n");