MP4 reader: fix constant offset edit list type detection

An edit list with two entries where the first entry's media time is -1
means that a fixed offset must be applied to the timestamps. This is
independent of the segment_duration value of the second edit list entry.

Fixes #1547.
This commit is contained in:
Moritz Bunkus 2015-12-28 18:45:59 +01:00
parent cb0e958eb6
commit 6fb6e16aa7
4 changed files with 13 additions and 2 deletions

View File

@ -15,6 +15,11 @@
2015-12-28 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: bug fix: MP4 edit lists of certain types (two entries,
first entry's media_time is -1, second entry's segment_duration is
!= 0) weren't handled properly resulting in key frame flags being
assigned to the wrong frames. Fixes #1547.
* mkvmerge: bug fix: the h.265/HEVC code was writing SEI NALUs
twice. This had already been mentioned in #1076 but never
fixed. Patch by Vladimír Pilný.

View File

@ -2207,8 +2207,8 @@ qtmp4_demuxer_c::update_editlist_table() {
raw_offset = editlist_table[0].media_time;
constant_editlist_offset_ns = (-editlist_table[0].media_time + (frame_offset_table.empty() ? 0 : frame_offset_table[0])) * 1000000000ll / time_scale;
} else if ((editlist_table.size() == 2) && (-1 == editlist_table[0].media_time) && (0 == editlist_table[1].media_time)) {
mxdebug_if(m_debug_editlists, boost::format("Track ID %1%: Edit list analysis: type 3: two entries; first with time == -1, second zero time\n") % id);
} else if ((editlist_table.size() == 2) && (-1 == editlist_table[0].media_time)) {
mxdebug_if(m_debug_editlists, boost::format("Track ID %1%: Edit list analysis: type 3: two entries; first with time == -1\n") % id);
simple_editlist_type = 3;
raw_offset = editlist_table[0].segment_duration;
constant_editlist_offset_ns = (editlist_table[0].segment_duration * 1000000000ll / global_time_scale) - ((frame_offset_table.empty() ? 0 : frame_offset_table[0]) * 1000000000ll / time_scale);

View File

@ -366,3 +366,4 @@ T_517h264_forbidden_byte_sequence_in_slice_nalu:74e0fb1a25397078335c6d94974dc168
T_518mlp:bc0269df9e0c0c968e4a408d7da46d35-0624d3f1975273199a0e12a9f4b0fd20:passed:20151229-134422:0.895368448
T_519truehd:33f8c0f013c71529281179cf8669c567-33f8c0f013c71529281179cf8669c567:passed:20151229-135950:3.160459472
T_520truehd_mlp_atmos_detection:790fe7a0cca6dfe0f4439fb36afd9d40+true-dc4a06c661033cb21e70bb25b661130a+true-565bc55dc9b15f81064785367040a978+true-93866c2e47b7aa3b8cf2483e8beb09ac+true-39d23fdc03248412b4bd364e51e4cf23+true-b41aaef4bd7e736256ff497be64e1e1f+true:passed:20151229-160649:5.913862696
T_521mp4_edit_list_constant_offset_with_segment_duration_not_0:bbd7a6660a2a5325a67470a91208b643:passed:20151228-185646:0.621563048

View File

@ -0,0 +1,5 @@
#!/usr/bin/ruby -w
# T_521mp4_edit_list_constant_offset_with_segment_duration_not_0
describe "mkvmerge / MP4, edit list with two entries, first's media_time == -1, second's segment_duration != 0"
test_merge "data/mp4/edit_list_constant_offset_segment_duration_not_0.mp4", :args => "--no-audio"