1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avformat/matroskaenc: Don't reserve space for HDR10+ when unnecessary

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 bda44f0f39.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2023-08-08 14:36:45 +02:00
parent a315474a02
commit b5968df9f0
24 changed files with 84 additions and 79 deletions

View File

@ -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);

View File

@ -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

View File

@ -1,5 +1,5 @@
786eb91ba6185c7c42522751cadef331 *tests/data/fate/matroska-alac-remux.matroska
1293836 tests/data/fate/matroska-alac-remux.matroska
656e98610de00f73167a4e02a68cf51c *tests/data/fate/matroska-alac-remux.matroska
1293825 tests/data/fate/matroska-alac-remux.matroska
#extradata 0: 36, 0x562b05d8
#tb 0: 1/1000
#media_type 0: audio

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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]

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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]

View File

@ -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]

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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