avformat/ffmenc: set bitexact mode for old API without accessing the encoder
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 1 Dec 2016 15:58:37 +0000 (16:58 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 2 Dec 2016 18:37:00 +0000 (19:37 +0100)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/ffmenc.c
tests/ref/lavf/ffm

index 221f0a2..7ed4320 100644 (file)
@@ -223,6 +223,7 @@ static int ffm_write_header(AVFormatContext *s)
 
     /* list of streams */
     for(i=0;i<s->nb_streams;i++) {
+        int flags = 0;
         st = s->streams[i];
         avpriv_set_pts_info(st, 64, 1, 1000000);
         if(avio_open_dyn_buf(&pb) < 0)
@@ -234,7 +235,16 @@ static int ffm_write_header(AVFormatContext *s)
         avio_wb32(pb, codecpar->codec_id);
         avio_w8(pb, codecpar->codec_type);
         avio_wb32(pb, codecpar->bit_rate);
-        avio_wb32(pb, codecpar->extradata_size ? AV_CODEC_FLAG_GLOBAL_HEADER : 0);
+        if (codecpar->extradata_size)
+            flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
+
+        // If the user is not providing us with a configuration we have to fill it in as we cannot access the encoder
+        if (!st->recommended_encoder_configuration) {
+            if (s->flags & AVFMT_FLAG_BITEXACT)
+                flags |= AV_CODEC_FLAG_BITEXACT;
+        }
+
+        avio_wb32(pb, flags);
         avio_wb32(pb, 0); // flags2
         avio_wb32(pb, 0); // debug
         if (codecpar->extradata_size) {
index 9d9d07f..7a51d9b 100644 (file)
@@ -1,3 +1,3 @@
-15a9929d1cb7129dcaffeccf3cb2fda9 *./tests/data/lavf/lavf.ffm
+03f2673a39a9494157eb4be9af537f84 *./tests/data/lavf/lavf.ffm
 376832 ./tests/data/lavf/lavf.ffm
 ./tests/data/lavf/lavf.ffm CRC=0x000e23ae