Add a bit of sanity checking to FractionalTime.

Originally committed to SVN as r2936.
This commit is contained in:
Karl Blomster 2009-05-15 12:18:33 +00:00
parent 3011ade060
commit 5e214986e1
1 changed files with 6 additions and 0 deletions

View File

@ -393,6 +393,11 @@ wxString FractionalTime::FromAssTime(AssTime time) {
// Milliseconds to SMPTE text string conversion // Milliseconds to SMPTE text string conversion
wxString FractionalTime::FromMillisecs(int64_t msec) { wxString FractionalTime::FromMillisecs(int64_t msec) {
int h=0, m=0, s=0, f=0; // hours, minutes, seconds, fractions int h=0, m=0, s=0, f=0; // hours, minutes, seconds, fractions
// return 00:00:00:00
if (msec <= 0)
goto RETURN;
int fn = (msec*(int64_t)num) / (1000*den); // frame number int fn = (msec*(int64_t)num) / (1000*den); // frame number
// dropframe? // dropframe?
@ -435,5 +440,6 @@ wxString FractionalTime::FromMillisecs(int64_t msec) {
f = fn; f = fn;
} }
RETURN:
return wxString::Format(_T("%02i") + sep + _T("%02i") + sep + _T("%02i") + sep + _T("%02i"),h,m,s,f); return wxString::Format(_T("%02i") + sep + _T("%02i") + sep + _T("%02i") + sep + _T("%02i"),h,m,s,f);
} }