]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/au.c
lavfi: remove mp=il filter
[ffmpeg] / libavformat / au.c
index b3a793d7ff1a78b12562f36c1b02e4cbc457d933..db2ab275587d96da55ebaf76b8067c94e0eaa68a 100644 (file)
@@ -151,11 +151,21 @@ AVInputFormat ff_au_demuxer = {
 
 #include "rawenc.h"
 
-/* AUDIO_FILE header */
-static int put_au_header(AVIOContext *pb, AVCodecContext *enc)
+static int au_write_header(AVFormatContext *s)
 {
-    if (!enc->codec_tag)
+    AVIOContext *pb = s->pb;
+    AVCodecContext *enc = s->streams[0]->codec;
+
+    if (s->nb_streams != 1) {
+        av_log(s, AV_LOG_ERROR, "only one stream is supported\n");
+        return AVERROR(EINVAL);
+    }
+
+    enc->codec_tag = ff_codec_get_tag(codec_au_tags, enc->codec_id);
+    if (!enc->codec_tag) {
+        av_log(s, AV_LOG_ERROR, "unsupported codec\n");
         return AVERROR(EINVAL);
+    }
 
     ffio_wfourcc(pb, ".snd");                   /* magic number */
     avio_wb32(pb, AU_HEADER_SIZE);              /* header size */
@@ -164,18 +174,6 @@ static int put_au_header(AVIOContext *pb, AVCodecContext *enc)
     avio_wb32(pb, enc->sample_rate);
     avio_wb32(pb, enc->channels);
     avio_wb64(pb, 0); /* annotation field */
-
-    return 0;
-}
-
-static int au_write_header(AVFormatContext *s)
-{
-    AVIOContext *pb = s->pb;
-    int ret;
-
-    if ((ret = put_au_header(pb, s->streams[0]->codec)) < 0)
-        return ret;
-
     avio_flush(pb);
 
     return 0;