]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/flacenc_header.c
avcodec/mpegvideo: fix edge emulation with uvlinesize below 25
[ffmpeg] / libavformat / flacenc_header.c
index 4dd89b1903d1f21c961bc64eed7713f65e2d4975..61833cc8b957ce738f13d123c7cdbcb172ddcbb0 100644 (file)
 #include "libavutil/channel_layout.h"
 
 #include "libavcodec/flac.h"
-#include "libavcodec/bytestream.h"
+
 #include "avformat.h"
 #include "flacenc.h"
 
-int ff_flac_write_header(AVIOContext *pb, AVCodecContext *codec,
-                         int last_block)
+int ff_flac_write_header(AVIOContext *pb, uint8_t *extradata,
+                         int extradata_size, int last_block)
 {
     uint8_t header[8] = {
         0x66, 0x4C, 0x61, 0x43, 0x00, 0x00, 0x00, 0x22
     };
-    uint8_t *streaminfo;
-    enum FLACExtradataFormat format;
 
     header[4] = last_block ? 0x80 : 0x00;
-    if (!avpriv_flac_is_extradata_valid(codec, &format, &streaminfo))
-        return -1;
+
+    if (extradata_size < FLAC_STREAMINFO_SIZE)
+        return AVERROR_INVALIDDATA;
 
     /* write "fLaC" stream marker and first metadata block header */
     avio_write(pb, header, 8);
 
     /* write STREAMINFO */
-    avio_write(pb, streaminfo, FLAC_STREAMINFO_SIZE);
+    avio_write(pb, extradata, FLAC_STREAMINFO_SIZE);
 
     return 0;
 }