mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-24 11:54:01 +00:00
Output a warning if a v2 timecode file contains non-sorted timecodes.
This commit is contained in:
parent
fcb91df81c
commit
0e39483664
@ -199,13 +199,15 @@ void
|
|||||||
timecode_factory_v2_c::parse(mm_io_c &in) {
|
timecode_factory_v2_c::parse(mm_io_c &in) {
|
||||||
int line_no;
|
int line_no;
|
||||||
string line;
|
string line;
|
||||||
double timecode;
|
double timecode, previous_timecode;
|
||||||
map<int64_t, int64_t> dur_map;
|
map<int64_t, int64_t> dur_map;
|
||||||
map<int64_t, int64_t>::const_iterator it;
|
map<int64_t, int64_t>::const_iterator it;
|
||||||
int64_t duration, dur_sum;
|
int64_t duration, dur_sum;
|
||||||
|
bool warning_printed = false;
|
||||||
|
|
||||||
dur_sum = 0;
|
dur_sum = 0;
|
||||||
line_no = 0;
|
line_no = 0;
|
||||||
|
previous_timecode = 0;
|
||||||
while (in.getline2(line)) {
|
while (in.getline2(line)) {
|
||||||
line_no++;
|
line_no++;
|
||||||
strip(line);
|
strip(line);
|
||||||
@ -214,6 +216,21 @@ timecode_factory_v2_c::parse(mm_io_c &in) {
|
|||||||
if (!parse_double(line.c_str(), timecode))
|
if (!parse_double(line.c_str(), timecode))
|
||||||
mxerror(_("The line %d of the timecode file '%s' does not contain a "
|
mxerror(_("The line %d of the timecode file '%s' does not contain a "
|
||||||
"valid floating point number.\n"), line_no, file_name.c_str());
|
"valid floating point number.\n"), line_no, file_name.c_str());
|
||||||
|
if ((timecode < previous_timecode) && !warning_printed) {
|
||||||
|
mxwarn("The timecode v2 file '%s' contains timecodes that are not "
|
||||||
|
"ordered. Due to a bug in mkvmerge versions up to and including "
|
||||||
|
"v1.5.0 this was necessary if the track to which the timecode "
|
||||||
|
"file was applied contained B frames. Starting with v1.5.1 "
|
||||||
|
"mkvmerge now handles this correctly, and the timecodes in the "
|
||||||
|
"timecode file must be ordered normally. For example, the frame "
|
||||||
|
"sequence 'IPBBP...' at 25 FPS requires a timecode file with "
|
||||||
|
"the first timecodes being '0', '40', '80', '120' etc and not "
|
||||||
|
"'0', '120', '40', '80' etc. The current file will most "
|
||||||
|
"likely not work how you expect it to.\n",
|
||||||
|
in.get_file_name().c_str());
|
||||||
|
warning_printed = true;
|
||||||
|
}
|
||||||
|
previous_timecode = timecode;
|
||||||
timecodes.push_back((int64_t)(timecode * 1000000));
|
timecodes.push_back((int64_t)(timecode * 1000000));
|
||||||
if (timecodes.size() > 1) {
|
if (timecodes.size() > 1) {
|
||||||
duration = timecodes[timecodes.size() - 1] -
|
duration = timecodes[timecodes.size() - 1] -
|
||||||
|
Loading…
Reference in New Issue
Block a user