|
|
@ -458,7 +458,7 @@ fn transform_subtitles<'a>(mut lines : Box<dyn SubsInput + 'a>, mut outfile : Bo |
|
|
|
AutoMoveTag::ByIndex(idx, ref vidt) => { |
|
|
|
AutoMoveTag::ByIndex(idx, ref vidt) => { |
|
|
|
if num >= *idx { |
|
|
|
if num >= *idx { |
|
|
|
let dif = *vidt - would_be_shifted_start; |
|
|
|
let dif = *vidt - would_be_shifted_start; |
|
|
|
debug!("Move by index #{} starts at #{} ({}) -> {}, diff {}", *idx, num, subtitle.start, *vidt, dif); |
|
|
|
debug!("Move by index #{} starts at #{} ({}), diff {}, -M{}={}", *idx, num, subtitle.start, dif, would_be_shifted_start, *vidt); |
|
|
|
opts.shift += dif; |
|
|
|
opts.shift += dif; |
|
|
|
to_drop.push(i); |
|
|
|
to_drop.push(i); |
|
|
|
} else if would_be_shifted_start > *vidt { |
|
|
|
} else if would_be_shifted_start > *vidt { |
|
|
@ -467,9 +467,9 @@ fn transform_subtitles<'a>(mut lines : Box<dyn SubsInput + 'a>, mut outfile : Bo |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
AutoMoveTag::ByTime(ref subt, ref vidt) => { |
|
|
|
AutoMoveTag::ByTime(ref subt, ref vidt) => { |
|
|
|
if would_be_shifted_start >= *subt { |
|
|
|
if would_be_shifted_start >= (*subt - 0.1f64) { // margin
|
|
|
|
let dif = *vidt - *subt; |
|
|
|
let dif = *vidt - *subt; |
|
|
|
debug!("Move by time {} starts at #{} ({}) -> {}, diff {}", subt, num, subtitle.start, *vidt, dif); |
|
|
|
debug!("Move by time {} starts at #{} ({}), diff {}, -M{}={}", subt, num, subtitle.start, dif, subt, *vidt); |
|
|
|
opts.shift += dif; |
|
|
|
opts.shift += dif; |
|
|
|
to_drop.push(i); |
|
|
|
to_drop.push(i); |
|
|
|
} |
|
|
|
} |
|
|
@ -611,6 +611,14 @@ impl Sub<SubInstant> for SubInstant { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl Sub<f64> for SubInstant { |
|
|
|
|
|
|
|
type Output = SubInstant; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn sub(self, rhs: f64) -> Self::Output { |
|
|
|
|
|
|
|
SubInstant(self.0 - rhs) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl Mul<f64> for SubDuration { |
|
|
|
impl Mul<f64> for SubDuration { |
|
|
|
type Output = SubDuration; |
|
|
|
type Output = SubDuration; |
|
|
|
|
|
|
|
|
|
|
|