13
0

fix TC entry beyond 2^31 frames.

This commit is contained in:
Robin Gareus 2014-07-10 19:06:52 +02:00
parent a3b704b8c0
commit 6157c685d9

View File

@ -776,31 +776,31 @@ AudioClock::parse_as_timecode_distance (const std::string& str)
case 1: case 1:
case 2: case 2:
sscanf (str.c_str(), "%" PRId32, &frames); sscanf (str.c_str(), "%" PRId32, &frames);
return lrint ((frames/(float)fps) * sr); return llrint ((frames/(float)fps) * sr);
case 3: case 3:
sscanf (str.c_str(), "%1" PRId32 "%" PRId32, &secs, &frames); sscanf (str.c_str(), "%1" PRId32 "%" PRId32, &secs, &frames);
return (secs * sr) + lrint ((frames/(float)fps) * sr); return (secs * sr) + llrint ((frames/(float)fps) * sr);
case 4: case 4:
sscanf (str.c_str(), "%2" PRId32 "%" PRId32, &secs, &frames); sscanf (str.c_str(), "%2" PRId32 "%" PRId32, &secs, &frames);
return (secs * sr) + lrint ((frames/(float)fps) * sr); return (secs * sr) + llrint ((frames/(float)fps) * sr);
case 5: case 5:
sscanf (str.c_str(), "%1" PRId32 "%2" PRId32 "%" PRId32, &mins, &secs, &frames); sscanf (str.c_str(), "%1" PRId32 "%2" PRId32 "%" PRId32, &mins, &secs, &frames);
return (mins * 60 * sr) + (secs * sr) + lrint ((frames/(float)fps) * sr); return (mins * 60 * sr) + (secs * sr) + llrint ((frames/(float)fps) * sr);
case 6: case 6:
sscanf (str.c_str(), "%2" PRId32 "%2" PRId32 "%" PRId32, &mins, &secs, &frames); sscanf (str.c_str(), "%2" PRId32 "%2" PRId32 "%" PRId32, &mins, &secs, &frames);
return (mins * 60 * sr) + (secs * sr) + lrint ((frames/(float)fps) * sr); return (mins * 60 * sr) + (secs * sr) + llrint ((frames/(float)fps) * sr);
case 7: case 7:
sscanf (str.c_str(), "%1" PRId32 "%2" PRId32 "%2" PRId32 "%" PRId32, &hrs, &mins, &secs, &frames); sscanf (str.c_str(), "%1" PRId32 "%2" PRId32 "%2" PRId32 "%" PRId32, &hrs, &mins, &secs, &frames);
return (hrs * 3600 * sr) + (mins * 60 * sr) + (secs * sr) + lrint ((frames/(float)fps) * sr); return (hrs * 3600 * sr) + (mins * 60 * sr) + (secs * sr) + llrint ((frames/(float)fps) * sr);
case 8: case 8:
sscanf (str.c_str(), "%2" PRId32 "%2" PRId32 "%2" PRId32 "%" PRId32, &hrs, &mins, &secs, &frames); sscanf (str.c_str(), "%2" PRId32 "%2" PRId32 "%2" PRId32 "%" PRId32, &hrs, &mins, &secs, &frames);
return (hrs * 3600 * sr) + (mins * 60 * sr) + (secs * sr) + lrint ((frames/(float)fps) * sr); return (hrs * 3600 * sr) + (mins * 60 * sr) + (secs * sr) + llrint ((frames/(float)fps) * sr);
default: default:
break; break;