diff options
Diffstat (limited to 'src/lib/subrip_decoder.cc')
| -rw-r--r-- | src/lib/subrip_decoder.cc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/lib/subrip_decoder.cc b/src/lib/subrip_decoder.cc index c2bd4f3e0..6542c1a8e 100644 --- a/src/lib/subrip_decoder.cc +++ b/src/lib/subrip_decoder.cc @@ -82,7 +82,8 @@ SubRipDecoder::pass () } } - text_subtitle (out); + text_subtitle (content_time_period (_subtitles[_next]), out); + ++_next; return false; } @@ -101,12 +102,7 @@ SubRipDecoder::text_subtitles_during (ContentTimePeriod p, bool starting) const list<ContentTimePeriod> d; for (vector<sub::Subtitle>::const_iterator i = _subtitles.begin(); i != _subtitles.end(); ++i) { - - ContentTimePeriod t ( - ContentTime::from_seconds (i->from.all_as_seconds()), - ContentTime::from_seconds (i->to.all_as_seconds()) - ); - + ContentTimePeriod t = content_time_period (*i); if ((starting && p.contains (t.from)) || (!starting && p.overlaps (t))) { d.push_back (t); } @@ -114,3 +110,12 @@ SubRipDecoder::text_subtitles_during (ContentTimePeriod p, bool starting) const return d; } + +ContentTimePeriod +SubRipDecoder::content_time_period (sub::Subtitle s) const +{ + return ContentTimePeriod ( + ContentTime::from_seconds (s.from.all_as_seconds()), + ContentTime::from_seconds (s.to.all_as_seconds()) + ); +} |
