forked from mia/Aegisub
Add a bit of sanity checking to FractionalTime.
Originally committed to SVN as r2936.
This commit is contained in:
parent
1520e51dd0
commit
a3cd374bc0
1 changed files with 6 additions and 0 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue