diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-03-04 20:22:47 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-03-04 20:22:47 +0000 |
| commit | 1b1bc528ee5ca1fee1bd33f9fb6f79cd551e3b33 (patch) | |
| tree | d60b9fb573dd8d6ab89036fb8788cd1b1c69aada /src/lib/subrip.cc | |
| parent | 6d8bcba724be622739a749064466901486304cee (diff) | |
New DCPTime/ContentTime types.
Diffstat (limited to 'src/lib/subrip.cc')
| -rw-r--r-- | src/lib/subrip.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/subrip.cc b/src/lib/subrip.cc index 380a2ce2c..3eac98e63 100644 --- a/src/lib/subrip.cc +++ b/src/lib/subrip.cc @@ -126,18 +126,18 @@ SubRip::SubRip (shared_ptr<const SubRipContent> content) ContentTime SubRip::convert_time (string t) { - ContentTime r = 0; + ContentTime r; vector<string> a; boost::algorithm::split (a, t, boost::is_any_of (":")); assert (a.size() == 3); - r += lexical_cast<int> (a[0]) * 60 * 60 * TIME_HZ; - r += lexical_cast<int> (a[1]) * 60 * TIME_HZ; + r += ContentTime::from_seconds (lexical_cast<int> (a[0]) * 60 * 60); + r += ContentTime::from_seconds (lexical_cast<int> (a[1]) * 60); vector<string> b; boost::algorithm::split (b, a[2], boost::is_any_of (",")); - r += lexical_cast<int> (b[0]) * TIME_HZ; - r += lexical_cast<int> (b[1]) * TIME_HZ / 1000; + r += ContentTime::from_seconds (lexical_cast<int> (b[0])); + r += ContentTime::from_seconds (lexical_cast<float> (b[1]) / 1000); return r; } @@ -229,7 +229,7 @@ ContentTime SubRip::length () const { if (_subtitles.empty ()) { - return 0; + return ContentTime (); } return _subtitles.back().to; |
