Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/5] avformat/matroskaenc: Support rotations
@ 2023-08-06 23:04 Andreas Rheinhardt
  2023-08-06 23:06 ` [FFmpeg-devel] [PATCH 2/5] avformat/matroskaenc: Don't reserve unnecessarily many EBML elements Andreas Rheinhardt
                   ` (14 more replies)
  0 siblings, 15 replies; 17+ messages in thread
From: Andreas Rheinhardt @ 2023-08-06 23:04 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Matroska supports orthogonal transformations (both pure rotations
as well as reflections) via its 3D-projection elements, namely
ProjectionPoseYaw (for a horizontal reflection) as well as
ProjectionPoseRoll (for rotations). This commit adds support
for this.

Support for this in the demuxer has been added in
937bb6bbc1e8654633737e69e403e95a37113058 and
the sample used in the matroska-dovi-write-config8 FATE-test
includes a displaymatrix indicating a rotation which is now
properly written and read, thereby providing coverage for
the relevant code in the muxer as well as the demuxer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
Honestly, I am not really sure how to handle the floating-point
inaccuracies here (in atan2).

 libavformat/matroskaenc.c                  | 100 +++++++++++++++++----
 tests/ref/fate/matroska-dovi-write-config8 |  13 ++-
 2 files changed, 94 insertions(+), 19 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 41e13b273d..c1f40b26e6 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1403,25 +1403,75 @@ static void mkv_write_video_color(EbmlWriter *writer, const AVStream *st,
 }
 
 #define MAX_VIDEO_PROJECTION_ELEMS 6
-static void mkv_write_video_projection(AVFormatContext *s, EbmlWriter *writer,
-                                       const AVStream *st, uint8_t private[])
+static void mkv_handle_rotation(void *logctx, const AVStream *st,
+                                double *yaw, double *roll)
+{
+    const int32_t *matrix =
+        (const int32_t*)av_stream_get_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, NULL);
+
+    if (!matrix)
+        return;
+
+    /* Check whether this is an affine transformation */
+    if (matrix[2] || matrix[5])
+        goto ignore;
+
+    /* This together with the checks below test whether
+     * the upper-left 2x2 matrix is nonsingular. */
+    if (!matrix[0] && !matrix[1])
+        goto ignore;
+
+    /* We ignore the translation part of the matrix (matrix[6] and matrix[7])
+     * as well as any scaling, i.e. we only look at the upper left 2x2 matrix.
+     * We only accept matrices that are an exact multiple of an orthogonal one.
+     * Apart from the multiple, every such matrix can be obtained by
+     * potentially flipping in the x-direction (corresponding to yaw = 180)
+     * followed by a rotation of (say) an angle phi in the counterclockwise
+     * direction. The upper-left 2x2 matrix then looks like this:
+     *         | (+/-)cos(phi) (-/+)sin(phi) |
+     * scale * |                             |
+     *         |      sin(phi)      cos(phi) |
+     * The first set of signs in the first row apply in case of no flipping,
+     * the second set applies in case of flipping. */
+
+    /* The casts to int64_t are needed because -INT32_MIN doesn't fit
+     * in an int32_t. */
+    if (matrix[0] == matrix[4] && -(int64_t)matrix[1] == matrix[3]) {
+        /* No flipping case */
+        *yaw = 0;
+    } else if (-(int64_t)matrix[0] == matrix[4] && matrix[1] == matrix[3]) {
+        /* Horizontal flip */
+        *yaw = 180;
+    } else {
+ignore:
+        av_log(logctx, AV_LOG_INFO, "Ignoring display matrix indicating "
+               "non-orthogonal transformation.\n");
+        return;
+    }
+    *roll = 180 / M_PI * atan2(matrix[3], matrix[4]);
+
+    /* We do not write a ProjectionType element indicating "rectangular",
+     * because this is the default value. */
+}
+
+static int mkv_handle_spherical(void *logctx, EbmlWriter *writer,
+                                const AVStream *st, uint8_t private[],
+                                double *yaw, double *pitch, double *roll)
 {
     const AVSphericalMapping *spherical =
         (const AVSphericalMapping *)av_stream_get_side_data(st, AV_PKT_DATA_SPHERICAL,
                                                             NULL);
 
     if (!spherical)
-        return;
+        return 0;
 
     if (spherical->projection != AV_SPHERICAL_EQUIRECTANGULAR      &&
         spherical->projection != AV_SPHERICAL_EQUIRECTANGULAR_TILE &&
         spherical->projection != AV_SPHERICAL_CUBEMAP) {
-        av_log(s, AV_LOG_WARNING, "Unknown projection type\n");
-        return;
+        av_log(logctx, AV_LOG_WARNING, "Unknown projection type\n");
+        return 0;
     }
 
-    ebml_writer_open_master(writer, MATROSKA_ID_VIDEOPROJECTION);
-
     switch (spherical->projection) {
     case AV_SPHERICAL_EQUIRECTANGULAR:
     case AV_SPHERICAL_EQUIRECTANGULAR_TILE:
@@ -1455,17 +1505,33 @@ static void mkv_write_video_projection(AVFormatContext *s, EbmlWriter *writer,
         av_assert0(0);
     }
 
-    if (spherical->yaw)
-        ebml_writer_add_float(writer, MATROSKA_ID_VIDEOPROJECTIONPOSEYAW,
-                              (double) spherical->yaw   / (1 << 16));
-    if (spherical->pitch)
-        ebml_writer_add_float(writer, MATROSKA_ID_VIDEOPROJECTIONPOSEPITCH,
-                       (double) spherical->pitch / (1 << 16));
-    if (spherical->roll)
-        ebml_writer_add_float(writer, MATROSKA_ID_VIDEOPROJECTIONPOSEROLL,
-                       (double) spherical->roll  / (1 << 16));
+    *yaw   = (double) spherical->yaw   / (1 << 16);
+    *pitch = (double) spherical->pitch / (1 << 16);
+    *roll  = (double) spherical->roll  / (1 << 16);
 
-    ebml_writer_close_master(writer);
+    return 1; /* Projection included */
+}
+
+static void mkv_write_video_projection(void *logctx, EbmlWriter *wr,
+                                       const AVStream *st, uint8_t private[])
+{
+    double yaw = 0, pitch = 0, roll = 0;
+    int ret;
+
+    ebml_writer_open_master(wr, MATROSKA_ID_VIDEOPROJECTION);
+
+    ret = mkv_handle_spherical(logctx, wr, st, private, &yaw, &pitch, &roll);
+    if (!ret)
+        mkv_handle_rotation(logctx, st, &yaw, &roll);
+
+    if (yaw)
+        ebml_writer_add_float(wr, MATROSKA_ID_VIDEOPROJECTIONPOSEYAW, yaw);
+    if (pitch)
+        ebml_writer_add_float(wr, MATROSKA_ID_VIDEOPROJECTIONPOSEPITCH, pitch);
+    if (roll)
+        ebml_writer_add_float(wr, MATROSKA_ID_VIDEOPROJECTIONPOSEROLL, roll);
+
+    ebml_writer_close_or_discard_master(wr);
 }
 
 #define MAX_FIELD_ORDER_ELEMS 2
diff --git a/tests/ref/fate/matroska-dovi-write-config8 b/tests/ref/fate/matroska-dovi-write-config8
index bb22563eee..58eb454865 100644
--- a/tests/ref/fate/matroska-dovi-write-config8
+++ b/tests/ref/fate/matroska-dovi-write-config8
@@ -1,5 +1,5 @@
-09ff3c0a038eec0cdf4773929b24f41a *tests/data/fate/matroska-dovi-write-config8.matroska
-3600606 tests/data/fate/matroska-dovi-write-config8.matroska
+80d2b23a6f27ab28b02a907b37b9649c *tests/data/fate/matroska-dovi-write-config8.matroska
+3600620 tests/data/fate/matroska-dovi-write-config8.matroska
 #extradata 0:      551, 0xa18acf66
 #extradata 1:        2, 0x00340022
 #tb 0: 1/1000
@@ -46,6 +46,15 @@
 1,        395,        395,       23,      439, 0x7d85e4c9
 [STREAM]
 [SIDE_DATA]
+side_data_type=Display Matrix
+displaymatrix=
+00000000:            0       65536           0
+00000001:       -65536           0           0
+00000002:            0           0  1073741824
+
+rotation=-90
+[/SIDE_DATA]
+[SIDE_DATA]
 side_data_type=DOVI configuration record
 dv_version_major=1
 dv_version_minor=0
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [FFmpeg-devel] [PATCH 2/5] avformat/matroskaenc: Don't reserve unnecessarily many EBML elements
  2023-08-06 23:04 [FFmpeg-devel] [PATCH 1/5] avformat/matroskaenc: Support rotations Andreas Rheinhardt
@ 2023-08-06 23:06 ` Andreas Rheinhardt
  2023-08-06 23:06 ` [FFmpeg-devel] [PATCH 3/5] fate/matroska: Add ALAC remux test Andreas Rheinhardt
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Andreas Rheinhardt @ 2023-08-06 23:06 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

bda44f0f39e8ee646e54f15989d7845f4bf58d26 added code that
potentially added another BlockMore master and BlockAdditional
data as well as BlockAddID number, yet it bumped the number
of EBML elements by four instead of only three.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/matroskaenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index c1f40b26e6..7eb734f1a9 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2709,8 +2709,8 @@ static int mkv_write_block(void *logctx, MatroskaMuxContext *mkv,
     size_t side_data_size;
     uint64_t additional_id;
     unsigned track_number = track->track_num;
+    EBML_WRITER(12);
     int ret;
-    EBML_WRITER(13);
 
     mkv->cur_block.track  = track;
     mkv->cur_block.pkt    = pkt;
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [FFmpeg-devel] [PATCH 3/5] fate/matroska: Add ALAC remux test
  2023-08-06 23:04 [FFmpeg-devel] [PATCH 1/5] avformat/matroskaenc: Support rotations Andreas Rheinhardt
  2023-08-06 23:06 ` [FFmpeg-devel] [PATCH 2/5] avformat/matroskaenc: Don't reserve unnecessarily many EBML elements Andreas Rheinhardt
@ 2023-08-06 23:06 ` Andreas Rheinhardt
  2023-08-06 23:06 ` [FFmpeg-devel] [PATCH 4/5] avformat/matroskaenc: Don't pretend to support unsupported codecs Andreas Rheinhardt
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Andreas Rheinhardt @ 2023-08-06 23:06 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Provides coverage for the code transforming the ALAC extradata.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 tests/fate/matroska.mak            |   4 +
 tests/ref/fate/matroska-alac-remux | 136 +++++++++++++++++++++++++++++
 2 files changed, 140 insertions(+)
 create mode 100644 tests/ref/fate/matroska-alac-remux

diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
index 7c4eed358f..ffbfa7de64 100644
--- a/tests/fate/matroska.mak
+++ b/tests/fate/matroska.mak
@@ -31,6 +31,10 @@ fate-matroska-zlib-decompression: CMD = framecrc -i $(TARGET_SAMPLES)/mkv/subtit
 FATE_MATROSKA-$(CONFIG_MATROSKA_DEMUXER) += fate-matroska-lzo-decompression
 fate-matroska-lzo-decompression: CMD = framecrc -i $(TARGET_SAMPLES)/mkv/lzo.mka -c copy
 
+# This tests that the ALAC extradata is correctly transformed upon remuxing.
+FATE_MATROSKA-$(call REMUX, MATROSKA) += fate-matroska-alac-remux
+fate-matroska-alac-remux: CMD = transcode mov $(TARGET_SAMPLES)/lossless-audio/inside.m4a matroska "-map 0:a -c copy" "-c copy"
+
 # This tests that the matroska demuxer correctly propagates
 # the channel layout contained in vorbis comments in the CodecPrivate
 # of flac tracks. It also tests header removal compression.
diff --git a/tests/ref/fate/matroska-alac-remux b/tests/ref/fate/matroska-alac-remux
new file mode 100644
index 0000000000..7f2698eee8
--- /dev/null
+++ b/tests/ref/fate/matroska-alac-remux
@@ -0,0 +1,136 @@
+d9b986b34e36e865912fd42d2c5b0cab *tests/data/fate/matroska-alac-remux.matroska
+1293821 tests/data/fate/matroska-alac-remux.matroska
+#extradata 0:       36, 0x562b05d8
+#tb 0: 1/1000
+#media_type 0: audio
+#codec_id 0: alac
+#sample_rate 0: 44100
+#channel_layout_name 0: stereo
+0,          0,          0,        0,       32, 0xa0af0dfe
+0,         93,         93,        0,     6701, 0xa9ddc14e
+0,        186,        186,        0,     6639, 0x3ccda8d6
+0,        279,        279,        0,     5722, 0x99a8cdbb
+0,        372,        372,        0,     5442, 0xe94d8bd8
+0,        464,        464,        0,     5211, 0x19d23acb
+0,        557,        557,        0,     4843, 0x5c013b9c
+0,        650,        650,        0,     8351, 0x0df50d26
+0,        743,        743,        0,     5981, 0x1211487e
+0,        836,        836,        0,     5747, 0xec5219c6
+0,        929,        929,        0,     4956, 0x75b07b7a
+0,       1022,       1022,        0,     4856, 0xbd314cc0
+0,       1115,       1115,        0,     4805, 0x8a27192d
+0,       1207,       1207,        0,     7834, 0xafb5d3e8
+0,       1300,       1300,        0,     5535, 0x04f3a427
+0,       1393,       1393,        0,     5389, 0xc6cc2676
+0,       1486,       1486,        0,     6363, 0xad5a3d0f
+0,       1579,       1579,        0,     4526, 0x774aa96a
+0,       1672,       1672,        0,     4514, 0xbf5fc96d
+0,       1765,       1765,        0,     8487, 0x8b737a66
+0,       1858,       1858,        0,     8489, 0x1e913827
+0,       1950,       1950,        0,     7711, 0x97aa8e9b
+0,       2043,       2043,        0,     7686, 0x86038f56
+0,       2136,       2136,        0,     6116, 0x7fc6cd9e
+0,       2229,       2229,        0,     6022, 0xfb21af45
+0,       2322,       2322,        0,     9569, 0xc9804ce4
+0,       2415,       2415,        0,    10587, 0xce263cfd
+0,       2508,       2508,        0,    10659, 0x90ce6886
+0,       2601,       2601,        0,    10446, 0x07054263
+0,       2694,       2694,        0,    10031, 0x566c25a6
+0,       2786,       2786,        0,    10566, 0xfee0240c
+0,       2879,       2879,        0,    11322, 0x12aab358
+0,       2972,       2972,        0,    11834, 0x34c4841a
+0,       3065,       3065,        0,    11508, 0x49acb752
+0,       3158,       3158,        0,    11450, 0xddc7e5bd
+0,       3251,       3251,        0,    11540, 0x80c52fd9
+0,       3344,       3344,        0,    11538, 0xf858f2b8
+0,       3437,       3437,        0,    10981, 0x6b00eed1
+0,       3529,       3529,        0,    11963, 0xe163c9a2
+0,       3622,       3622,        0,    11329, 0x5312d147
+0,       3715,       3715,        0,    10858, 0x8b00c6ee
+0,       3808,       3808,        0,    11911, 0xebfca9ce
+0,       3901,       3901,        0,    11470, 0xf2e40d02
+0,       3994,       3994,        0,    11770, 0x9eb8b578
+0,       4087,       4087,        0,    11920, 0xd52de5cc
+0,       4180,       4180,        0,    11335, 0x1b18b87a
+0,       4272,       4272,        0,    10939, 0x6116ef53
+0,       4365,       4365,        0,    12400, 0xbbcecb8b
+0,       4458,       4458,        0,    11652, 0x82531ac1
+0,       4551,       4551,        0,    11033, 0x09e607c9
+0,       4644,       4644,        0,    10283, 0xfe50b7a9
+0,       4737,       4737,        0,    10104, 0x5a5933e0
+0,       4830,       4830,        0,     9500, 0x69f4256b
+0,       4923,       4923,        0,     9613, 0x00175893
+0,       5016,       5016,        0,     9896, 0xf76adae7
+0,       5108,       5108,        0,     9534, 0x383e2e5b
+0,       5201,       5201,        0,    12217, 0xa39f5168
+0,       5294,       5294,        0,    11105, 0xd30d3c9f
+0,       5387,       5387,        0,    11015, 0x59acdbba
+0,       5480,       5480,        0,    12211, 0xca5d6b4c
+0,       5573,       5573,        0,    11542, 0x479a08fa
+0,       5666,       5666,        0,    10163, 0x8c1c4aa9
+0,       5759,       5759,        0,    11849, 0xaa499f9d
+0,       5851,       5851,        0,    11418, 0x43e0e764
+0,       5944,       5944,        0,    10142, 0x61793ad4
+0,       6037,       6037,        0,    12080, 0x076c025d
+0,       6130,       6130,        0,    11550, 0xc6a9ec36
+0,       6223,       6223,        0,    10951, 0xe77cde41
+0,       6316,       6316,        0,    12367, 0xf2068f79
+0,       6409,       6409,        0,    11328, 0x894c7cd9
+0,       6502,       6502,        0,    10253, 0x7d038e2a
+0,       6594,       6594,        0,    12366, 0x8c789e8c
+0,       6687,       6687,        0,    11727, 0xdb10700c
+0,       6780,       6780,        0,    11118, 0x803e44ab
+0,       6873,       6873,        0,    10722, 0xec1b73da
+0,       6966,       6966,        0,    10471, 0x9d37fd29
+0,       7059,       7059,        0,    10402, 0xa3a1d01f
+0,       7152,       7152,        0,    10223, 0xeb1f72d3
+0,       7245,       7245,        0,    10302, 0x84b89df9
+0,       7338,       7338,        0,    10258, 0x1cbdac7b
+0,       7430,       7430,        0,    11669, 0xdab41e2e
+0,       7523,       7523,        0,    11404, 0x2c3aca64
+0,       7616,       7616,        0,    11256, 0xe08a91d9
+0,       7709,       7709,        0,    11408, 0x6b0ec296
+0,       7802,       7802,        0,    10776, 0x8dc36d7b
+0,       7895,       7895,        0,    11463, 0x4251f294
+0,       7988,       7988,        0,    11510, 0x6e4afda3
+0,       8081,       8081,        0,    11895, 0x699bbbbc
+0,       8173,       8173,        0,    11170, 0xabe65a6d
+0,       8266,       8266,        0,    11229, 0x90096c81
+0,       8359,       8359,        0,    11224, 0x05f170d8
+0,       8452,       8452,        0,    10850, 0xd886c267
+0,       8545,       8545,        0,    11713, 0x20b93e75
+0,       8638,       8638,        0,    11407, 0x435ccc58
+0,       8731,       8731,        0,    11180, 0x70dd503b
+0,       8824,       8824,        0,    11624, 0xb5df34b3
+0,       8916,       8916,        0,    12366, 0x9ddac5b3
+0,       9009,       9009,        0,    11480, 0xd75daf70
+0,       9102,       9102,        0,    11065, 0xc3b60d28
+0,       9195,       9195,        0,    10119, 0x91b7526d
+0,       9288,       9288,        0,     9941, 0xfae5c951
+0,       9381,       9381,        0,     9672, 0x38c250bb
+0,       9474,       9474,        0,     9240, 0x983fb45f
+0,       9567,       9567,        0,     9851, 0xff73b7a3
+0,       9660,       9660,        0,    10460, 0xc4b5f639
+0,       9752,       9752,        0,    11840, 0x0369a045
+0,       9845,       9845,        0,    11213, 0x7e358a78
+0,       9938,       9938,        0,    11099, 0x177e0c20
+0,      10031,      10031,        0,    11615, 0x5f9b41db
+0,      10124,      10124,        0,    11617, 0x35184b25
+0,      10217,      10217,        0,    10117, 0xb5e4857d
+0,      10310,      10310,        0,    11711, 0xf7da3053
+0,      10403,      10403,        0,    11669, 0x05eb475f
+0,      10495,      10495,        0,    11255, 0xe7c3587b
+0,      10588,      10588,        0,    12237, 0x1576764f
+0,      10681,      10681,        0,    11399, 0x9eaea010
+0,      10774,      10774,        0,    10927, 0x9128ed6a
+0,      10867,      10867,        0,    11920, 0x4da7b6e1
+0,      10960,      10960,        0,    11288, 0x8bdf7955
+0,      11053,      11053,        0,    10375, 0x7fc19e5e
+0,      11146,      11146,        0,    12142, 0xb64329cc
+0,      11238,      11238,        0,    11282, 0xaf38984a
+0,      11331,      11331,        0,    10259, 0x2984a344
+0,      11424,      11424,        0,    11569, 0x88a62c58
+0,      11517,      11517,        0,    11688, 0xfe3c4f2b
+0,      11610,      11610,        0,    11428, 0xc776073b
+0,      11703,      11703,        0,    10987, 0x2281046f
+0,      11796,      11796,        0,    11028, 0xfe3426c4
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [FFmpeg-devel] [PATCH 4/5] avformat/matroskaenc: Don't pretend to support unsupported codecs
  2023-08-06 23:04 [FFmpeg-devel] [PATCH 1/5] avformat/matroskaenc: Support rotations Andreas Rheinhardt
  2023-08-06 23:06 ` [FFmpeg-devel] [PATCH 2/5] avformat/matroskaenc: Don't reserve unnecessarily many EBML elements Andreas Rheinhardt
  2023-08-06 23:06 ` [FFmpeg-devel] [PATCH 3/5] fate/matroska: Add ALAC remux test Andreas Rheinhardt
@ 2023-08-06 23:06 ` Andreas Rheinhardt
  2023-08-06 23:06 ` [FFmpeg-devel] [PATCH 5/5] avformat/matroskaenc: Don't pretend to be able to mux RV30 Andreas Rheinhardt
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Andreas Rheinhardt @ 2023-08-06 23:06 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

RV10 and RV20 are unsupported because creating the correct CodecPrivate
is unsupported (the demuxer uses a codecpriv_offset of 26, so one
would need to recreate the missing 26 bytes); COOK and SIPR are
unsupported, because Matroska uses a packetization mode that is
different from what FFmpeg uses in its packets (see
matroska_parse_rm_audio() in the demuxer).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/matroskaenc.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 7eb734f1a9..a9b7f89f38 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -3426,15 +3426,11 @@ static const AVCodecTag additional_audio_tags[] = {
     { AV_CODEC_ID_QDMC,      0xFFFFFFFF },
     { AV_CODEC_ID_QDM2,      0xFFFFFFFF },
     { AV_CODEC_ID_RA_144,    0xFFFFFFFF },
-    { AV_CODEC_ID_RA_288,    0xFFFFFFFF },
-    { AV_CODEC_ID_COOK,      0xFFFFFFFF },
     { AV_CODEC_ID_TRUEHD,    0xFFFFFFFF },
     { AV_CODEC_ID_NONE,      0xFFFFFFFF }
 };
 
 static const AVCodecTag additional_video_tags[] = {
-    { AV_CODEC_ID_RV10,      0xFFFFFFFF },
-    { AV_CODEC_ID_RV20,      0xFFFFFFFF },
     { AV_CODEC_ID_RV30,      0xFFFFFFFF },
     { AV_CODEC_ID_NONE,      0xFFFFFFFF }
 };
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [FFmpeg-devel] [PATCH 5/5] avformat/matroskaenc: Don't pretend to be able to mux RV30
  2023-08-06 23:04 [FFmpeg-devel] [PATCH 1/5] avformat/matroskaenc: Support rotations Andreas Rheinhardt
                   ` (2 preceding siblings ...)
  2023-08-06 23:06 ` [FFmpeg-devel] [PATCH 4/5] avformat/matroskaenc: Don't pretend to support unsupported codecs Andreas Rheinhardt
@ 2023-08-06 23:06 ` Andreas Rheinhardt
  2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 06/15] avformat/matroskaenc: Hoist check out of loop Andreas Rheinhardt
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Andreas Rheinhardt @ 2023-08-06 23:06 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

The demuxer uses a extradata offset of 26, so we would need
to recreate the missing 26 bytes somehow in the muxer, but
we just don't. Remuxed files (like real/rv30.rm from the FATE-suite)
don't work due to missing extradata.

(The extradata offset also applies to RV40 and the extradata
is indeed lost upon remuxing, yet remuxing real/spygames-2MB.rmvb
works; our RV40 decoder does not use extradata at all.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/matroskaenc.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index a9b7f89f38..be70e7a6f1 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -3300,7 +3300,8 @@ static int mkv_init(struct AVFormatContext *s)
             s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RA_288 ||
             s->streams[i]->codecpar->codec_id == AV_CODEC_ID_SIPR ||
             s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RV10 ||
-            s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RV20) {
+            s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RV20 ||
+            s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RV30) {
             av_log(s, AV_LOG_ERROR,
                    "The Matroska muxer does not yet support muxing %s\n",
                    avcodec_get_name(s->streams[i]->codecpar->codec_id));
@@ -3430,11 +3431,6 @@ static const AVCodecTag additional_audio_tags[] = {
     { AV_CODEC_ID_NONE,      0xFFFFFFFF }
 };
 
-static const AVCodecTag additional_video_tags[] = {
-    { AV_CODEC_ID_RV30,      0xFFFFFFFF },
-    { AV_CODEC_ID_NONE,      0xFFFFFFFF }
-};
-
 static const AVCodecTag additional_subtitle_tags[] = {
     { AV_CODEC_ID_DVB_SUBTITLE,      0xFFFFFFFF },
     { AV_CODEC_ID_DVD_SUBTITLE,      0xFFFFFFFF },
@@ -3506,7 +3502,7 @@ const FFOutputFormat ff_matroska_muxer = {
                          AVFMT_TS_NONSTRICT | AVFMT_ALLOW_FLUSH,
     .p.codec_tag       = (const AVCodecTag* const []){
          ff_codec_bmp_tags, ff_codec_wav_tags,
-         additional_audio_tags, additional_video_tags, additional_subtitle_tags, 0
+         additional_audio_tags, additional_subtitle_tags, 0
     },
     .p.subtitle_codec  = AV_CODEC_ID_ASS,
     .query_codec       = mkv_query_codec,
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [FFmpeg-devel] [PATCH 06/15] avformat/matroskaenc: Hoist check out of loop
  2023-08-06 23:04 [FFmpeg-devel] [PATCH 1/5] avformat/matroskaenc: Support rotations Andreas Rheinhardt
                   ` (3 preceding siblings ...)
  2023-08-06 23:06 ` [FFmpeg-devel] [PATCH 5/5] avformat/matroskaenc: Don't pretend to be able to mux RV30 Andreas Rheinhardt
@ 2023-08-08 16:40 ` Andreas Rheinhardt
  2023-08-10  7:48   ` Andreas Rheinhardt
  2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 07/15] avformat/matroskaenc: Remove unnecessary check Andreas Rheinhardt
                   ` (9 subsequent siblings)
  14 siblings, 1 reply; 17+ messages in thread
From: Andreas Rheinhardt @ 2023-08-08 16:40 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/matroskaenc.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index be70e7a6f1..d9bc31daee 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1877,9 +1877,13 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
 
         // look for a codec ID string specific to mkv to use,
         // if none are found, use AVI codes
-        if (par->codec_id != AV_CODEC_ID_RAWVIDEO || par->codec_tag) {
+        if (par->codec_id == AV_CODEC_ID_FFV1) {
+            /* FFV1 is actually supported natively in Matroska,
+             * yet we use the VfW way to mux it for compatibility
+             * with old demuxers. (FIXME: Are they really important?) */
+        } else if (par->codec_id != AV_CODEC_ID_RAWVIDEO || par->codec_tag) {
             for (j = 0; ff_mkv_codec_tags[j].id != AV_CODEC_ID_NONE; j++) {
-                if (ff_mkv_codec_tags[j].id == par->codec_id && par->codec_id != AV_CODEC_ID_FFV1) {
+                if (ff_mkv_codec_tags[j].id == par->codec_id) {
                     put_ebml_string(pb, MATROSKA_ID_CODECID, ff_mkv_codec_tags[j].str);
                     native_id = 1;
                     break;
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [FFmpeg-devel] [PATCH 07/15] avformat/matroskaenc: Remove unnecessary check
  2023-08-06 23:04 [FFmpeg-devel] [PATCH 1/5] avformat/matroskaenc: Support rotations Andreas Rheinhardt
                   ` (4 preceding siblings ...)
  2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 06/15] avformat/matroskaenc: Hoist check out of loop Andreas Rheinhardt
@ 2023-08-08 16:40 ` Andreas Rheinhardt
  2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 08/15] avformat/matroskaenc: Use proper AVIOContext Andreas Rheinhardt
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Andreas Rheinhardt @ 2023-08-08 16:40 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

It is only WebVTT which is special in WebM; hypothetical future
subtitle codecs in WebM will presumably use the ordinary code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/matroskaenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index d9bc31daee..9fd4cf2f6c 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1831,7 +1831,7 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
 
     if (IS_WEBM(mkv)) {
         const char *codec_id;
-        if (par->codec_type != AVMEDIA_TYPE_SUBTITLE) {
+        if (par->codec_id != AV_CODEC_ID_WEBVTT) {
             for (j = 0; ff_webm_codec_tags[j].id != AV_CODEC_ID_NONE; j++) {
                 if (ff_webm_codec_tags[j].id == par->codec_id) {
                     codec_id = ff_webm_codec_tags[j].str;
@@ -1839,7 +1839,7 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
                     break;
                 }
             }
-        } else if (par->codec_id == AV_CODEC_ID_WEBVTT) {
+        } else {
             if (st->disposition & AV_DISPOSITION_CAPTIONS) {
                 codec_id = "D_WEBVTT/CAPTIONS";
                 native_id = MATROSKA_TRACK_TYPE_SUBTITLE;
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [FFmpeg-devel] [PATCH 08/15] avformat/matroskaenc: Use proper AVIOContext
  2023-08-06 23:04 [FFmpeg-devel] [PATCH 1/5] avformat/matroskaenc: Support rotations Andreas Rheinhardt
                   ` (5 preceding siblings ...)
  2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 07/15] avformat/matroskaenc: Remove unnecessary check Andreas Rheinhardt
@ 2023-08-08 16:40 ` Andreas Rheinhardt
  2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 09/15] avformat/matroskaenc: Use dedicated pointer for accesses Andreas Rheinhardt
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Andreas Rheinhardt @ 2023-08-08 16:40 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

These two AVIOContexts currently coincide, but this is not
guaranteed to remain so (in fact, I have plans to write each
TrackEntry into its own AVIOContext).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/matroskaenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 9fd4cf2f6c..bfe6342d9b 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1679,7 +1679,7 @@ static void mkv_write_blockadditionmapping(AVFormatContext *s, MatroskaMuxContex
         // We can't know at this point if there will be a block with BlockAdditions, so
         // we either write the default value here, or a void element. Either of them will
         // be overwritten when finishing the track.
-        put_ebml_uint(mkv->track.bc, MATROSKA_ID_TRACKMAXBLKADDID, 0);
+        put_ebml_uint(pb, MATROSKA_ID_TRACKMAXBLKADDID, 0);
         // Similarly, reserve space for an eventual HDR10+ ITU T.35 metadata BlockAdditionMapping.
         put_ebml_void(pb, 3 /* BlockAdditionMapping */
                         + 4 /* BlockAddIDValue */
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [FFmpeg-devel] [PATCH 09/15] avformat/matroskaenc: Use dedicated pointer for accesses
  2023-08-06 23:04 [FFmpeg-devel] [PATCH 1/5] avformat/matroskaenc: Support rotations Andreas Rheinhardt
                   ` (6 preceding siblings ...)
  2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 08/15] avformat/matroskaenc: Use proper AVIOContext Andreas Rheinhardt
@ 2023-08-08 16:40 ` Andreas Rheinhardt
  2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 10/15] avformat/matroskaenc: Avoid allocations when writing Dynamic HDR10+ Andreas Rheinhardt
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Andreas Rheinhardt @ 2023-08-08 16:40 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Improves readability; also split overlong lines.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/matroskaenc.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index bfe6342d9b..323379c8bc 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -3200,7 +3200,9 @@ after_cues:
 
     if (mkv->track.bc) {
         // write Tracks master
-        if (!IS_WEBM(mkv))
+        if (!IS_WEBM(mkv)) {
+            AVIOContext *track_bc = mkv->track.bc;
+
             for (unsigned i = 0; i < s->nb_streams; i++) {
                 const mkv_track *track = &mkv->tracks[i];
 
@@ -3210,16 +3212,20 @@ after_cues:
                 // We reserved a single byte to write this value.
                 av_assert0(track->max_blockaddid <= 0xFF);
 
-                avio_seek(mkv->track.bc, track->blockadditionmapping_offset, SEEK_SET);
+                avio_seek(track_bc, track->blockadditionmapping_offset, SEEK_SET);
 
-                put_ebml_uint(mkv->track.bc, MATROSKA_ID_TRACKMAXBLKADDID, track->max_blockaddid);
+                put_ebml_uint(track_bc, MATROSKA_ID_TRACKMAXBLKADDID,
+                              track->max_blockaddid);
                 if (track->max_blockaddid == MATROSKA_BLOCK_ADD_ID_ITU_T_T35) {
-                    ebml_master mapping_master = start_ebml_master(mkv->track.bc, MATROSKA_ID_TRACKBLKADDMAPPING, 8);
-                    put_ebml_uint(mkv->track.bc, MATROSKA_ID_BLKADDIDTYPE, MATROSKA_BLOCK_ADD_ID_TYPE_ITU_T_T35);
-                    put_ebml_uint(mkv->track.bc, MATROSKA_ID_BLKADDIDVALUE, MATROSKA_BLOCK_ADD_ID_ITU_T_T35);
-                    end_ebml_master(mkv->track.bc, mapping_master);
+                    ebml_master mapping_master = start_ebml_master(track_bc, MATROSKA_ID_TRACKBLKADDMAPPING, 8);
+                    put_ebml_uint(track_bc, MATROSKA_ID_BLKADDIDTYPE,
+                                  MATROSKA_BLOCK_ADD_ID_TYPE_ITU_T_T35);
+                    put_ebml_uint(track_bc, MATROSKA_ID_BLKADDIDVALUE,
+                                  MATROSKA_BLOCK_ADD_ID_ITU_T_T35);
+                    end_ebml_master(track_bc, mapping_master);
                 }
             }
+        }
 
         avio_seek(pb, mkv->track.pos, SEEK_SET);
         ret = end_ebml_master_crc32(pb, &mkv->track.bc, mkv,
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [FFmpeg-devel] [PATCH 10/15] avformat/matroskaenc: Avoid allocations when writing Dynamic HDR10+
  2023-08-06 23:04 [FFmpeg-devel] [PATCH 1/5] avformat/matroskaenc: Support rotations Andreas Rheinhardt
                   ` (7 preceding siblings ...)
  2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 09/15] avformat/matroskaenc: Use dedicated pointer for accesses Andreas Rheinhardt
@ 2023-08-08 16:40 ` Andreas Rheinhardt
  2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 11/15] avformat/dovi_isom: Don't use AVFormatContext* for logctx Andreas Rheinhardt
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Andreas Rheinhardt @ 2023-08-08 16:40 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Possible since 61b27b15fc924d7fa35baa61cfbc91568945f5db.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/matroskaenc.c | 26 +++++++-------------------
 1 file changed, 7 insertions(+), 19 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 323379c8bc..12a28a6b5c 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2709,7 +2709,8 @@ static int mkv_write_block(void *logctx, MatroskaMuxContext *mkv,
                            int keyframe, int64_t ts, uint64_t duration,
                            int force_blockgroup, int64_t relative_packet_pos)
 {
-    uint8_t *side_data, *buf = NULL;
+    uint8_t t35_buf[6 + AV_HDR_PLUS_MAX_PAYLOAD_SIZE];
+    uint8_t *side_data;
     size_t side_data_size;
     uint64_t additional_id;
     unsigned track_number = track->track_num;
@@ -2765,17 +2766,8 @@ static int mkv_write_block(void *logctx, MatroskaMuxContext *mkv,
                                         AV_PKT_DATA_DYNAMIC_HDR10_PLUS,
                                         &side_data_size);
     if (side_data && side_data_size) {
-        uint8_t *payload;
-        size_t payload_size, buf_size;
-        ret = av_dynamic_hdr_plus_to_t35((AVDynamicHDRPlus *)side_data, NULL,
-                                         &payload_size);
-        if (ret < 0)
-            return ret;
-
-        buf_size = payload_size + 6;
-        buf = payload = av_malloc(buf_size);
-        if (!buf)
-            return AVERROR(ENOMEM);
+        uint8_t *payload = t35_buf;
+        size_t payload_size = sizeof(t35_buf) - 6;
 
         bytestream_put_byte(&payload, 0xB5); // country_code
         bytestream_put_be16(&payload, 0x3C); // provider_code
@@ -2785,9 +2777,9 @@ static int mkv_write_block(void *logctx, MatroskaMuxContext *mkv,
         ret = av_dynamic_hdr_plus_to_t35((AVDynamicHDRPlus *)side_data, &payload,
                                          &payload_size);
         if (ret < 0)
-            goto fail;
+            return ret;
 
-        mkv_write_blockadditional(&writer, buf, buf_size,
+        mkv_write_blockadditional(&writer, t35_buf, payload_size + 6,
                                   MATROSKA_BLOCK_ADD_ID_ITU_T_T35);
         track->max_blockaddid = FFMAX(track->max_blockaddid,
                                       MATROSKA_BLOCK_ADD_ID_ITU_T_T35);
@@ -2807,11 +2799,7 @@ static int mkv_write_block(void *logctx, MatroskaMuxContext *mkv,
         ebml_writer_add_sint(&writer, MATROSKA_ID_BLOCKREFERENCE,
                              track->last_timestamp - ts);
 
-    ret = ebml_writer_write(&writer, pb);
-fail:
-    av_free(buf);
-
-    return ret;
+    return ebml_writer_write(&writer, pb);
 }
 
 static int mkv_end_cluster(AVFormatContext *s)
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [FFmpeg-devel] [PATCH 11/15] avformat/dovi_isom: Don't use AVFormatContext* for logctx
  2023-08-06 23:04 [FFmpeg-devel] [PATCH 1/5] avformat/matroskaenc: Support rotations Andreas Rheinhardt
                   ` (8 preceding siblings ...)
  2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 10/15] avformat/matroskaenc: Avoid allocations when writing Dynamic HDR10+ Andreas Rheinhardt
@ 2023-08-08 16:40 ` Andreas Rheinhardt
  2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 12/15] avformat/matroskaenc: Add const where appropriate Andreas Rheinhardt
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Andreas Rheinhardt @ 2023-08-08 16:40 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Pass it as void* instead. While just at it, also constify
the pointee of AVDOVIDecoderConfigurationRecord* in
ff_isom_put_dvcc_dvvc().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/dovi_isom.c | 12 +++++++-----
 libavformat/dovi_isom.h |  7 ++++---
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/libavformat/dovi_isom.c b/libavformat/dovi_isom.c
index 76681b9451..c8fdf566e4 100644
--- a/libavformat/dovi_isom.c
+++ b/libavformat/dovi_isom.c
@@ -28,7 +28,8 @@
 #include "avformat.h"
 #include "dovi_isom.h"
 
-int ff_isom_parse_dvcc_dvvc(AVFormatContext *s, AVStream *st, const uint8_t *buf_ptr, uint64_t size)
+int ff_isom_parse_dvcc_dvvc(void *logctx, AVStream *st,
+                            const uint8_t *buf_ptr, uint64_t size)
 {
     uint32_t buf;
     AVDOVIDecoderConfigurationRecord *dovi;
@@ -70,7 +71,7 @@ int ff_isom_parse_dvcc_dvvc(AVFormatContext *s, AVStream *st, const uint8_t *buf
         return ret;
     }
 
-    av_log(s, AV_LOG_TRACE, "DOVI in dvcC/dvvC/dvwC box, version: %d.%d, profile: %d, level: %d, "
+    av_log(logctx, AV_LOG_TRACE, "DOVI in dvcC/dvvC/dvwC box, version: %d.%d, profile: %d, level: %d, "
            "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d\n",
            dovi->dv_version_major, dovi->dv_version_minor,
            dovi->dv_profile, dovi->dv_level,
@@ -82,8 +83,8 @@ int ff_isom_parse_dvcc_dvvc(AVFormatContext *s, AVStream *st, const uint8_t *buf
     return 0;
 }
 
-void ff_isom_put_dvcc_dvvc(AVFormatContext *s, uint8_t out[ISOM_DVCC_DVVC_SIZE],
-                           AVDOVIDecoderConfigurationRecord *dovi)
+void ff_isom_put_dvcc_dvvc(void *logctx, uint8_t out[ISOM_DVCC_DVVC_SIZE],
+                           const AVDOVIDecoderConfigurationRecord *dovi)
 {
     PutBitContext pb;
 
@@ -106,7 +107,8 @@ void ff_isom_put_dvcc_dvvc(AVFormatContext *s, uint8_t out[ISOM_DVCC_DVVC_SIZE],
 
     flush_put_bits(&pb);
 
-    av_log(s, AV_LOG_DEBUG, "DOVI in %s box, version: %d.%d, profile: %d, level: %d, "
+    av_log(logctx, AV_LOG_DEBUG,
+           "DOVI in %s box, version: %d.%d, profile: %d, level: %d, "
            "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d\n",
            dovi->dv_profile > 10 ? "dvwC" : (dovi->dv_profile > 7 ? "dvvC" : "dvcC"),
            dovi->dv_version_major, dovi->dv_version_minor,
diff --git a/libavformat/dovi_isom.h b/libavformat/dovi_isom.h
index 1526164319..1221a52793 100644
--- a/libavformat/dovi_isom.h
+++ b/libavformat/dovi_isom.h
@@ -28,8 +28,9 @@
 
 #define ISOM_DVCC_DVVC_SIZE 24
 
-int ff_isom_parse_dvcc_dvvc(AVFormatContext *s, AVStream *st, const uint8_t *buf_ptr, uint64_t size);
-void ff_isom_put_dvcc_dvvc(AVFormatContext *s, uint8_t out[ISOM_DVCC_DVVC_SIZE],
-                           AVDOVIDecoderConfigurationRecord *dovi);
+int ff_isom_parse_dvcc_dvvc(void *logctx, AVStream *st,
+                            const uint8_t *buf_ptr, uint64_t size);
+void ff_isom_put_dvcc_dvvc(void *logctx, uint8_t out[ISOM_DVCC_DVVC_SIZE],
+                           const AVDOVIDecoderConfigurationRecord *dovi);
 
 #endif /* AVFORMAT_DOVI_ISOM_H */
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [FFmpeg-devel] [PATCH 12/15] avformat/matroskaenc: Add const where appropriate
  2023-08-06 23:04 [FFmpeg-devel] [PATCH 1/5] avformat/matroskaenc: Support rotations Andreas Rheinhardt
                   ` (9 preceding siblings ...)
  2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 11/15] avformat/dovi_isom: Don't use AVFormatContext* for logctx Andreas Rheinhardt
@ 2023-08-08 16:40 ` Andreas Rheinhardt
  2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 13/15] avformat/matroskaenc: Don't reserve space for HDR10+ when unnecessary Andreas Rheinhardt
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Andreas Rheinhardt @ 2023-08-08 16:40 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Also move getting the DOVI side data immediately before its use.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/matroskaenc.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 12a28a6b5c..abac70dd80 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1667,12 +1667,11 @@ static int mkv_write_stereo_mode(AVFormatContext *s, EbmlWriter *writer,
     return 0;
 }
 
-static void mkv_write_blockadditionmapping(AVFormatContext *s, MatroskaMuxContext *mkv,
-                                           AVIOContext *pb, mkv_track *track, AVStream *st)
+static void mkv_write_blockadditionmapping(AVFormatContext *s, const MatroskaMuxContext *mkv,
+                                           AVIOContext *pb, mkv_track *track, const AVStream *st)
 {
 #if CONFIG_MATROSKA_MUXER
-    AVDOVIDecoderConfigurationRecord *dovi = (AVDOVIDecoderConfigurationRecord *)
-                                             av_stream_get_side_data(st, AV_PKT_DATA_DOVI_CONF, NULL);
+    const AVDOVIDecoderConfigurationRecord *dovi;
 
     if (IS_SEEKABLE(s->pb, mkv)) {
         track->blockadditionmapping_offset = avio_tell(pb);
@@ -1686,6 +1685,8 @@ static void mkv_write_blockadditionmapping(AVFormatContext *s, MatroskaMuxContex
                         + 4 /* BlockAddIDType */);
     }
 
+    dovi = (const AVDOVIDecoderConfigurationRecord *)
+           av_stream_get_side_data(st, AV_PKT_DATA_DOVI_CONF, NULL);
     if (dovi && dovi->dv_profile <= 10) {
         ebml_master mapping;
         uint8_t buf[ISOM_DVCC_DVVC_SIZE];
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [FFmpeg-devel] [PATCH 13/15] avformat/matroskaenc: Don't reserve space for HDR10+ when unnecessary
  2023-08-06 23:04 [FFmpeg-devel] [PATCH 1/5] avformat/matroskaenc: Support rotations Andreas Rheinhardt
                   ` (10 preceding siblings ...)
  2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 12/15] avformat/matroskaenc: Add const where appropriate Andreas Rheinhardt
@ 2023-08-08 16:40 ` Andreas Rheinhardt
  2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 14/15] avformat/matroskaenc: Reindent after the previous commit Andreas Rheinhardt
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: Andreas Rheinhardt @ 2023-08-08 16:40 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Do it only for video (the only thing for type for which HDR10+
makes sense).

This effectively reverts changes to several FATE ref-files
made in bda44f0f39e8ee646e54f15989d7845f4bf58d26.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/matroskaenc.c                     |  9 +++-
 tests/ref/fate/aac-autobsf-adtstoasc          |  4 +-
 tests/ref/fate/matroska-alac-remux            |  4 +-
 tests/ref/fate/matroska-avoid-negative-ts     |  4 +-
 tests/ref/fate/matroska-dovi-write-config8    |  4 +-
 tests/ref/fate/matroska-dvbsub-remux          |  4 +-
 tests/ref/fate/matroska-encoding-delay        | 14 +++---
 tests/ref/fate/matroska-flac-extradata-update |  4 +-
 tests/ref/fate/matroska-h264-remux            |  4 +-
 .../fate/matroska-mastering-display-metadata  |  4 +-
 tests/ref/fate/matroska-move-cues-to-front    |  4 +-
 tests/ref/fate/matroska-mpegts-remux          |  4 +-
 tests/ref/fate/matroska-ms-mode               |  4 +-
 tests/ref/fate/matroska-ogg-opus-remux        | 10 ++---
 tests/ref/fate/matroska-opus-remux            | 10 ++---
 tests/ref/fate/matroska-pgs-remux             |  4 +-
 tests/ref/fate/matroska-pgs-remux-durations   |  4 +-
 tests/ref/fate/matroska-qt-mode               |  4 +-
 tests/ref/fate/matroska-zero-length-block     |  4 +-
 tests/ref/fate/shortest-sub                   |  4 +-
 tests/ref/lavf/mka                            |  4 +-
 tests/ref/lavf/mkv                            |  4 +-
 tests/ref/lavf/mkv_attachment                 |  4 +-
 tests/ref/seek/lavf-mkv                       | 44 +++++++++----------
 24 files changed, 84 insertions(+), 79 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index abac70dd80..5c251cec7b 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1668,7 +1668,8 @@ static int mkv_write_stereo_mode(AVFormatContext *s, EbmlWriter *writer,
 }
 
 static void mkv_write_blockadditionmapping(AVFormatContext *s, const MatroskaMuxContext *mkv,
-                                           AVIOContext *pb, mkv_track *track, const AVStream *st)
+                                           const AVCodecParameters *par, AVIOContext *pb,
+                                           mkv_track *track, const AVStream *st)
 {
 #if CONFIG_MATROSKA_MUXER
     const AVDOVIDecoderConfigurationRecord *dovi;
@@ -1679,10 +1680,12 @@ static void mkv_write_blockadditionmapping(AVFormatContext *s, const MatroskaMux
         // we either write the default value here, or a void element. Either of them will
         // be overwritten when finishing the track.
         put_ebml_uint(pb, MATROSKA_ID_TRACKMAXBLKADDID, 0);
+        if (par->codec_type == AVMEDIA_TYPE_VIDEO) {
         // Similarly, reserve space for an eventual HDR10+ ITU T.35 metadata BlockAdditionMapping.
         put_ebml_void(pb, 3 /* BlockAdditionMapping */
                         + 4 /* BlockAddIDValue */
                         + 4 /* BlockAddIDType */);
+        }
     }
 
     dovi = (const AVDOVIDecoderConfigurationRecord *)
@@ -2010,7 +2013,7 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
     }
 
     if (!IS_WEBM(mkv))
-        mkv_write_blockadditionmapping(s, mkv, pb, track, st);
+        mkv_write_blockadditionmapping(s, mkv, par, pb, track, st);
 
     if (!IS_WEBM(mkv) || par->codec_id != AV_CODEC_ID_WEBVTT) {
         uint8_t *codecpriv;
@@ -2763,6 +2766,7 @@ static int mkv_write_block(void *logctx, MatroskaMuxContext *mkv,
         track->max_blockaddid = FFMAX(track->max_blockaddid, additional_id);
     }
 
+    if (par->codec_type == AVMEDIA_TYPE_VIDEO) {
     side_data = av_packet_get_side_data(pkt,
                                         AV_PKT_DATA_DYNAMIC_HDR10_PLUS,
                                         &side_data_size);
@@ -2785,6 +2789,7 @@ static int mkv_write_block(void *logctx, MatroskaMuxContext *mkv,
         track->max_blockaddid = FFMAX(track->max_blockaddid,
                                       MATROSKA_BLOCK_ADD_ID_ITU_T_T35);
     }
+    }
 
     ebml_writer_close_or_discard_master(&writer);
 
diff --git a/tests/ref/fate/aac-autobsf-adtstoasc b/tests/ref/fate/aac-autobsf-adtstoasc
index 12b80ef6bd..76125083b6 100644
--- a/tests/ref/fate/aac-autobsf-adtstoasc
+++ b/tests/ref/fate/aac-autobsf-adtstoasc
@@ -1,5 +1,5 @@
-68cb46874ca6029d3ae3a184b4a71b04 *tests/data/fate/aac-autobsf-adtstoasc.matroska
-6657 tests/data/fate/aac-autobsf-adtstoasc.matroska
+3d4465a7ea2cfba31af737e288c892fe *tests/data/fate/aac-autobsf-adtstoasc.matroska
+6646 tests/data/fate/aac-autobsf-adtstoasc.matroska
 #extradata 0:        2, 0x0030001c
 #tb 0: 1/1000
 #media_type 0: audio
diff --git a/tests/ref/fate/matroska-alac-remux b/tests/ref/fate/matroska-alac-remux
index 7f2698eee8..3eb3cdcb37 100644
--- a/tests/ref/fate/matroska-alac-remux
+++ b/tests/ref/fate/matroska-alac-remux
@@ -1,5 +1,5 @@
-d9b986b34e36e865912fd42d2c5b0cab *tests/data/fate/matroska-alac-remux.matroska
-1293821 tests/data/fate/matroska-alac-remux.matroska
+c683b17ab66c9f0fba57da7af86740c9 *tests/data/fate/matroska-alac-remux.matroska
+1293810 tests/data/fate/matroska-alac-remux.matroska
 #extradata 0:       36, 0x562b05d8
 #tb 0: 1/1000
 #media_type 0: audio
diff --git a/tests/ref/fate/matroska-avoid-negative-ts b/tests/ref/fate/matroska-avoid-negative-ts
index dcde937d52..f52f3dec72 100644
--- a/tests/ref/fate/matroska-avoid-negative-ts
+++ b/tests/ref/fate/matroska-avoid-negative-ts
@@ -1,5 +1,5 @@
-6a1a524a5700de7b94bce5a283bbe8b9 *tests/data/fate/matroska-avoid-negative-ts.matroska
-973085 tests/data/fate/matroska-avoid-negative-ts.matroska
+69461a333cae20646d4e514b7b510bef *tests/data/fate/matroska-avoid-negative-ts.matroska
+973074 tests/data/fate/matroska-avoid-negative-ts.matroska
 #extradata 0:       22, 0x2885037c
 #tb 0: 1/1000
 #media_type 0: video
diff --git a/tests/ref/fate/matroska-dovi-write-config8 b/tests/ref/fate/matroska-dovi-write-config8
index 58eb454865..de90101a55 100644
--- a/tests/ref/fate/matroska-dovi-write-config8
+++ b/tests/ref/fate/matroska-dovi-write-config8
@@ -1,5 +1,5 @@
-80d2b23a6f27ab28b02a907b37b9649c *tests/data/fate/matroska-dovi-write-config8.matroska
-3600620 tests/data/fate/matroska-dovi-write-config8.matroska
+56eea905c35996a729371372dd3113f9 *tests/data/fate/matroska-dovi-write-config8.matroska
+3600609 tests/data/fate/matroska-dovi-write-config8.matroska
 #extradata 0:      551, 0xa18acf66
 #extradata 1:        2, 0x00340022
 #tb 0: 1/1000
diff --git a/tests/ref/fate/matroska-dvbsub-remux b/tests/ref/fate/matroska-dvbsub-remux
index b5bb028343..03341d9668 100644
--- a/tests/ref/fate/matroska-dvbsub-remux
+++ b/tests/ref/fate/matroska-dvbsub-remux
@@ -1,5 +1,5 @@
-7154511243fd7edb695c159bb12a0948 *tests/data/fate/matroska-dvbsub-remux.matroska
-39041 tests/data/fate/matroska-dvbsub-remux.matroska
+5d1591e9abd7e1373d43bc776572aaf7 *tests/data/fate/matroska-dvbsub-remux.matroska
+39018 tests/data/fate/matroska-dvbsub-remux.matroska
 #extradata 0:        5, 0x00bb0064
 #extradata 1:        5, 0x00bb0064
 #tb 0: 1/1000
diff --git a/tests/ref/fate/matroska-encoding-delay b/tests/ref/fate/matroska-encoding-delay
index 437992468d..3059c32e03 100644
--- a/tests/ref/fate/matroska-encoding-delay
+++ b/tests/ref/fate/matroska-encoding-delay
@@ -1,5 +1,5 @@
-416f35d123daef715b7c4bbb75c9c778 *tests/data/fate/matroska-encoding-delay.matroska
-961251 tests/data/fate/matroska-encoding-delay.matroska
+c51ac49b96b213e6646196fc81f8eb84 *tests/data/fate/matroska-encoding-delay.matroska
+961240 tests/data/fate/matroska-encoding-delay.matroska
 #extradata 0:       22, 0x32ea0490
 #tb 0: 1/1000
 #media_type 0: video
@@ -32,7 +32,7 @@ dts_time=-0.010000
 duration=24
 duration_time=0.024000
 size=1152
-pos=1268
+pos=1257
 flags=K__
 [/PACKET]
 [PACKET]
@@ -45,7 +45,7 @@ dts_time=0.000000
 duration=40
 duration_time=0.040000
 size=237628
-pos=2428
+pos=2417
 flags=K__
 [/PACKET]
 [PACKET]
@@ -58,7 +58,7 @@ dts_time=0.014000
 duration=24
 duration_time=0.024000
 size=1152
-pos=240063
+pos=240052
 flags=K__
 [/PACKET]
 [PACKET]
@@ -71,7 +71,7 @@ dts_time=0.038000
 duration=24
 duration_time=0.024000
 size=1152
-pos=241238
+pos=241227
 flags=K__
 [/PACKET]
 [PACKET]
@@ -84,7 +84,7 @@ dts_time=0.040000
 duration=40
 duration_time=0.040000
 size=238066
-pos=242398
+pos=242387
 flags=K__
 [/PACKET]
 [STREAM]
diff --git a/tests/ref/fate/matroska-flac-extradata-update b/tests/ref/fate/matroska-flac-extradata-update
index 37e0367297..d6713aaafa 100644
--- a/tests/ref/fate/matroska-flac-extradata-update
+++ b/tests/ref/fate/matroska-flac-extradata-update
@@ -1,5 +1,5 @@
-8a75767c14e63e7d15291c5c4918a661 *tests/data/fate/matroska-flac-extradata-update.matroska
-1840 tests/data/fate/matroska-flac-extradata-update.matroska
+fdbfdc51b519fd5e8f425aca1e7b8704 *tests/data/fate/matroska-flac-extradata-update.matroska
+1807 tests/data/fate/matroska-flac-extradata-update.matroska
 #extradata 0:       34, 0x93650c81
 #extradata 1:       34, 0x93650c81
 #extradata 2:       34, 0x93650c81
diff --git a/tests/ref/fate/matroska-h264-remux b/tests/ref/fate/matroska-h264-remux
index bfc80a273f..aefd6f65ef 100644
--- a/tests/ref/fate/matroska-h264-remux
+++ b/tests/ref/fate/matroska-h264-remux
@@ -1,5 +1,5 @@
-38ede644af311f443d7446600f25a8e3 *tests/data/fate/matroska-h264-remux.matroska
-2036093 tests/data/fate/matroska-h264-remux.matroska
+bc0ce442f20d1d62663b40391a3be812 *tests/data/fate/matroska-h264-remux.matroska
+2036071 tests/data/fate/matroska-h264-remux.matroska
 #tb 0: 1/25
 #media_type 0: video
 #codec_id 0: rawvideo
diff --git a/tests/ref/fate/matroska-mastering-display-metadata b/tests/ref/fate/matroska-mastering-display-metadata
index c63365c181..ad36f01e61 100644
--- a/tests/ref/fate/matroska-mastering-display-metadata
+++ b/tests/ref/fate/matroska-mastering-display-metadata
@@ -1,5 +1,5 @@
-a4924bfe22ed0c72b0eddc353bbee10c *tests/data/fate/matroska-mastering-display-metadata.matroska
-1669615 tests/data/fate/matroska-mastering-display-metadata.matroska
+b3204c8fa6a78037243cc4948a2775ee *tests/data/fate/matroska-mastering-display-metadata.matroska
+1669593 tests/data/fate/matroska-mastering-display-metadata.matroska
 #extradata 0:        4, 0x040901a3
 #extradata 3:      200, 0x506463a8
 #tb 0: 1/1000
diff --git a/tests/ref/fate/matroska-move-cues-to-front b/tests/ref/fate/matroska-move-cues-to-front
index ce3b9fce92..79ccc2fd93 100644
--- a/tests/ref/fate/matroska-move-cues-to-front
+++ b/tests/ref/fate/matroska-move-cues-to-front
@@ -1,5 +1,5 @@
-03ed7fcf99dd993ebb9bc9c6c93ba73e *tests/data/fate/matroska-move-cues-to-front.matroska
-23210319 tests/data/fate/matroska-move-cues-to-front.matroska
+74a5ed3f0b14112322c8bf3e94d6e98b *tests/data/fate/matroska-move-cues-to-front.matroska
+23210297 tests/data/fate/matroska-move-cues-to-front.matroska
 #tb 0: 1/1000
 #media_type 0: audio
 #codec_id 0: pcm_s24be
diff --git a/tests/ref/fate/matroska-mpegts-remux b/tests/ref/fate/matroska-mpegts-remux
index 1f211dfc29..af41b57af1 100644
--- a/tests/ref/fate/matroska-mpegts-remux
+++ b/tests/ref/fate/matroska-mpegts-remux
@@ -1,5 +1,5 @@
-53424355db1d78441b62ad114d6ea502 *tests/data/fate/matroska-mpegts-remux.matroska
-6524 tests/data/fate/matroska-mpegts-remux.matroska
+ca1b91e49b6e238b641007c186d8f424 *tests/data/fate/matroska-mpegts-remux.matroska
+6502 tests/data/fate/matroska-mpegts-remux.matroska
 #tb 0: 1/1000
 #media_type 0: audio
 #codec_id 0: ac3
diff --git a/tests/ref/fate/matroska-ms-mode b/tests/ref/fate/matroska-ms-mode
index b12e9ac9f2..7ce0f1e4ff 100644
--- a/tests/ref/fate/matroska-ms-mode
+++ b/tests/ref/fate/matroska-ms-mode
@@ -1,5 +1,5 @@
-f3b1b804d40d70d012e85ba6d03ea8f1 *tests/data/fate/matroska-ms-mode.matroska
-413116 tests/data/fate/matroska-ms-mode.matroska
+703d268b966d5dfabe5e22c2de69dc66 *tests/data/fate/matroska-ms-mode.matroska
+413105 tests/data/fate/matroska-ms-mode.matroska
 #extradata 0:       40, 0x54290c93
 #extradata 1:      114, 0xb6c80771
 #tb 0: 1/1000
diff --git a/tests/ref/fate/matroska-ogg-opus-remux b/tests/ref/fate/matroska-ogg-opus-remux
index c70c58a697..cd3eade361 100644
--- a/tests/ref/fate/matroska-ogg-opus-remux
+++ b/tests/ref/fate/matroska-ogg-opus-remux
@@ -1,5 +1,5 @@
-d891990279e6ba202448f9fffde52d3f *tests/data/fate/matroska-ogg-opus-remux.matroska
-10215 tests/data/fate/matroska-ogg-opus-remux.matroska
+b602a1a4aaa4fbca4b8aaf39b66d7235 *tests/data/fate/matroska-ogg-opus-remux.matroska
+10204 tests/data/fate/matroska-ogg-opus-remux.matroska
 #extradata 0:       19, 0x399c0471
 #tb 0: 1/1000
 #media_type 0: audio
@@ -57,7 +57,7 @@ dts_time=-0.007000
 duration=20
 duration_time=0.020000
 size=402
-pos=555
+pos=544
 flags=K__
 [/PACKET]
 [PACKET]
@@ -70,7 +70,7 @@ dts_time=0.013000
 duration=20
 duration_time=0.020000
 size=216
-pos=964
+pos=953
 flags=K__
 [/PACKET]
 [PACKET]
@@ -83,7 +83,7 @@ dts_time=0.033000
 duration=20
 duration_time=0.020000
 size=215
-pos=1187
+pos=1176
 flags=K__
 [/PACKET]
 [STREAM]
diff --git a/tests/ref/fate/matroska-opus-remux b/tests/ref/fate/matroska-opus-remux
index f5dcbe164e..975510e167 100644
--- a/tests/ref/fate/matroska-opus-remux
+++ b/tests/ref/fate/matroska-opus-remux
@@ -1,5 +1,5 @@
-dc14cd32921d86e03c155bb745edf44b *tests/data/fate/matroska-opus-remux.matroska
-9370 tests/data/fate/matroska-opus-remux.matroska
+fe0258eb0d4b525203ea240c87a154d3 *tests/data/fate/matroska-opus-remux.matroska
+9359 tests/data/fate/matroska-opus-remux.matroska
 #extradata 0:       19, 0x3a04048f
 #tb 0: 1/1000
 #media_type 0: audio
@@ -68,7 +68,7 @@ dts_time=-0.007000
 duration=20
 duration_time=0.020000
 size=320
-pos=511
+pos=500
 flags=K__
 [/PACKET]
 [PACKET]
@@ -81,7 +81,7 @@ dts_time=0.014000
 duration=20
 duration_time=0.020000
 size=159
-pos=838
+pos=827
 flags=K__
 [/PACKET]
 [PACKET]
@@ -94,7 +94,7 @@ dts_time=0.034000
 duration=20
 duration_time=0.020000
 size=148
-pos=1004
+pos=993
 flags=K__
 [/PACKET]
 [STREAM]
diff --git a/tests/ref/fate/matroska-pgs-remux b/tests/ref/fate/matroska-pgs-remux
index 482357b899..a086111495 100644
--- a/tests/ref/fate/matroska-pgs-remux
+++ b/tests/ref/fate/matroska-pgs-remux
@@ -1,5 +1,5 @@
-60161b7f8af39a8d280cc8b1f8693129 *tests/data/fate/matroska-pgs-remux.matroska
-49759 tests/data/fate/matroska-pgs-remux.matroska
+d39daa393d66ae0b0c153be045897585 *tests/data/fate/matroska-pgs-remux.matroska
+49748 tests/data/fate/matroska-pgs-remux.matroska
 #tb 0: 1/1000
 #media_type 0: subtitle
 #codec_id 0: hdmv_pgs_subtitle
diff --git a/tests/ref/fate/matroska-pgs-remux-durations b/tests/ref/fate/matroska-pgs-remux-durations
index 6280110948..37494cd98f 100644
--- a/tests/ref/fate/matroska-pgs-remux-durations
+++ b/tests/ref/fate/matroska-pgs-remux-durations
@@ -1,5 +1,5 @@
-2c78a4337f61f24175a8ffe06087e581 *tests/data/fate/matroska-pgs-remux-durations.matroska
-49771 tests/data/fate/matroska-pgs-remux-durations.matroska
+27af80eecea4f15f415f22841bc699d5 *tests/data/fate/matroska-pgs-remux-durations.matroska
+49760 tests/data/fate/matroska-pgs-remux-durations.matroska
 #tb 0: 1/1000
 #media_type 0: subtitle
 #codec_id 0: hdmv_pgs_subtitle
diff --git a/tests/ref/fate/matroska-qt-mode b/tests/ref/fate/matroska-qt-mode
index e14584893b..62a2d82f16 100644
--- a/tests/ref/fate/matroska-qt-mode
+++ b/tests/ref/fate/matroska-qt-mode
@@ -1,5 +1,5 @@
-a976ac0fd5c1ca916280f64525d12c10 *tests/data/fate/matroska-qt-mode.matroska
-1884254 tests/data/fate/matroska-qt-mode.matroska
+f2eac23e9f7f3a7dac9e2d94885ff4f1 *tests/data/fate/matroska-qt-mode.matroska
+1884243 tests/data/fate/matroska-qt-mode.matroska
 #extradata 0:       90, 0x817d0185
 #tb 0: 1/1000
 #media_type 0: video
diff --git a/tests/ref/fate/matroska-zero-length-block b/tests/ref/fate/matroska-zero-length-block
index 0f90ccbdd7..3987cc14c4 100644
--- a/tests/ref/fate/matroska-zero-length-block
+++ b/tests/ref/fate/matroska-zero-length-block
@@ -1,5 +1,5 @@
-b9a8a67ffdba18eec1c04827d3d404ca *tests/data/fate/matroska-zero-length-block.matroska
-645 tests/data/fate/matroska-zero-length-block.matroska
+f577fad2fff41d6e055f605281582b8d *tests/data/fate/matroska-zero-length-block.matroska
+634 tests/data/fate/matroska-zero-length-block.matroska
 #tb 0: 1/1000
 #media_type 0: subtitle
 #codec_id 0: subrip
diff --git a/tests/ref/fate/shortest-sub b/tests/ref/fate/shortest-sub
index 4db0e13328..49e13d65d7 100644
--- a/tests/ref/fate/shortest-sub
+++ b/tests/ref/fate/shortest-sub
@@ -1,5 +1,5 @@
-791a2ce136bef538491bbe31ac0134b1 *tests/data/fate/shortest-sub.matroska
-139262 tests/data/fate/shortest-sub.matroska
+2b6e72494d74aaf07380bfe3d50b62d5 *tests/data/fate/shortest-sub.matroska
+139251 tests/data/fate/shortest-sub.matroska
 #extradata 1:      167, 0xf7272d5f
 #tb 0: 1/1000
 #media_type 0: video
diff --git a/tests/ref/lavf/mka b/tests/ref/lavf/mka
index 40b1f07f9b..93a0b8f71a 100644
--- a/tests/ref/lavf/mka
+++ b/tests/ref/lavf/mka
@@ -1,3 +1,3 @@
-dffd74918d13be7dd07e83832de3a15c *tests/data/lavf/lavf.mka
-43584 tests/data/lavf/lavf.mka
+77db16a9fe1c42a230c85124bfb40cad *tests/data/lavf/lavf.mka
+43573 tests/data/lavf/lavf.mka
 tests/data/lavf/lavf.mka CRC=0x3a1da17e
diff --git a/tests/ref/lavf/mkv b/tests/ref/lavf/mkv
index 5d0bf06fa9..8ddc9cf57f 100644
--- a/tests/ref/lavf/mkv
+++ b/tests/ref/lavf/mkv
@@ -1,3 +1,3 @@
-1dce6c32d49a8f637262db2d8e7f2744 *tests/data/lavf/lavf.mkv
-320439 tests/data/lavf/lavf.mkv
+05889ab61cc6144018c80e50c781fe44 *tests/data/lavf/lavf.mkv
+320428 tests/data/lavf/lavf.mkv
 tests/data/lavf/lavf.mkv CRC=0xec6c3c68
diff --git a/tests/ref/lavf/mkv_attachment b/tests/ref/lavf/mkv_attachment
index b79bf9a619..6a08a580d2 100644
--- a/tests/ref/lavf/mkv_attachment
+++ b/tests/ref/lavf/mkv_attachment
@@ -1,3 +1,3 @@
-140ffb4f6a734972a9d38f4e6d57f304 *tests/data/lavf/lavf.mkv_attachment
-472589 tests/data/lavf/lavf.mkv_attachment
+901b4ba820fe1d6c627ce2a4b31b65af *tests/data/lavf/lavf.mkv_attachment
+472578 tests/data/lavf/lavf.mkv_attachment
 tests/data/lavf/lavf.mkv_attachment CRC=0xec6c3c68
diff --git a/tests/ref/seek/lavf-mkv b/tests/ref/seek/lavf-mkv
index 90d91e3968..6abdbd6ee7 100644
--- a/tests/ref/seek/lavf-mkv
+++ b/tests/ref/seek/lavf-mkv
@@ -1,48 +1,48 @@
-ret: 0         st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos:    687 size:   208
+ret: 0         st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos:    676 size:   208
 ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    903 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    892 size: 27837
 ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292319 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292308 size: 27834
 ret: 0         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292319 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292308 size: 27834
 ret: 0         st: 0 flags:1  ts:-0.317000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    903 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    892 size: 27837
 ret:-1         st: 1 flags:0  ts: 2.577000
 ret: 0         st: 1 flags:1  ts: 1.471000
-ret: 0         st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320160 size:   209
+ret: 0         st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320149 size:   209
 ret: 0         st:-1 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146871 size: 27925
+ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146860 size: 27925
 ret: 0         st:-1 flags:1  ts:-0.740831
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    903 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    892 size: 27837
 ret:-1         st: 0 flags:0  ts: 2.153000
 ret: 0         st: 0 flags:1  ts: 1.048000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292319 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292308 size: 27834
 ret: 0         st: 1 flags:0  ts:-0.058000
-ret: 0         st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos:    687 size:   208
+ret: 0         st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos:    676 size:   208
 ret: 0         st: 1 flags:1  ts: 2.836000
-ret: 0         st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320160 size:   209
+ret: 0         st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320149 size:   209
 ret:-1         st:-1 flags:0  ts: 1.730004
 ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146871 size: 27925
+ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146860 size: 27925
 ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    903 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    892 size: 27837
 ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292319 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292308 size: 27834
 ret:-1         st: 1 flags:0  ts: 1.307000
 ret: 0         st: 1 flags:1  ts: 0.201000
-ret: 0         st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos:    687 size:   208
+ret: 0         st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos:    676 size:   208
 ret: 0         st:-1 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    903 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    892 size: 27837
 ret: 0         st:-1 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292319 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292308 size: 27834
 ret: 0         st: 0 flags:0  ts: 0.883000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292319 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292308 size: 27834
 ret: 0         st: 0 flags:1  ts:-0.222000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    903 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    892 size: 27837
 ret:-1         st: 1 flags:0  ts: 2.672000
 ret: 0         st: 1 flags:1  ts: 1.566000
-ret: 0         st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320160 size:   209
+ret: 0         st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320149 size:   209
 ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146871 size: 27925
+ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146860 size: 27925
 ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    903 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    892 size: 27837
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [FFmpeg-devel] [PATCH 14/15] avformat/matroskaenc: Reindent after the previous commit
  2023-08-06 23:04 [FFmpeg-devel] [PATCH 1/5] avformat/matroskaenc: Support rotations Andreas Rheinhardt
                   ` (11 preceding siblings ...)
  2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 13/15] avformat/matroskaenc: Don't reserve space for HDR10+ when unnecessary Andreas Rheinhardt
@ 2023-08-08 16:40 ` Andreas Rheinhardt
  2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 15/15] avformat/matroskaenc: Don't write \0 unnecessarily Andreas Rheinhardt
  2023-08-09  9:26 ` [FFmpeg-devel] [PATCH 1/5] avformat/matroskaenc: Support rotations Andreas Rheinhardt
  14 siblings, 0 replies; 17+ messages in thread
From: Andreas Rheinhardt @ 2023-08-08 16:40 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/matroskaenc.c | 49 ++++++++++++++++++++-------------------
 1 file changed, 25 insertions(+), 24 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 5c251cec7b..7cbae47e42 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1681,10 +1681,11 @@ static void mkv_write_blockadditionmapping(AVFormatContext *s, const MatroskaMux
         // be overwritten when finishing the track.
         put_ebml_uint(pb, MATROSKA_ID_TRACKMAXBLKADDID, 0);
         if (par->codec_type == AVMEDIA_TYPE_VIDEO) {
-        // Similarly, reserve space for an eventual HDR10+ ITU T.35 metadata BlockAdditionMapping.
-        put_ebml_void(pb, 3 /* BlockAdditionMapping */
-                        + 4 /* BlockAddIDValue */
-                        + 4 /* BlockAddIDType */);
+            // Similarly, reserve space for an eventual
+            // HDR10+ ITU T.35 metadata BlockAdditionMapping.
+            put_ebml_void(pb, 3 /* BlockAdditionMapping */
+                            + 4 /* BlockAddIDValue */
+                            + 4 /* BlockAddIDType */);
         }
     }
 
@@ -2767,28 +2768,28 @@ static int mkv_write_block(void *logctx, MatroskaMuxContext *mkv,
     }
 
     if (par->codec_type == AVMEDIA_TYPE_VIDEO) {
-    side_data = av_packet_get_side_data(pkt,
-                                        AV_PKT_DATA_DYNAMIC_HDR10_PLUS,
-                                        &side_data_size);
-    if (side_data && side_data_size) {
-        uint8_t *payload = t35_buf;
-        size_t payload_size = sizeof(t35_buf) - 6;
-
-        bytestream_put_byte(&payload, 0xB5); // country_code
-        bytestream_put_be16(&payload, 0x3C); // provider_code
-        bytestream_put_be16(&payload, 0x01); // provider_oriented_code
-        bytestream_put_byte(&payload, 0x04); // application_identifier
-
-        ret = av_dynamic_hdr_plus_to_t35((AVDynamicHDRPlus *)side_data, &payload,
-                                         &payload_size);
-        if (ret < 0)
-            return ret;
+        side_data = av_packet_get_side_data(pkt,
+                                            AV_PKT_DATA_DYNAMIC_HDR10_PLUS,
+                                            &side_data_size);
+        if (side_data && side_data_size) {
+            uint8_t *payload = t35_buf;
+            size_t payload_size = sizeof(t35_buf) - 6;
+
+            bytestream_put_byte(&payload, 0xB5); // country_code
+            bytestream_put_be16(&payload, 0x3C); // provider_code
+            bytestream_put_be16(&payload, 0x01); // provider_oriented_code
+            bytestream_put_byte(&payload, 0x04); // application_identifier
+
+            ret = av_dynamic_hdr_plus_to_t35((AVDynamicHDRPlus *)side_data, &payload,
+                                            &payload_size);
+            if (ret < 0)
+                return ret;
 
-        mkv_write_blockadditional(&writer, t35_buf, payload_size + 6,
-                                  MATROSKA_BLOCK_ADD_ID_ITU_T_T35);
-        track->max_blockaddid = FFMAX(track->max_blockaddid,
+            mkv_write_blockadditional(&writer, t35_buf, payload_size + 6,
                                       MATROSKA_BLOCK_ADD_ID_ITU_T_T35);
-    }
+            track->max_blockaddid = FFMAX(track->max_blockaddid,
+                                          MATROSKA_BLOCK_ADD_ID_ITU_T_T35);
+        }
     }
 
     ebml_writer_close_or_discard_master(&writer);
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [FFmpeg-devel] [PATCH 15/15] avformat/matroskaenc: Don't write \0 unnecessarily
  2023-08-06 23:04 [FFmpeg-devel] [PATCH 1/5] avformat/matroskaenc: Support rotations Andreas Rheinhardt
                   ` (12 preceding siblings ...)
  2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 14/15] avformat/matroskaenc: Reindent after the previous commit Andreas Rheinhardt
@ 2023-08-08 16:40 ` Andreas Rheinhardt
  2023-08-09  9:26 ` [FFmpeg-devel] [PATCH 1/5] avformat/matroskaenc: Support rotations Andreas Rheinhardt
  14 siblings, 0 replies; 17+ messages in thread
From: Andreas Rheinhardt @ 2023-08-08 16:40 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Writing the duration SimpleTag is special: It's size is
reserved in advance via an EBML Void element (if seekable)
and this reserved space is overwritten when writing the trailer;
it does not use put_ebml_string().

The string to write is created via snprintf on a buffer
of size 20; this buffer is then written via put_ebml_binary()
with a size of 20.

EBML strings need not be zero-terminated; if not, they
are implicitly terminated by the element's length field.
snprintf() always zero-terminates the buffer, i.e.
the last byte can be discarded when using an EBML string.
This patch does this.

The FATE changes are as expected: One byte saved for every
track; the only exception is the matroska-qt-mode test:
An additional byte is saved because an additional byte
could be saved from the enclosing Tags length field.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
Why has this been overlooked for so long?

 libavformat/matroskaenc.c                     | 15 ++++---
 tests/ref/fate/aac-autobsf-adtstoasc          |  4 +-
 tests/ref/fate/matroska-alac-remux            |  4 +-
 tests/ref/fate/matroska-avoid-negative-ts     |  4 +-
 tests/ref/fate/matroska-dovi-write-config7    |  4 +-
 tests/ref/fate/matroska-dovi-write-config8    |  4 +-
 tests/ref/fate/matroska-dvbsub-remux          |  4 +-
 tests/ref/fate/matroska-encoding-delay        | 14 +++---
 tests/ref/fate/matroska-flac-extradata-update |  4 +-
 tests/ref/fate/matroska-h264-remux            |  4 +-
 tests/ref/fate/matroska-hdr10-plus-remux      |  6 +--
 .../fate/matroska-mastering-display-metadata  |  4 +-
 tests/ref/fate/matroska-move-cues-to-front    |  4 +-
 tests/ref/fate/matroska-mpegts-remux          |  4 +-
 tests/ref/fate/matroska-ms-mode               |  4 +-
 tests/ref/fate/matroska-ogg-opus-remux        | 10 ++---
 tests/ref/fate/matroska-opus-remux            | 10 ++---
 tests/ref/fate/matroska-pgs-remux             |  4 +-
 tests/ref/fate/matroska-pgs-remux-durations   |  4 +-
 tests/ref/fate/matroska-qt-mode               |  4 +-
 tests/ref/fate/matroska-spherical-mono-remux  |  4 +-
 tests/ref/fate/matroska-vp8-alpha-remux       |  4 +-
 tests/ref/fate/matroska-zero-length-block     |  4 +-
 tests/ref/fate/rgb24-mkv                      |  4 +-
 tests/ref/fate/shortest-sub                   |  4 +-
 tests/ref/fate/webm-av1-extradata-update      |  4 +-
 tests/ref/fate/webm-dash-chapters             |  4 +-
 tests/ref/fate/webm-hdr10-plus-remux          |  6 +--
 tests/ref/fate/webm-webvtt-remux              |  4 +-
 tests/ref/lavf-fate/av1.mkv                   |  4 +-
 tests/ref/lavf/mka                            |  4 +-
 tests/ref/lavf/mkv                            |  4 +-
 tests/ref/lavf/mkv_attachment                 |  4 +-
 tests/ref/seek/lavf-mkv                       | 44 +++++++++----------
 34 files changed, 109 insertions(+), 104 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 7cbae47e42..e813ef86cf 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -264,8 +264,12 @@ typedef struct MatroskaMuxContext {
 /** 4 * (1-byte EBML ID, 1-byte EBML size, 8-byte uint max) */
 #define MAX_CUETRACKPOS_SIZE 40
 
-/** 2 + 1 Simpletag header, 2 + 1 + 8 Name "DURATION", 23B for TagString */
-#define DURATION_SIMPLETAG_SIZE (2 + 1 + (2 + 1 + 8) + 23)
+/** DURATION_STRING_LENGTH must be <= 112 or the containing
+ * simpletag will need more than one byte for its length field. */
+#define DURATION_STRING_LENGTH 19
+
+/** 2 + 1 Simpletag header, 2 + 1 + 8 Name "DURATION", rest for TagString */
+#define DURATION_SIMPLETAG_SIZE (2 + 1 + (2 + 1 + 8) + (2 + 1 + DURATION_STRING_LENGTH))
 
 /** Seek preroll value for opus */
 #define OPUS_SEEK_PREROLL 80000000
@@ -3239,7 +3243,7 @@ after_cues:
 
             if (track->duration_offset > 0) {
                 double duration_sec = track->duration * av_q2d(st->time_base);
-                char duration_string[20] = "";
+                char duration_string[DURATION_STRING_LENGTH + 1] = "";
                 ebml_master simpletag;
 
                 av_log(s, AV_LOG_DEBUG, "stream %d end duration = %" PRIu64 "\n", i,
@@ -3250,11 +3254,12 @@ after_cues:
                                               2 + 1 + 8 + 23);
                 put_ebml_string(tags_bc, MATROSKA_ID_TAGNAME, "DURATION");
 
-                snprintf(duration_string, 20, "%02d:%02d:%012.9f",
+                snprintf(duration_string, sizeof(duration_string), "%02d:%02d:%012.9f",
                          (int) duration_sec / 3600, ((int) duration_sec / 60) % 60,
                          fmod(duration_sec, 60));
 
-                put_ebml_binary(tags_bc, MATROSKA_ID_TAGSTRING, duration_string, 20);
+                put_ebml_binary(tags_bc, MATROSKA_ID_TAGSTRING,
+                                duration_string, DURATION_STRING_LENGTH);
                 end_ebml_master(tags_bc, simpletag);
             }
         }
diff --git a/tests/ref/fate/aac-autobsf-adtstoasc b/tests/ref/fate/aac-autobsf-adtstoasc
index 76125083b6..616f875ab3 100644
--- a/tests/ref/fate/aac-autobsf-adtstoasc
+++ b/tests/ref/fate/aac-autobsf-adtstoasc
@@ -1,5 +1,5 @@
-3d4465a7ea2cfba31af737e288c892fe *tests/data/fate/aac-autobsf-adtstoasc.matroska
-6646 tests/data/fate/aac-autobsf-adtstoasc.matroska
+b8594ae7884fcad4acfc5b997d012857 *tests/data/fate/aac-autobsf-adtstoasc.matroska
+6645 tests/data/fate/aac-autobsf-adtstoasc.matroska
 #extradata 0:        2, 0x0030001c
 #tb 0: 1/1000
 #media_type 0: audio
diff --git a/tests/ref/fate/matroska-alac-remux b/tests/ref/fate/matroska-alac-remux
index 3eb3cdcb37..70fb11a14f 100644
--- a/tests/ref/fate/matroska-alac-remux
+++ b/tests/ref/fate/matroska-alac-remux
@@ -1,5 +1,5 @@
-c683b17ab66c9f0fba57da7af86740c9 *tests/data/fate/matroska-alac-remux.matroska
-1293810 tests/data/fate/matroska-alac-remux.matroska
+71f41fb8d2fe30281c254c378921bf2a *tests/data/fate/matroska-alac-remux.matroska
+1293809 tests/data/fate/matroska-alac-remux.matroska
 #extradata 0:       36, 0x562b05d8
 #tb 0: 1/1000
 #media_type 0: audio
diff --git a/tests/ref/fate/matroska-avoid-negative-ts b/tests/ref/fate/matroska-avoid-negative-ts
index f52f3dec72..05821cbf09 100644
--- a/tests/ref/fate/matroska-avoid-negative-ts
+++ b/tests/ref/fate/matroska-avoid-negative-ts
@@ -1,5 +1,5 @@
-69461a333cae20646d4e514b7b510bef *tests/data/fate/matroska-avoid-negative-ts.matroska
-973074 tests/data/fate/matroska-avoid-negative-ts.matroska
+dede1d72a28c7eb0a849acf230b08247 *tests/data/fate/matroska-avoid-negative-ts.matroska
+973072 tests/data/fate/matroska-avoid-negative-ts.matroska
 #extradata 0:       22, 0x2885037c
 #tb 0: 1/1000
 #media_type 0: video
diff --git a/tests/ref/fate/matroska-dovi-write-config7 b/tests/ref/fate/matroska-dovi-write-config7
index ef4c87d885..aaeeb34751 100644
--- a/tests/ref/fate/matroska-dovi-write-config7
+++ b/tests/ref/fate/matroska-dovi-write-config7
@@ -1,5 +1,5 @@
-82581e39700ff479516c33402e8b1d5d *tests/data/fate/matroska-dovi-write-config7.matroska
-72702 tests/data/fate/matroska-dovi-write-config7.matroska
+7adef53df9e14358e0b99f8a829e2d97 *tests/data/fate/matroska-dovi-write-config7.matroska
+72700 tests/data/fate/matroska-dovi-write-config7.matroska
 #extradata 0:      116, 0x2b8d1669
 #extradata 1:      116, 0x2b8d1669
 #tb 0: 1/1000
diff --git a/tests/ref/fate/matroska-dovi-write-config8 b/tests/ref/fate/matroska-dovi-write-config8
index de90101a55..55fe191047 100644
--- a/tests/ref/fate/matroska-dovi-write-config8
+++ b/tests/ref/fate/matroska-dovi-write-config8
@@ -1,5 +1,5 @@
-56eea905c35996a729371372dd3113f9 *tests/data/fate/matroska-dovi-write-config8.matroska
-3600609 tests/data/fate/matroska-dovi-write-config8.matroska
+0730145aa317d800cb4bde0e3a38bb8d *tests/data/fate/matroska-dovi-write-config8.matroska
+3600607 tests/data/fate/matroska-dovi-write-config8.matroska
 #extradata 0:      551, 0xa18acf66
 #extradata 1:        2, 0x00340022
 #tb 0: 1/1000
diff --git a/tests/ref/fate/matroska-dvbsub-remux b/tests/ref/fate/matroska-dvbsub-remux
index 03341d9668..f55b9642c4 100644
--- a/tests/ref/fate/matroska-dvbsub-remux
+++ b/tests/ref/fate/matroska-dvbsub-remux
@@ -1,5 +1,5 @@
-5d1591e9abd7e1373d43bc776572aaf7 *tests/data/fate/matroska-dvbsub-remux.matroska
-39018 tests/data/fate/matroska-dvbsub-remux.matroska
+d6385d4623cd59061c13e26b004eaa8e *tests/data/fate/matroska-dvbsub-remux.matroska
+39016 tests/data/fate/matroska-dvbsub-remux.matroska
 #extradata 0:        5, 0x00bb0064
 #extradata 1:        5, 0x00bb0064
 #tb 0: 1/1000
diff --git a/tests/ref/fate/matroska-encoding-delay b/tests/ref/fate/matroska-encoding-delay
index 3059c32e03..d2ff2d07be 100644
--- a/tests/ref/fate/matroska-encoding-delay
+++ b/tests/ref/fate/matroska-encoding-delay
@@ -1,5 +1,5 @@
-c51ac49b96b213e6646196fc81f8eb84 *tests/data/fate/matroska-encoding-delay.matroska
-961240 tests/data/fate/matroska-encoding-delay.matroska
+156c5c615bee0c55e76275df8d84e505 *tests/data/fate/matroska-encoding-delay.matroska
+961238 tests/data/fate/matroska-encoding-delay.matroska
 #extradata 0:       22, 0x32ea0490
 #tb 0: 1/1000
 #media_type 0: video
@@ -32,7 +32,7 @@ dts_time=-0.010000
 duration=24
 duration_time=0.024000
 size=1152
-pos=1257
+pos=1255
 flags=K__
 [/PACKET]
 [PACKET]
@@ -45,7 +45,7 @@ dts_time=0.000000
 duration=40
 duration_time=0.040000
 size=237628
-pos=2417
+pos=2415
 flags=K__
 [/PACKET]
 [PACKET]
@@ -58,7 +58,7 @@ dts_time=0.014000
 duration=24
 duration_time=0.024000
 size=1152
-pos=240052
+pos=240050
 flags=K__
 [/PACKET]
 [PACKET]
@@ -71,7 +71,7 @@ dts_time=0.038000
 duration=24
 duration_time=0.024000
 size=1152
-pos=241227
+pos=241225
 flags=K__
 [/PACKET]
 [PACKET]
@@ -84,7 +84,7 @@ dts_time=0.040000
 duration=40
 duration_time=0.040000
 size=238066
-pos=242387
+pos=242385
 flags=K__
 [/PACKET]
 [STREAM]
diff --git a/tests/ref/fate/matroska-flac-extradata-update b/tests/ref/fate/matroska-flac-extradata-update
index d6713aaafa..a4f8bf2dac 100644
--- a/tests/ref/fate/matroska-flac-extradata-update
+++ b/tests/ref/fate/matroska-flac-extradata-update
@@ -1,5 +1,5 @@
-fdbfdc51b519fd5e8f425aca1e7b8704 *tests/data/fate/matroska-flac-extradata-update.matroska
-1807 tests/data/fate/matroska-flac-extradata-update.matroska
+f0b0a6a8a0fc975aef9048023faf7c92 *tests/data/fate/matroska-flac-extradata-update.matroska
+1804 tests/data/fate/matroska-flac-extradata-update.matroska
 #extradata 0:       34, 0x93650c81
 #extradata 1:       34, 0x93650c81
 #extradata 2:       34, 0x93650c81
diff --git a/tests/ref/fate/matroska-h264-remux b/tests/ref/fate/matroska-h264-remux
index aefd6f65ef..2c727f03cd 100644
--- a/tests/ref/fate/matroska-h264-remux
+++ b/tests/ref/fate/matroska-h264-remux
@@ -1,5 +1,5 @@
-bc0ce442f20d1d62663b40391a3be812 *tests/data/fate/matroska-h264-remux.matroska
-2036071 tests/data/fate/matroska-h264-remux.matroska
+f6b943ed3ff05087d0ef58fbaf7abcb0 *tests/data/fate/matroska-h264-remux.matroska
+2036067 tests/data/fate/matroska-h264-remux.matroska
 #tb 0: 1/25
 #media_type 0: video
 #codec_id 0: rawvideo
diff --git a/tests/ref/fate/matroska-hdr10-plus-remux b/tests/ref/fate/matroska-hdr10-plus-remux
index bb0580db33..923fd2a7ab 100644
--- a/tests/ref/fate/matroska-hdr10-plus-remux
+++ b/tests/ref/fate/matroska-hdr10-plus-remux
@@ -1,5 +1,5 @@
-0f941512f69b1cc0ac27f3375e56a0cc *tests/data/fate/matroska-hdr10-plus-remux.matroska
-13892 tests/data/fate/matroska-hdr10-plus-remux.matroska
+299d8f8b5174f9a8747304056d742501 *tests/data/fate/matroska-hdr10-plus-remux.matroska
+13891 tests/data/fate/matroska-hdr10-plus-remux.matroska
 #tb 0: 1/1000
 #media_type 0: video
 #codec_id 0: vp9
@@ -16,7 +16,7 @@ dts_time=0.000000
 duration=40
 duration_time=0.040000
 size=13350
-pos=436
+pos=435
 flags=K__
 [SIDE_DATA]
 side_data_type=HDR10+ Dynamic Metadata (SMPTE 2094-40)
diff --git a/tests/ref/fate/matroska-mastering-display-metadata b/tests/ref/fate/matroska-mastering-display-metadata
index ad36f01e61..3726469213 100644
--- a/tests/ref/fate/matroska-mastering-display-metadata
+++ b/tests/ref/fate/matroska-mastering-display-metadata
@@ -1,5 +1,5 @@
-b3204c8fa6a78037243cc4948a2775ee *tests/data/fate/matroska-mastering-display-metadata.matroska
-1669593 tests/data/fate/matroska-mastering-display-metadata.matroska
+9d0fb8123a2e90e85153428a91d1ee9d *tests/data/fate/matroska-mastering-display-metadata.matroska
+1669589 tests/data/fate/matroska-mastering-display-metadata.matroska
 #extradata 0:        4, 0x040901a3
 #extradata 3:      200, 0x506463a8
 #tb 0: 1/1000
diff --git a/tests/ref/fate/matroska-move-cues-to-front b/tests/ref/fate/matroska-move-cues-to-front
index 79ccc2fd93..1deacaa370 100644
--- a/tests/ref/fate/matroska-move-cues-to-front
+++ b/tests/ref/fate/matroska-move-cues-to-front
@@ -1,5 +1,5 @@
-74a5ed3f0b14112322c8bf3e94d6e98b *tests/data/fate/matroska-move-cues-to-front.matroska
-23210297 tests/data/fate/matroska-move-cues-to-front.matroska
+4ca0bdb5636523c3e43b9dbf692ae21c *tests/data/fate/matroska-move-cues-to-front.matroska
+23210293 tests/data/fate/matroska-move-cues-to-front.matroska
 #tb 0: 1/1000
 #media_type 0: audio
 #codec_id 0: pcm_s24be
diff --git a/tests/ref/fate/matroska-mpegts-remux b/tests/ref/fate/matroska-mpegts-remux
index af41b57af1..c6b7d324b0 100644
--- a/tests/ref/fate/matroska-mpegts-remux
+++ b/tests/ref/fate/matroska-mpegts-remux
@@ -1,5 +1,5 @@
-ca1b91e49b6e238b641007c186d8f424 *tests/data/fate/matroska-mpegts-remux.matroska
-6502 tests/data/fate/matroska-mpegts-remux.matroska
+52e030428110a8c1b74c03c7ad31a6ca *tests/data/fate/matroska-mpegts-remux.matroska
+6500 tests/data/fate/matroska-mpegts-remux.matroska
 #tb 0: 1/1000
 #media_type 0: audio
 #codec_id 0: ac3
diff --git a/tests/ref/fate/matroska-ms-mode b/tests/ref/fate/matroska-ms-mode
index 7ce0f1e4ff..5c91209910 100644
--- a/tests/ref/fate/matroska-ms-mode
+++ b/tests/ref/fate/matroska-ms-mode
@@ -1,5 +1,5 @@
-703d268b966d5dfabe5e22c2de69dc66 *tests/data/fate/matroska-ms-mode.matroska
-413105 tests/data/fate/matroska-ms-mode.matroska
+a2897e3951b0054d0fa31fe51860444f *tests/data/fate/matroska-ms-mode.matroska
+413103 tests/data/fate/matroska-ms-mode.matroska
 #extradata 0:       40, 0x54290c93
 #extradata 1:      114, 0xb6c80771
 #tb 0: 1/1000
diff --git a/tests/ref/fate/matroska-ogg-opus-remux b/tests/ref/fate/matroska-ogg-opus-remux
index cd3eade361..bf6613e257 100644
--- a/tests/ref/fate/matroska-ogg-opus-remux
+++ b/tests/ref/fate/matroska-ogg-opus-remux
@@ -1,5 +1,5 @@
-b602a1a4aaa4fbca4b8aaf39b66d7235 *tests/data/fate/matroska-ogg-opus-remux.matroska
-10204 tests/data/fate/matroska-ogg-opus-remux.matroska
+87d0185c5b780dd9509aafd957236bdd *tests/data/fate/matroska-ogg-opus-remux.matroska
+10203 tests/data/fate/matroska-ogg-opus-remux.matroska
 #extradata 0:       19, 0x399c0471
 #tb 0: 1/1000
 #media_type 0: audio
@@ -57,7 +57,7 @@ dts_time=-0.007000
 duration=20
 duration_time=0.020000
 size=402
-pos=544
+pos=543
 flags=K__
 [/PACKET]
 [PACKET]
@@ -70,7 +70,7 @@ dts_time=0.013000
 duration=20
 duration_time=0.020000
 size=216
-pos=953
+pos=952
 flags=K__
 [/PACKET]
 [PACKET]
@@ -83,7 +83,7 @@ dts_time=0.033000
 duration=20
 duration_time=0.020000
 size=215
-pos=1176
+pos=1175
 flags=K__
 [/PACKET]
 [STREAM]
diff --git a/tests/ref/fate/matroska-opus-remux b/tests/ref/fate/matroska-opus-remux
index 975510e167..9f2526dc57 100644
--- a/tests/ref/fate/matroska-opus-remux
+++ b/tests/ref/fate/matroska-opus-remux
@@ -1,5 +1,5 @@
-fe0258eb0d4b525203ea240c87a154d3 *tests/data/fate/matroska-opus-remux.matroska
-9359 tests/data/fate/matroska-opus-remux.matroska
+b9881205f8945fefc16a6f23474071a6 *tests/data/fate/matroska-opus-remux.matroska
+9358 tests/data/fate/matroska-opus-remux.matroska
 #extradata 0:       19, 0x3a04048f
 #tb 0: 1/1000
 #media_type 0: audio
@@ -68,7 +68,7 @@ dts_time=-0.007000
 duration=20
 duration_time=0.020000
 size=320
-pos=500
+pos=499
 flags=K__
 [/PACKET]
 [PACKET]
@@ -81,7 +81,7 @@ dts_time=0.014000
 duration=20
 duration_time=0.020000
 size=159
-pos=827
+pos=826
 flags=K__
 [/PACKET]
 [PACKET]
@@ -94,7 +94,7 @@ dts_time=0.034000
 duration=20
 duration_time=0.020000
 size=148
-pos=993
+pos=992
 flags=K__
 [/PACKET]
 [STREAM]
diff --git a/tests/ref/fate/matroska-pgs-remux b/tests/ref/fate/matroska-pgs-remux
index a086111495..318cc65ec3 100644
--- a/tests/ref/fate/matroska-pgs-remux
+++ b/tests/ref/fate/matroska-pgs-remux
@@ -1,5 +1,5 @@
-d39daa393d66ae0b0c153be045897585 *tests/data/fate/matroska-pgs-remux.matroska
-49748 tests/data/fate/matroska-pgs-remux.matroska
+b03d39ae755cb07fde023f6e9e6186ce *tests/data/fate/matroska-pgs-remux.matroska
+49747 tests/data/fate/matroska-pgs-remux.matroska
 #tb 0: 1/1000
 #media_type 0: subtitle
 #codec_id 0: hdmv_pgs_subtitle
diff --git a/tests/ref/fate/matroska-pgs-remux-durations b/tests/ref/fate/matroska-pgs-remux-durations
index 37494cd98f..4a07f5edf2 100644
--- a/tests/ref/fate/matroska-pgs-remux-durations
+++ b/tests/ref/fate/matroska-pgs-remux-durations
@@ -1,5 +1,5 @@
-27af80eecea4f15f415f22841bc699d5 *tests/data/fate/matroska-pgs-remux-durations.matroska
-49760 tests/data/fate/matroska-pgs-remux-durations.matroska
+1d8fedf8f90f755f9dd6914489ee8ab2 *tests/data/fate/matroska-pgs-remux-durations.matroska
+49759 tests/data/fate/matroska-pgs-remux-durations.matroska
 #tb 0: 1/1000
 #media_type 0: subtitle
 #codec_id 0: hdmv_pgs_subtitle
diff --git a/tests/ref/fate/matroska-qt-mode b/tests/ref/fate/matroska-qt-mode
index 62a2d82f16..90bbd52bde 100644
--- a/tests/ref/fate/matroska-qt-mode
+++ b/tests/ref/fate/matroska-qt-mode
@@ -1,5 +1,5 @@
-f2eac23e9f7f3a7dac9e2d94885ff4f1 *tests/data/fate/matroska-qt-mode.matroska
-1884243 tests/data/fate/matroska-qt-mode.matroska
+bab6f4122a60a0d4e192fb93c17a5464 *tests/data/fate/matroska-qt-mode.matroska
+1884240 tests/data/fate/matroska-qt-mode.matroska
 #extradata 0:       90, 0x817d0185
 #tb 0: 1/1000
 #media_type 0: video
diff --git a/tests/ref/fate/matroska-spherical-mono-remux b/tests/ref/fate/matroska-spherical-mono-remux
index 0940e3ea86..e9904b2c92 100644
--- a/tests/ref/fate/matroska-spherical-mono-remux
+++ b/tests/ref/fate/matroska-spherical-mono-remux
@@ -1,5 +1,5 @@
-281555d95fca08f3ba103eefa1c22b54 *tests/data/fate/matroska-spherical-mono-remux.matroska
-161584 tests/data/fate/matroska-spherical-mono-remux.matroska
+fddfea5f05a7a9a0d187df9a72900055 *tests/data/fate/matroska-spherical-mono-remux.matroska
+161582 tests/data/fate/matroska-spherical-mono-remux.matroska
 #extradata 0:       43, 0x2b0e0d7b
 #extradata 1:       43, 0x2b0e0d7b
 #tb 0: 1/1000
diff --git a/tests/ref/fate/matroska-vp8-alpha-remux b/tests/ref/fate/matroska-vp8-alpha-remux
index 86024b3477..eba3ffb77a 100644
--- a/tests/ref/fate/matroska-vp8-alpha-remux
+++ b/tests/ref/fate/matroska-vp8-alpha-remux
@@ -1,5 +1,5 @@
-635702724143e90d2a3ec457f65676cf *tests/data/fate/matroska-vp8-alpha-remux.matroska
-235026 tests/data/fate/matroska-vp8-alpha-remux.matroska
+129f76bb3cee967ebd067efa30c4e4f7 *tests/data/fate/matroska-vp8-alpha-remux.matroska
+235025 tests/data/fate/matroska-vp8-alpha-remux.matroska
 #tb 0: 1/1000
 #media_type 0: video
 #codec_id 0: vp8
diff --git a/tests/ref/fate/matroska-zero-length-block b/tests/ref/fate/matroska-zero-length-block
index 3987cc14c4..2affd97067 100644
--- a/tests/ref/fate/matroska-zero-length-block
+++ b/tests/ref/fate/matroska-zero-length-block
@@ -1,5 +1,5 @@
-f577fad2fff41d6e055f605281582b8d *tests/data/fate/matroska-zero-length-block.matroska
-634 tests/data/fate/matroska-zero-length-block.matroska
+451a43f61da7baee559005881d94203e *tests/data/fate/matroska-zero-length-block.matroska
+633 tests/data/fate/matroska-zero-length-block.matroska
 #tb 0: 1/1000
 #media_type 0: subtitle
 #codec_id 0: subrip
diff --git a/tests/ref/fate/rgb24-mkv b/tests/ref/fate/rgb24-mkv
index 484198aaa4..99234f1052 100644
--- a/tests/ref/fate/rgb24-mkv
+++ b/tests/ref/fate/rgb24-mkv
@@ -1,5 +1,5 @@
-4801308890e7a9db51fc13b05f817165 *tests/data/fate/rgb24-mkv.matroska
-58226 tests/data/fate/rgb24-mkv.matroska
+e181dc84058c3584598333dabd110123 *tests/data/fate/rgb24-mkv.matroska
+58225 tests/data/fate/rgb24-mkv.matroska
 #tb 0: 1/10
 #media_type 0: video
 #codec_id 0: rawvideo
diff --git a/tests/ref/fate/shortest-sub b/tests/ref/fate/shortest-sub
index 49e13d65d7..9caee587ce 100644
--- a/tests/ref/fate/shortest-sub
+++ b/tests/ref/fate/shortest-sub
@@ -1,5 +1,5 @@
-2b6e72494d74aaf07380bfe3d50b62d5 *tests/data/fate/shortest-sub.matroska
-139251 tests/data/fate/shortest-sub.matroska
+73d142a80965f9e0884a5863abde0dab *tests/data/fate/shortest-sub.matroska
+139249 tests/data/fate/shortest-sub.matroska
 #extradata 1:      167, 0xf7272d5f
 #tb 0: 1/1000
 #media_type 0: video
diff --git a/tests/ref/fate/webm-av1-extradata-update b/tests/ref/fate/webm-av1-extradata-update
index 68bbb9ad89..3a84511bae 100644
--- a/tests/ref/fate/webm-av1-extradata-update
+++ b/tests/ref/fate/webm-av1-extradata-update
@@ -1,5 +1,5 @@
-fbf3091fdf05b2856c578e7c948d68c3 *tests/data/fate/webm-av1-extradata-update.webm
-23048 tests/data/fate/webm-av1-extradata-update.webm
+dc7593b977b092e522018de7e0d12681 *tests/data/fate/webm-av1-extradata-update.webm
+23047 tests/data/fate/webm-av1-extradata-update.webm
 #extradata 0:       35, 0x527207cd
 #tb 0: 1/1000
 #media_type 0: video
diff --git a/tests/ref/fate/webm-dash-chapters b/tests/ref/fate/webm-dash-chapters
index 9444824c4c..f32e83852f 100644
--- a/tests/ref/fate/webm-dash-chapters
+++ b/tests/ref/fate/webm-dash-chapters
@@ -1,5 +1,5 @@
-aa3ca15fae0239d6bf67fa0658a8bc3b *tests/data/fate/webm-dash-chapters.webm
-111150 tests/data/fate/webm-dash-chapters.webm
+e2d3d812e6d9cf05a36eaefe02801a99 *tests/data/fate/webm-dash-chapters.webm
+111149 tests/data/fate/webm-dash-chapters.webm
 #extradata 0:     3469, 0xc6769ddc
 #tb 0: 1/1000
 #media_type 0: audio
diff --git a/tests/ref/fate/webm-hdr10-plus-remux b/tests/ref/fate/webm-hdr10-plus-remux
index d8dbb93598..04ab55e56f 100644
--- a/tests/ref/fate/webm-hdr10-plus-remux
+++ b/tests/ref/fate/webm-hdr10-plus-remux
@@ -1,5 +1,5 @@
-30923c8d916f5719f62727f24957974f *tests/data/fate/webm-hdr10-plus-remux.webm
-13843 tests/data/fate/webm-hdr10-plus-remux.webm
+7c5ae91189589c07f92aa97cb9b3d9e1 *tests/data/fate/webm-hdr10-plus-remux.webm
+13842 tests/data/fate/webm-hdr10-plus-remux.webm
 #tb 0: 1/1000
 #media_type 0: video
 #codec_id 0: vp9
@@ -16,7 +16,7 @@ dts_time=0.000000
 duration=40
 duration_time=0.040000
 size=13350
-pos=393
+pos=392
 flags=K__
 [SIDE_DATA]
 side_data_type=HDR10+ Dynamic Metadata (SMPTE 2094-40)
diff --git a/tests/ref/fate/webm-webvtt-remux b/tests/ref/fate/webm-webvtt-remux
index 88def03dbe..b247eec894 100644
--- a/tests/ref/fate/webm-webvtt-remux
+++ b/tests/ref/fate/webm-webvtt-remux
@@ -1,5 +1,5 @@
-0b43695bf27bbe48ea44e969d8908e1f *tests/data/fate/webm-webvtt-remux.webm
-6528 tests/data/fate/webm-webvtt-remux.webm
+c372c76c062d368f1d17373c19f83579 *tests/data/fate/webm-webvtt-remux.webm
+6524 tests/data/fate/webm-webvtt-remux.webm
 #tb 0: 1/1000
 #media_type 0: subtitle
 #codec_id 0: webvtt
diff --git a/tests/ref/lavf-fate/av1.mkv b/tests/ref/lavf-fate/av1.mkv
index 685fd70811..84924fe05c 100644
--- a/tests/ref/lavf-fate/av1.mkv
+++ b/tests/ref/lavf-fate/av1.mkv
@@ -1,3 +1,3 @@
-279268e8d6ffcc2299e725a756bbb1a0 *tests/data/lavf-fate/lavf.av1.mkv
-55657 tests/data/lavf-fate/lavf.av1.mkv
+ba198efa114b4db3c9f772728f84978b *tests/data/lavf-fate/lavf.av1.mkv
+55656 tests/data/lavf-fate/lavf.av1.mkv
 tests/data/lavf-fate/lavf.av1.mkv CRC=0x7c27cc15
diff --git a/tests/ref/lavf/mka b/tests/ref/lavf/mka
index 93a0b8f71a..135fade76c 100644
--- a/tests/ref/lavf/mka
+++ b/tests/ref/lavf/mka
@@ -1,3 +1,3 @@
-77db16a9fe1c42a230c85124bfb40cad *tests/data/lavf/lavf.mka
-43573 tests/data/lavf/lavf.mka
+4fede420f36a21bbb3ae4e5d6a884267 *tests/data/lavf/lavf.mka
+43572 tests/data/lavf/lavf.mka
 tests/data/lavf/lavf.mka CRC=0x3a1da17e
diff --git a/tests/ref/lavf/mkv b/tests/ref/lavf/mkv
index 8ddc9cf57f..1b25aea6aa 100644
--- a/tests/ref/lavf/mkv
+++ b/tests/ref/lavf/mkv
@@ -1,3 +1,3 @@
-05889ab61cc6144018c80e50c781fe44 *tests/data/lavf/lavf.mkv
-320428 tests/data/lavf/lavf.mkv
+d5f719b715ad5eb6860c85f0d8202b8e *tests/data/lavf/lavf.mkv
+320426 tests/data/lavf/lavf.mkv
 tests/data/lavf/lavf.mkv CRC=0xec6c3c68
diff --git a/tests/ref/lavf/mkv_attachment b/tests/ref/lavf/mkv_attachment
index 6a08a580d2..3a599c6ed5 100644
--- a/tests/ref/lavf/mkv_attachment
+++ b/tests/ref/lavf/mkv_attachment
@@ -1,3 +1,3 @@
-901b4ba820fe1d6c627ce2a4b31b65af *tests/data/lavf/lavf.mkv_attachment
-472578 tests/data/lavf/lavf.mkv_attachment
+7681b6ece94f20684838bcbba2458c58 *tests/data/lavf/lavf.mkv_attachment
+472576 tests/data/lavf/lavf.mkv_attachment
 tests/data/lavf/lavf.mkv_attachment CRC=0xec6c3c68
diff --git a/tests/ref/seek/lavf-mkv b/tests/ref/seek/lavf-mkv
index 6abdbd6ee7..78c2b13b46 100644
--- a/tests/ref/seek/lavf-mkv
+++ b/tests/ref/seek/lavf-mkv
@@ -1,48 +1,48 @@
-ret: 0         st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos:    676 size:   208
+ret: 0         st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos:    674 size:   208
 ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    892 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    890 size: 27837
 ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292308 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292306 size: 27834
 ret: 0         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292308 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292306 size: 27834
 ret: 0         st: 0 flags:1  ts:-0.317000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    892 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    890 size: 27837
 ret:-1         st: 1 flags:0  ts: 2.577000
 ret: 0         st: 1 flags:1  ts: 1.471000
-ret: 0         st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320149 size:   209
+ret: 0         st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320147 size:   209
 ret: 0         st:-1 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146860 size: 27925
+ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146858 size: 27925
 ret: 0         st:-1 flags:1  ts:-0.740831
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    892 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    890 size: 27837
 ret:-1         st: 0 flags:0  ts: 2.153000
 ret: 0         st: 0 flags:1  ts: 1.048000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292308 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292306 size: 27834
 ret: 0         st: 1 flags:0  ts:-0.058000
-ret: 0         st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos:    676 size:   208
+ret: 0         st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos:    674 size:   208
 ret: 0         st: 1 flags:1  ts: 2.836000
-ret: 0         st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320149 size:   209
+ret: 0         st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320147 size:   209
 ret:-1         st:-1 flags:0  ts: 1.730004
 ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146860 size: 27925
+ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146858 size: 27925
 ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    892 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    890 size: 27837
 ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292308 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292306 size: 27834
 ret:-1         st: 1 flags:0  ts: 1.307000
 ret: 0         st: 1 flags:1  ts: 0.201000
-ret: 0         st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos:    676 size:   208
+ret: 0         st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos:    674 size:   208
 ret: 0         st:-1 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    892 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    890 size: 27837
 ret: 0         st:-1 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292308 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292306 size: 27834
 ret: 0         st: 0 flags:0  ts: 0.883000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292308 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292306 size: 27834
 ret: 0         st: 0 flags:1  ts:-0.222000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    892 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    890 size: 27837
 ret:-1         st: 1 flags:0  ts: 2.672000
 ret: 0         st: 1 flags:1  ts: 1.566000
-ret: 0         st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320149 size:   209
+ret: 0         st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320147 size:   209
 ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146860 size: 27925
+ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146858 size: 27925
 ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    892 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    890 size: 27837
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/5] avformat/matroskaenc: Support rotations
  2023-08-06 23:04 [FFmpeg-devel] [PATCH 1/5] avformat/matroskaenc: Support rotations Andreas Rheinhardt
                   ` (13 preceding siblings ...)
  2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 15/15] avformat/matroskaenc: Don't write \0 unnecessarily Andreas Rheinhardt
@ 2023-08-09  9:26 ` Andreas Rheinhardt
  14 siblings, 0 replies; 17+ messages in thread
From: Andreas Rheinhardt @ 2023-08-09  9:26 UTC (permalink / raw)
  To: ffmpeg-devel

Andreas Rheinhardt:
> Matroska supports orthogonal transformations (both pure rotations
> as well as reflections) via its 3D-projection elements, namely
> ProjectionPoseYaw (for a horizontal reflection) as well as
> ProjectionPoseRoll (for rotations). This commit adds support
> for this.
> 
> Support for this in the demuxer has been added in
> 937bb6bbc1e8654633737e69e403e95a37113058 and
> the sample used in the matroska-dovi-write-config8 FATE-test
> includes a displaymatrix indicating a rotation which is now
> properly written and read, thereby providing coverage for
> the relevant code in the muxer as well as the demuxer.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> Honestly, I am not really sure how to handle the floating-point
> inaccuracies here (in atan2).
> 
>  libavformat/matroskaenc.c                  | 100 +++++++++++++++++----
>  tests/ref/fate/matroska-dovi-write-config8 |  13 ++-
>  2 files changed, 94 insertions(+), 19 deletions(-)
> 
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index 41e13b273d..c1f40b26e6 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -1403,25 +1403,75 @@ static void mkv_write_video_color(EbmlWriter *writer, const AVStream *st,
>  }
>  
>  #define MAX_VIDEO_PROJECTION_ELEMS 6
> -static void mkv_write_video_projection(AVFormatContext *s, EbmlWriter *writer,
> -                                       const AVStream *st, uint8_t private[])
> +static void mkv_handle_rotation(void *logctx, const AVStream *st,
> +                                double *yaw, double *roll)
> +{
> +    const int32_t *matrix =
> +        (const int32_t*)av_stream_get_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, NULL);
> +
> +    if (!matrix)
> +        return;
> +
> +    /* Check whether this is an affine transformation */
> +    if (matrix[2] || matrix[5])
> +        goto ignore;
> +
> +    /* This together with the checks below test whether
> +     * the upper-left 2x2 matrix is nonsingular. */
> +    if (!matrix[0] && !matrix[1])
> +        goto ignore;
> +
> +    /* We ignore the translation part of the matrix (matrix[6] and matrix[7])
> +     * as well as any scaling, i.e. we only look at the upper left 2x2 matrix.
> +     * We only accept matrices that are an exact multiple of an orthogonal one.
> +     * Apart from the multiple, every such matrix can be obtained by
> +     * potentially flipping in the x-direction (corresponding to yaw = 180)
> +     * followed by a rotation of (say) an angle phi in the counterclockwise
> +     * direction. The upper-left 2x2 matrix then looks like this:
> +     *         | (+/-)cos(phi) (-/+)sin(phi) |
> +     * scale * |                             |
> +     *         |      sin(phi)      cos(phi) |
> +     * The first set of signs in the first row apply in case of no flipping,
> +     * the second set applies in case of flipping. */
> +
> +    /* The casts to int64_t are needed because -INT32_MIN doesn't fit
> +     * in an int32_t. */
> +    if (matrix[0] == matrix[4] && -(int64_t)matrix[1] == matrix[3]) {
> +        /* No flipping case */
> +        *yaw = 0;
> +    } else if (-(int64_t)matrix[0] == matrix[4] && matrix[1] == matrix[3]) {
> +        /* Horizontal flip */
> +        *yaw = 180;
> +    } else {
> +ignore:
> +        av_log(logctx, AV_LOG_INFO, "Ignoring display matrix indicating "
> +               "non-orthogonal transformation.\n");
> +        return;
> +    }
> +    *roll = 180 / M_PI * atan2(matrix[3], matrix[4]);
> +
> +    /* We do not write a ProjectionType element indicating "rectangular",
> +     * because this is the default value. */
> +}
> +
> +static int mkv_handle_spherical(void *logctx, EbmlWriter *writer,
> +                                const AVStream *st, uint8_t private[],
> +                                double *yaw, double *pitch, double *roll)
>  {
>      const AVSphericalMapping *spherical =
>          (const AVSphericalMapping *)av_stream_get_side_data(st, AV_PKT_DATA_SPHERICAL,
>                                                              NULL);
>  
>      if (!spherical)
> -        return;
> +        return 0;
>  
>      if (spherical->projection != AV_SPHERICAL_EQUIRECTANGULAR      &&
>          spherical->projection != AV_SPHERICAL_EQUIRECTANGULAR_TILE &&
>          spherical->projection != AV_SPHERICAL_CUBEMAP) {
> -        av_log(s, AV_LOG_WARNING, "Unknown projection type\n");
> -        return;
> +        av_log(logctx, AV_LOG_WARNING, "Unknown projection type\n");
> +        return 0;
>      }
>  
> -    ebml_writer_open_master(writer, MATROSKA_ID_VIDEOPROJECTION);
> -
>      switch (spherical->projection) {
>      case AV_SPHERICAL_EQUIRECTANGULAR:
>      case AV_SPHERICAL_EQUIRECTANGULAR_TILE:
> @@ -1455,17 +1505,33 @@ static void mkv_write_video_projection(AVFormatContext *s, EbmlWriter *writer,
>          av_assert0(0);
>      }
>  
> -    if (spherical->yaw)
> -        ebml_writer_add_float(writer, MATROSKA_ID_VIDEOPROJECTIONPOSEYAW,
> -                              (double) spherical->yaw   / (1 << 16));
> -    if (spherical->pitch)
> -        ebml_writer_add_float(writer, MATROSKA_ID_VIDEOPROJECTIONPOSEPITCH,
> -                       (double) spherical->pitch / (1 << 16));
> -    if (spherical->roll)
> -        ebml_writer_add_float(writer, MATROSKA_ID_VIDEOPROJECTIONPOSEROLL,
> -                       (double) spherical->roll  / (1 << 16));
> +    *yaw   = (double) spherical->yaw   / (1 << 16);
> +    *pitch = (double) spherical->pitch / (1 << 16);
> +    *roll  = (double) spherical->roll  / (1 << 16);
>  
> -    ebml_writer_close_master(writer);
> +    return 1; /* Projection included */
> +}
> +
> +static void mkv_write_video_projection(void *logctx, EbmlWriter *wr,
> +                                       const AVStream *st, uint8_t private[])
> +{
> +    double yaw = 0, pitch = 0, roll = 0;
> +    int ret;
> +
> +    ebml_writer_open_master(wr, MATROSKA_ID_VIDEOPROJECTION);
> +
> +    ret = mkv_handle_spherical(logctx, wr, st, private, &yaw, &pitch, &roll);
> +    if (!ret)
> +        mkv_handle_rotation(logctx, st, &yaw, &roll);
> +
> +    if (yaw)
> +        ebml_writer_add_float(wr, MATROSKA_ID_VIDEOPROJECTIONPOSEYAW, yaw);
> +    if (pitch)
> +        ebml_writer_add_float(wr, MATROSKA_ID_VIDEOPROJECTIONPOSEPITCH, pitch);
> +    if (roll)
> +        ebml_writer_add_float(wr, MATROSKA_ID_VIDEOPROJECTIONPOSEROLL, roll);
> +
> +    ebml_writer_close_or_discard_master(wr);
>  }
>  
>  #define MAX_FIELD_ORDER_ELEMS 2
> diff --git a/tests/ref/fate/matroska-dovi-write-config8 b/tests/ref/fate/matroska-dovi-write-config8
> index bb22563eee..58eb454865 100644
> --- a/tests/ref/fate/matroska-dovi-write-config8
> +++ b/tests/ref/fate/matroska-dovi-write-config8
> @@ -1,5 +1,5 @@
> -09ff3c0a038eec0cdf4773929b24f41a *tests/data/fate/matroska-dovi-write-config8.matroska
> -3600606 tests/data/fate/matroska-dovi-write-config8.matroska
> +80d2b23a6f27ab28b02a907b37b9649c *tests/data/fate/matroska-dovi-write-config8.matroska
> +3600620 tests/data/fate/matroska-dovi-write-config8.matroska
>  #extradata 0:      551, 0xa18acf66
>  #extradata 1:        2, 0x00340022
>  #tb 0: 1/1000
> @@ -46,6 +46,15 @@
>  1,        395,        395,       23,      439, 0x7d85e4c9
>  [STREAM]
>  [SIDE_DATA]
> +side_data_type=Display Matrix
> +displaymatrix=
> +00000000:            0       65536           0
> +00000001:       -65536           0           0
> +00000002:            0           0  1073741824
> +
> +rotation=-90
> +[/SIDE_DATA]
> +[SIDE_DATA]
>  side_data_type=DOVI configuration record
>  dv_version_major=1
>  dv_version_minor=0

Will apply patches 1-5 of this patchset tomorrow unless there are
objections. Notice that I slightly modified the test added in 3/5 to now
also set a creation_time metadata to test a previously untested codepath.

- Andreas

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [FFmpeg-devel] [PATCH 06/15] avformat/matroskaenc: Hoist check out of loop
  2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 06/15] avformat/matroskaenc: Hoist check out of loop Andreas Rheinhardt
@ 2023-08-10  7:48   ` Andreas Rheinhardt
  0 siblings, 0 replies; 17+ messages in thread
From: Andreas Rheinhardt @ 2023-08-10  7:48 UTC (permalink / raw)
  To: ffmpeg-devel

Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavformat/matroskaenc.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index be70e7a6f1..d9bc31daee 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -1877,9 +1877,13 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
>  
>          // look for a codec ID string specific to mkv to use,
>          // if none are found, use AVI codes
> -        if (par->codec_id != AV_CODEC_ID_RAWVIDEO || par->codec_tag) {
> +        if (par->codec_id == AV_CODEC_ID_FFV1) {
> +            /* FFV1 is actually supported natively in Matroska,
> +             * yet we use the VfW way to mux it for compatibility
> +             * with old demuxers. (FIXME: Are they really important?) */
> +        } else if (par->codec_id != AV_CODEC_ID_RAWVIDEO || par->codec_tag) {
>              for (j = 0; ff_mkv_codec_tags[j].id != AV_CODEC_ID_NONE; j++) {
> -                if (ff_mkv_codec_tags[j].id == par->codec_id && par->codec_id != AV_CODEC_ID_FFV1) {
> +                if (ff_mkv_codec_tags[j].id == par->codec_id) {
>                      put_ebml_string(pb, MATROSKA_ID_CODECID, ff_mkv_codec_tags[j].str);
>                      native_id = 1;
>                      break;

Will apply the rest of this patchset tomorrow unless there are objections.

- Andreas

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2023-08-10  7:47 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-06 23:04 [FFmpeg-devel] [PATCH 1/5] avformat/matroskaenc: Support rotations Andreas Rheinhardt
2023-08-06 23:06 ` [FFmpeg-devel] [PATCH 2/5] avformat/matroskaenc: Don't reserve unnecessarily many EBML elements Andreas Rheinhardt
2023-08-06 23:06 ` [FFmpeg-devel] [PATCH 3/5] fate/matroska: Add ALAC remux test Andreas Rheinhardt
2023-08-06 23:06 ` [FFmpeg-devel] [PATCH 4/5] avformat/matroskaenc: Don't pretend to support unsupported codecs Andreas Rheinhardt
2023-08-06 23:06 ` [FFmpeg-devel] [PATCH 5/5] avformat/matroskaenc: Don't pretend to be able to mux RV30 Andreas Rheinhardt
2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 06/15] avformat/matroskaenc: Hoist check out of loop Andreas Rheinhardt
2023-08-10  7:48   ` Andreas Rheinhardt
2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 07/15] avformat/matroskaenc: Remove unnecessary check Andreas Rheinhardt
2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 08/15] avformat/matroskaenc: Use proper AVIOContext Andreas Rheinhardt
2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 09/15] avformat/matroskaenc: Use dedicated pointer for accesses Andreas Rheinhardt
2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 10/15] avformat/matroskaenc: Avoid allocations when writing Dynamic HDR10+ Andreas Rheinhardt
2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 11/15] avformat/dovi_isom: Don't use AVFormatContext* for logctx Andreas Rheinhardt
2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 12/15] avformat/matroskaenc: Add const where appropriate Andreas Rheinhardt
2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 13/15] avformat/matroskaenc: Don't reserve space for HDR10+ when unnecessary Andreas Rheinhardt
2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 14/15] avformat/matroskaenc: Reindent after the previous commit Andreas Rheinhardt
2023-08-08 16:40 ` [FFmpeg-devel] [PATCH 15/15] avformat/matroskaenc: Don't write \0 unnecessarily Andreas Rheinhardt
2023-08-09  9:26 ` [FFmpeg-devel] [PATCH 1/5] avformat/matroskaenc: Support rotations Andreas Rheinhardt

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git