From 671dd6a61ec3ad377fa8c0e15550714e93a5dc32 Mon Sep 17 00:00:00 2001 From: Doug Nazar Date: Wed, 7 Aug 2019 17:47:29 -0400 Subject: [PATCH] matroskamux: Always use v4 for DocType version Part-of: --- subprojects/gst-plugins-good/gst/matroska/ebml-write.c | 4 ++-- subprojects/gst-plugins-good/gst/matroska/ebml-write.h | 3 ++- subprojects/gst-plugins-good/gst/matroska/matroska-mux.c | 6 +++--- subprojects/gst-plugins-good/gst/matroska/matroska-mux.h | 2 +- .../gst-plugins-good/tests/check/elements/matroskamux.c | 4 ++-- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/matroska/ebml-write.c b/subprojects/gst-plugins-good/gst/matroska/ebml-write.c index cd3e271d7b..a394737919 100644 --- a/subprojects/gst-plugins-good/gst/matroska/ebml-write.c +++ b/subprojects/gst-plugins-good/gst/matroska/ebml-write.c @@ -911,7 +911,7 @@ gst_ebml_replace_uint (GstEbmlWrite * ebml, guint64 pos, guint64 num) */ void gst_ebml_write_header (GstEbmlWrite * ebml, const gchar * doctype, - guint version) + guint version, guint readversion) { guint64 pos; @@ -929,7 +929,7 @@ gst_ebml_write_header (GstEbmlWrite * ebml, const gchar * doctype, #endif gst_ebml_write_ascii (ebml, GST_EBML_ID_DOCTYPE, doctype); gst_ebml_write_uint (ebml, GST_EBML_ID_DOCTYPEVERSION, version); - gst_ebml_write_uint (ebml, GST_EBML_ID_DOCTYPEREADVERSION, version); + gst_ebml_write_uint (ebml, GST_EBML_ID_DOCTYPEREADVERSION, readversion); gst_ebml_write_master_finish (ebml, pos); gst_ebml_write_flush_cache (ebml, FALSE, 0); } diff --git a/subprojects/gst-plugins-good/gst/matroska/ebml-write.h b/subprojects/gst-plugins-good/gst/matroska/ebml-write.h index 15fa761e12..b614229492 100644 --- a/subprojects/gst-plugins-good/gst/matroska/ebml-write.h +++ b/subprojects/gst-plugins-good/gst/matroska/ebml-write.h @@ -130,7 +130,8 @@ void gst_ebml_write_binary (GstEbmlWrite *ebml, guint64 length); void gst_ebml_write_header (GstEbmlWrite *ebml, const gchar *doctype, - guint version); + guint version, + guint readversion); /* * Note: this is supposed to be used only for media data. diff --git a/subprojects/gst-plugins-good/gst/matroska/matroska-mux.c b/subprojects/gst-plugins-good/gst/matroska/matroska-mux.c index e2436d6c0c..f23192d100 100644 --- a/subprojects/gst-plugins-good/gst/matroska/matroska-mux.c +++ b/subprojects/gst-plugins-good/gst/matroska/matroska-mux.c @@ -3192,9 +3192,9 @@ gst_matroska_mux_start_file (GstMatroskaMux * mux) /* we start with a EBML header */ doctype = mux->doctype; - GST_INFO_OBJECT (ebml, "DocType: %s, Version: %d", - doctype, mux->doctype_version); - gst_ebml_write_header (ebml, doctype, mux->doctype_version); + GST_INFO_OBJECT (ebml, "DocType: %s, Version: 4/%d", doctype, + mux->doctype_version); + gst_ebml_write_header (ebml, doctype, 4, mux->doctype_version); /* the rest of the header is cached */ gst_ebml_write_set_cache (ebml, 0x1000); diff --git a/subprojects/gst-plugins-good/gst/matroska/matroska-mux.h b/subprojects/gst-plugins-good/gst/matroska/matroska-mux.h index c9a36f4f61..e9e590d80b 100644 --- a/subprojects/gst-plugins-good/gst/matroska/matroska-mux.h +++ b/subprojects/gst-plugins-good/gst/matroska/matroska-mux.h @@ -103,7 +103,7 @@ struct _GstMatroskaMux { /* EBML DocType. */ const gchar *doctype; - /* DocType version. */ + /* DocType read version. Minimal version of specification required to read file */ guint doctype_version; /* state */ diff --git a/subprojects/gst-plugins-good/tests/check/elements/matroskamux.c b/subprojects/gst-plugins-good/tests/check/elements/matroskamux.c index c24251a286..26382df9d6 100644 --- a/subprojects/gst-plugins-good/tests/check/elements/matroskamux.c +++ b/subprojects/gst-plugins-good/tests/check/elements/matroskamux.c @@ -97,7 +97,7 @@ GST_START_TEST (test_ebml_header_v1) 0x6d, 0x61, 0x74, 0x72, 0x6f, 0x73, 0x6b, 0x61, 0x00, /* "matroska" */ 0x42, 0x87, /* doctypeversion */ 0x81, /* 1 byte */ - 0x01, /* 1 */ + 0x04, /* 4 */ 0x42, 0x85, /* doctypereadversion */ 0x81, /* 1 byte */ 0x01, /* 1 */ @@ -118,7 +118,7 @@ GST_START_TEST (test_ebml_header_v2) 0x6d, 0x61, 0x74, 0x72, 0x6f, 0x73, 0x6b, 0x61, 0x00, /* "matroska" */ 0x42, 0x87, /* doctypeversion */ 0x81, /* 1 byte */ - 0x02, /* 2 */ + 0x04, /* 4 */ 0x42, 0x85, /* doctypereadversion */ 0x81, /* 1 byte */ 0x02, /* 2 */