mirror of https://github.com/odrling/Aegisub
VFR fix number 256 151 623 360
Originally committed to SVN as r298.
This commit is contained in:
parent
454297253c
commit
72299b508c
10
core/vfr.cpp
10
core/vfr.cpp
|
@ -277,8 +277,13 @@ int FrameRate::PFrameAtTime(int ms,bool useceil) {
|
||||||
|
|
||||||
// Get for variable frame rate
|
// Get for variable frame rate
|
||||||
else if (FrameRateType == VFR) {
|
else if (FrameRateType == VFR) {
|
||||||
|
// Get last
|
||||||
|
double trueLast;
|
||||||
|
if (useceil) trueLast = ceil(last_time);
|
||||||
|
else trueLast = floor(last_time);
|
||||||
|
|
||||||
// Inside VFR range
|
// Inside VFR range
|
||||||
if (ms < floor(last_time)) {
|
if (ms < trueLast) {
|
||||||
// Prepare binary search
|
// Prepare binary search
|
||||||
size_t start = 0;
|
size_t start = 0;
|
||||||
size_t end = last_frame;
|
size_t end = last_frame;
|
||||||
|
@ -308,7 +313,8 @@ int FrameRate::PFrameAtTime(int ms,bool useceil) {
|
||||||
|
|
||||||
// After VFR range
|
// After VFR range
|
||||||
else {
|
else {
|
||||||
return last_frame + floor((ms-last_time) * AverageFrameRate / 1000);
|
if (useceil) return last_frame + ceil((ms-last_time) * AverageFrameRate / 1000);
|
||||||
|
else return last_frame + floor((ms-last_time) * AverageFrameRate / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue