From aa99dd50f5d3a5a8b2d8c794422d484e175ce2ba Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 17 May 2018 11:45:10 +0200 Subject: [PATCH] MP4 reader: improve test for identical edit list entries In #2306 a file was provided with an edit list consisting of two identical entries that span the whole duration of the file as given by the file headers. The difference to earlier provided files is that the edits don't start at 0 but slightly later. Therefore a check for "starting at 0" seems counterproductive. Fixes #2306. --- NEWS.md | 3 +++ src/input/r_qtmp4.cpp | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index 4ef4f0638..fe29acac7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,6 +6,9 @@ extraction as other tools such as MP4Box cannot handle them correctly. Implements #2293. * mkvmerge, mkvextract: AVC/h.264: empty NALUs will now be removed. +* mkvmerge: MP4 reader: improved the detection of edit lists consisting of two + identical entries, each spanning the file's duration as given in the movie + header atom. The second entry is ignored in such cases. See #2306. ## Bug fixes diff --git a/src/input/r_qtmp4.cpp b/src/input/r_qtmp4.cpp index 7344ec626..dda999d2c 100644 --- a/src/input/r_qtmp4.cpp +++ b/src/input/r_qtmp4.cpp @@ -2451,10 +2451,9 @@ qtmp4_demuxer_c::apply_edit_list() { edit.segment_duration = 0; mxdebug_if(m_debug_editlists, boost::format(" %1%: single edit with positive media_time; track start offset %2%; change to non-edit to copy the rest\n") % info % format_timestamp(timeline_cts)); - } else if ( (num_edits == 2) - && (entry_index == 2) - && (edit == editlist_table.front()) - && (edit.media_time == 0) + } else if ( (num_edits == 2) + && (entry_index == 2) + && (edit == editlist_table.front()) && m_reader.m_duration && ((timeline_cts - static_cast(*m_reader.m_duration)) >= timestamp_c::s(-60).to_ns())) { mxdebug_if(m_debug_editlists,