]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/vocenc.c
doc/libavcodec: apply misc minor typo fixes
[ffmpeg] / libavformat / vocenc.c
index d97cdc4c15d78d1838ec40ab354dc4a4926a8686..29e936349282150ba712e20fd966fe65aebad7ca 100644 (file)
@@ -30,6 +30,7 @@ typedef struct voc_enc_context {
 static int voc_write_header(AVFormatContext *s)
 {
     AVIOContext *pb = s->pb;
+    AVCodecContext *enc = s->streams[0]->codec;
     const int header_size = 26;
     const int version = 0x0114;
 
@@ -37,6 +38,11 @@ static int voc_write_header(AVFormatContext *s)
         || s->streams[0]->codec->codec_type != AVMEDIA_TYPE_AUDIO)
         return AVERROR_PATCHWELCOME;
 
+    if (!enc->codec_tag && enc->codec_id != AV_CODEC_ID_PCM_U8) {
+        av_log(s, AV_LOG_ERROR, "unsupported codec\n");
+        return AVERROR(EINVAL);
+    }
+
     avio_write(pb, ff_voc_magic, sizeof(ff_voc_magic) - 1);
     avio_wl16(pb, header_size);
     avio_wl16(pb, version);