Prevent times from rounding to the magic zero in the framerate transform. Updates #1007.

Originally committed to SVN as r3839.
This commit is contained in:
Thomas Goyne 2009-12-01 01:56:06 +00:00
parent 4a31f0375f
commit a1f3fb7dc0
1 changed files with 6 additions and 4 deletions

View File

@ -200,16 +200,12 @@ void AssTransformFramerateFilter::TransformTimeTags (wxString name,int n,AssOver
int value;
switch (curParam->classification) {
case PARCLASS_RELATIVE_TIME_START:
start = true;
mult = 1;
break;
case PARCLASS_RELATIVE_TIME_END:
start = false;
mult = 1;
break;
case PARCLASS_KARAOKE:
karaoke = true;
start = true;
mult = 10;
break;
default:
@ -244,6 +240,11 @@ void AssTransformFramerateFilter::TransformTimeTags (wxString name,int n,AssOver
int newStart = instance.Input->GetTimeAtFrame(instance.Output->GetFrameAtTime(curDiag->Start.GetMS()));
int absTime = curDiag->Start.GetMS() + parVal;
value = instance.Input->GetTimeAtFrame(instance.Output->GetFrameAtTime(absTime)) - newStart;
// An end time of 0 is actually the end time of the line, so ensure nonzero is never converted to 0
// Needed in the start case as well as the end one due to \t, whose end time needs the start time
// behavior
if (value == 0 && parVal != 0) value = 1;
}
// End time
@ -251,6 +252,7 @@ void AssTransformFramerateFilter::TransformTimeTags (wxString name,int n,AssOver
int newEnd = instance.Input->GetTimeAtFrame(instance.Output->GetFrameAtTime(curDiag->End.GetMS()));
int absTime = curDiag->End.GetMS() - parVal;
value = newEnd - instance.Input->GetTimeAtFrame(instance.Output->GetFrameAtTime(absTime));
if (value == 0 && parVal != 0) value = 1;
}
// Karaoke postprocess