[FFmpeg-cvslog] avformat/matroskaenc: add an option to disable writting CRC32 elements

James Almer git at videolan.org
Fri Oct 7 00:43:16 EEST 2016


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Thu Oct  6 18:17:04 2016 -0300| [711bfb33df4efa252a85d2d6987c435d0eef1a48] | committer: James Almer

avformat/matroskaenc: add an option to disable writting CRC32 elements

Also add missing Changelog entry.

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=711bfb33df4efa252a85d2d6987c435d0eef1a48
---

 Changelog                 | 1 +
 libavformat/matroskaenc.c | 8 +++++---
 libavformat/version.h     | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Changelog b/Changelog
index dc48882..0da009c 100644
--- a/Changelog
+++ b/Changelog
@@ -35,6 +35,7 @@ version <next>:
 - sdl1 output device and sdl1 support removed
 - extended mov edit list support
 - libfaac encoder removed
+- Matroska muxer now writes CRC32 elements by default in all Level 1 elements
 
 
 version 3.1:
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 5b6d3a6..0878cb5 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -134,6 +134,7 @@ typedef struct MatroskaMuxContext {
     int is_dash;
     int dash_track_number;
     int is_live;
+    int write_crc;
 
     uint32_t chapter_id_offset;
     int wrote_chapters;
@@ -334,7 +335,7 @@ static void end_ebml_master_crc32(AVIOContext *pb, AVIOContext **dyn_cp, Matrosk
 
     if (pb->seekable) {
         size = avio_close_dyn_buf(*dyn_cp, &buf);
-        if (mkv->mode != MODE_WEBM) {
+        if (mkv->write_crc && mkv->mode != MODE_WEBM) {
             AV_WL32(crc, av_crc(av_crc_get_table(AV_CRC_32_IEEE_LE), UINT32_MAX, buf, size) ^ UINT32_MAX);
             put_ebml_binary(pb, EBML_ID_CRC32, crc, sizeof(crc));
         }
@@ -1485,7 +1486,7 @@ static int mkv_write_tags(AVFormatContext *s)
 
     if (mkv->tags.pos) {
         if (s->pb->seekable && !mkv->is_live)
-            put_ebml_void(s->pb, avio_tell(mkv->tags_bc) + ((mkv->mode != MODE_WEBM) ? 2 /* ebml id + data size */ + 4 /* CRC32 */ : 0));
+            put_ebml_void(s->pb, avio_tell(mkv->tags_bc) + ((mkv->write_crc && mkv->mode != MODE_WEBM) ? 2 /* ebml id + data size */ + 4 /* CRC32 */ : 0));
         else
             end_ebml_master_crc32(s->pb, &mkv->tags_bc, mkv, mkv->tags);
     }
@@ -1729,7 +1730,7 @@ static int mkv_write_header(AVFormatContext *s)
         }
     }
     if (s->pb->seekable)
-        put_ebml_void(s->pb, avio_tell(pb) + ((mkv->mode != MODE_WEBM) ? 2 /* ebml id + data size */ + 4 /* CRC32 */ : 0));
+        put_ebml_void(s->pb, avio_tell(pb) + ((mkv->write_crc && mkv->mode != MODE_WEBM) ? 2 /* ebml id + data size */ + 4 /* CRC32 */ : 0));
     else
         end_ebml_master_crc32(s->pb, &mkv->info_bc, mkv, mkv->info);
     pb = s->pb;
@@ -2390,6 +2391,7 @@ static const AVOption options[] = {
     { "dash_track_number", "Track number for the DASH stream", OFFSET(dash_track_number), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 127, FLAGS },
     { "live", "Write files assuming it is a live stream.", OFFSET(is_live), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
     { "allow_raw_vfw", "allow RAW VFW mode", OFFSET(allow_raw_vfw), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
+    { "write_crc32", "write a CRC32 element inside every Level 1 element", OFFSET(write_crc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FLAGS },
     { NULL },
 };
 
diff --git a/libavformat/version.h b/libavformat/version.h
index 5e7448a..92801b4 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -33,7 +33,7 @@
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  57
 #define LIBAVFORMAT_VERSION_MINOR  51
-#define LIBAVFORMAT_VERSION_MICRO 102
+#define LIBAVFORMAT_VERSION_MICRO 103
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \



More information about the ffmpeg-cvslog mailing list