mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
avformat/matroskaenc: write a CRC32 element on SeekHead
Implements part of ticket #4347 Tested-by: Dave Rice <dave@dericed.com> Tested-by: Jerome Martinez <jerome@mediaarea.net> Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
6724525a15
commit
3b189fae73
@ -391,9 +391,9 @@ static mkv_seekhead *mkv_start_seekhead(AVIOContext *pb, int64_t segment_offset,
|
||||
if (numelements > 0) {
|
||||
new_seekhead->filepos = avio_tell(pb);
|
||||
// 21 bytes max for a seek entry, 10 bytes max for the SeekHead ID
|
||||
// and size, and 3 bytes to guarantee that an EBML void element
|
||||
// will fit afterwards
|
||||
new_seekhead->reserved_size = numelements * MAX_SEEKENTRY_SIZE + 13;
|
||||
// and size, 6 bytes for a CRC32 element, and 3 bytes to guarantee
|
||||
// that an EBML void element will fit afterwards
|
||||
new_seekhead->reserved_size = numelements * MAX_SEEKENTRY_SIZE + 19;
|
||||
new_seekhead->max_entries = numelements;
|
||||
put_ebml_void(pb, new_seekhead->reserved_size);
|
||||
}
|
||||
@ -430,6 +430,7 @@ static int mkv_add_seekhead_entry(mkv_seekhead *seekhead, unsigned int elementid
|
||||
*/
|
||||
static int64_t mkv_write_seekhead(AVIOContext *pb, MatroskaMuxContext *mkv)
|
||||
{
|
||||
AVIOContext *dyn_cp;
|
||||
mkv_seekhead *seekhead = mkv->main_seekhead;
|
||||
ebml_master metaseek, seekentry;
|
||||
int64_t currentpos;
|
||||
@ -444,20 +445,25 @@ static int64_t mkv_write_seekhead(AVIOContext *pb, MatroskaMuxContext *mkv)
|
||||
}
|
||||
}
|
||||
|
||||
metaseek = start_ebml_master(pb, MATROSKA_ID_SEEKHEAD, seekhead->reserved_size);
|
||||
if (start_ebml_master_crc32(pb, &dyn_cp, &metaseek, MATROSKA_ID_SEEKHEAD,
|
||||
seekhead->reserved_size) < 0) {
|
||||
currentpos = -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
for (i = 0; i < seekhead->num_entries; i++) {
|
||||
mkv_seekhead_entry *entry = &seekhead->entries[i];
|
||||
|
||||
seekentry = start_ebml_master(pb, MATROSKA_ID_SEEKENTRY, MAX_SEEKENTRY_SIZE);
|
||||
seekentry = start_ebml_master(dyn_cp, MATROSKA_ID_SEEKENTRY, MAX_SEEKENTRY_SIZE);
|
||||
|
||||
put_ebml_id(pb, MATROSKA_ID_SEEKID);
|
||||
put_ebml_num(pb, ebml_id_size(entry->elementid), 0);
|
||||
put_ebml_id(pb, entry->elementid);
|
||||
put_ebml_id(dyn_cp, MATROSKA_ID_SEEKID);
|
||||
put_ebml_num(dyn_cp, ebml_id_size(entry->elementid), 0);
|
||||
put_ebml_id(dyn_cp, entry->elementid);
|
||||
|
||||
put_ebml_uint(pb, MATROSKA_ID_SEEKPOSITION, entry->segmentpos);
|
||||
end_ebml_master(pb, seekentry);
|
||||
put_ebml_uint(dyn_cp, MATROSKA_ID_SEEKPOSITION, entry->segmentpos);
|
||||
end_ebml_master(dyn_cp, seekentry);
|
||||
}
|
||||
end_ebml_master(pb, metaseek);
|
||||
end_ebml_master_crc32(pb, &dyn_cp, mkv, metaseek);
|
||||
|
||||
if (seekhead->reserved_size > 0) {
|
||||
uint64_t remaining = seekhead->filepos + seekhead->reserved_size - avio_tell(pb);
|
||||
|
@ -4,6 +4,6 @@
|
||||
FATE_MATROSKA-$(call DEMMUX, MATROSKA, MATROSKA) += fate-matroska-remux
|
||||
fate-matroska-remux: CMD = md5 -i $(TARGET_SAMPLES)/vp9-test-vectors/vp90-2-2pass-akiyo.webm -color_trc 4 -c:v copy -fflags +bitexact -strict -2 -f matroska
|
||||
fate-matroska-remux: CMP = oneline
|
||||
fate-matroska-remux: REF = 1040692ffdfee2428954af79a7d5d155
|
||||
fate-matroska-remux: REF = d1a5fc15908ba10ca3efa282059ca79f
|
||||
|
||||
FATE_SAMPLES_AVCONV += $(FATE_MATROSKA-yes)
|
||||
|
@ -91,12 +91,12 @@ fate-wavpack-matroskamode: CMD = md5 -i $(TARGET_SAMPLES)/wavpack/special/matros
|
||||
FATE_WAVPACK-$(call DEMMUX, WV, MATROSKA) += fate-wavpack-matroska_mux-mono
|
||||
fate-wavpack-matroska_mux-mono: CMD = md5 -i $(TARGET_SAMPLES)/wavpack/num_channels/mono_16bit_int.wv -c copy -fflags +bitexact -f matroska
|
||||
fate-wavpack-matroska_mux-mono: CMP = oneline
|
||||
fate-wavpack-matroska_mux-mono: REF = a2987e2e51e01a35e47e7da13eb47a35
|
||||
fate-wavpack-matroska_mux-mono: REF = 11773e2a518edc788475f3880d849230
|
||||
|
||||
FATE_WAVPACK-$(call DEMMUX, WV, MATROSKA) += fate-wavpack-matroska_mux-61
|
||||
fate-wavpack-matroska_mux-61: CMD = md5 -i $(TARGET_SAMPLES)/wavpack/num_channels/eva_2.22_6.1_16bit-partial.wv -c copy -fflags +bitexact -f matroska
|
||||
fate-wavpack-matroska_mux-61: CMP = oneline
|
||||
fate-wavpack-matroska_mux-61: REF = ffba4ddea1ba71f7a5901d9ed1a267be
|
||||
fate-wavpack-matroska_mux-61: REF = 9641abdf596c10c2e21bd9b026d4bade
|
||||
|
||||
FATE_SAMPLES_AVCONV += $(FATE_WAVPACK-yes)
|
||||
fate-wavpack: $(FATE_WAVPACK-yes)
|
||||
|
@ -1 +1 @@
|
||||
2dad5f63688ec613a04e94c8d4d167db
|
||||
f80f42e646fce972e73aa6d99dcfa470
|
||||
|
@ -1,5 +1,5 @@
|
||||
7761f59d660edcc835a1186cc3875332 *tests/data/fate/rgb24-mkv.matroska
|
||||
58327 tests/data/fate/rgb24-mkv.matroska
|
||||
0c30c5b33b33c7cf49c4b76e799317e0 *tests/data/fate/rgb24-mkv.matroska
|
||||
58333 tests/data/fate/rgb24-mkv.matroska
|
||||
#tb 0: 1/10
|
||||
#media_type 0: video
|
||||
#codec_id 0: rawvideo
|
||||
|
@ -1,3 +1,3 @@
|
||||
56dab37c9f48bf0f9f16cfed8f1f6c17 *./tests/data/lavf/lavf.mka
|
||||
43660 ./tests/data/lavf/lavf.mka
|
||||
57d2f97a7c4d13c97212cb0f76f72e10 *./tests/data/lavf/lavf.mka
|
||||
43666 ./tests/data/lavf/lavf.mka
|
||||
./tests/data/lavf/lavf.mka CRC=0x3a1da17e
|
||||
|
@ -1,6 +1,6 @@
|
||||
0c2b156a749ef4fd22cef29685d6b058 *./tests/data/lavf/lavf.mkv
|
||||
472893 ./tests/data/lavf/lavf.mkv
|
||||
b637cf946d049b62ffad79b4d4699ea5 *./tests/data/lavf/lavf.mkv
|
||||
472899 ./tests/data/lavf/lavf.mkv
|
||||
./tests/data/lavf/lavf.mkv CRC=0xec6c3c68
|
||||
cf768eb8de3dccc6cf8c4a281e600edc *./tests/data/lavf/lavf.mkv
|
||||
320569 ./tests/data/lavf/lavf.mkv
|
||||
76894898a210a0c060f6b988e6c34bc8 *./tests/data/lavf/lavf.mkv
|
||||
320575 ./tests/data/lavf/lavf.mkv
|
||||
./tests/data/lavf/lavf.mkv CRC=0xec6c3c68
|
||||
|
@ -1,48 +1,48 @@
|
||||
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 806 size: 208
|
||||
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 812 size: 208
|
||||
ret: 0 st:-1 flags:0 ts:-1.000000
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 1022 size: 27837
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 1028 size: 27837
|
||||
ret: 0 st:-1 flags:1 ts: 1.894167
|
||||
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292448 size: 27834
|
||||
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292454 size: 27834
|
||||
ret: 0 st: 0 flags:0 ts: 0.788000
|
||||
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292448 size: 27834
|
||||
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292454 size: 27834
|
||||
ret: 0 st: 0 flags:1 ts:-0.317000
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 1022 size: 27837
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 1028 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.993000 pts: 0.993000 pos: 320289 size: 209
|
||||
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 320295 size: 209
|
||||
ret: 0 st:-1 flags:0 ts: 0.365002
|
||||
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146995 size: 27925
|
||||
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 147001 size: 27925
|
||||
ret: 0 st:-1 flags:1 ts:-0.740831
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 1022 size: 27837
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 1028 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.971000 pts: 0.971000 pos: 292448 size: 27834
|
||||
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292454 size: 27834
|
||||
ret: 0 st: 1 flags:0 ts:-0.058000
|
||||
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 806 size: 208
|
||||
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 812 size: 208
|
||||
ret: 0 st: 1 flags:1 ts: 2.836000
|
||||
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 320289 size: 209
|
||||
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 320295 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.491000 pts: 0.491000 pos: 146995 size: 27925
|
||||
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 147001 size: 27925
|
||||
ret: 0 st: 0 flags:0 ts:-0.482000
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 1022 size: 27837
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 1028 size: 27837
|
||||
ret: 0 st: 0 flags:1 ts: 2.413000
|
||||
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292448 size: 27834
|
||||
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292454 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.000000 pts: 0.000000 pos: 806 size: 208
|
||||
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 812 size: 208
|
||||
ret: 0 st:-1 flags:0 ts:-0.904994
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 1022 size: 27837
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 1028 size: 27837
|
||||
ret: 0 st:-1 flags:1 ts: 1.989173
|
||||
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292448 size: 27834
|
||||
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292454 size: 27834
|
||||
ret: 0 st: 0 flags:0 ts: 0.883000
|
||||
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292448 size: 27834
|
||||
ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292454 size: 27834
|
||||
ret: 0 st: 0 flags:1 ts:-0.222000
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 1022 size: 27837
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 1028 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.993000 pts: 0.993000 pos: 320289 size: 209
|
||||
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 320295 size: 209
|
||||
ret: 0 st:-1 flags:0 ts: 0.460008
|
||||
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146995 size: 27925
|
||||
ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 147001 size: 27925
|
||||
ret: 0 st:-1 flags:1 ts:-0.645825
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 1022 size: 27837
|
||||
ret: 0 st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos: 1028 size: 27837
|
||||
|
Loading…
x
Reference in New Issue
Block a user