diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-01-14 17:39:32 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-01-20 11:20:25 +0000 |
| commit | 3f630fb8334238ab8a58fbe1a0f513ae2c00de80 (patch) | |
| tree | 4b773b91029d6374bfd4f2194053d3e249d597cd /src/time_pair.h | |
| parent | 49cafda01b3e07c47e3b20dd5ee91e1426446aea (diff) | |
Simplify time representation; better in-tree DCP subtitle parser.
Diffstat (limited to 'src/time_pair.h')
| -rw-r--r-- | src/time_pair.h | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/src/time_pair.h b/src/time_pair.h deleted file mode 100644 index 6265480..0000000 --- a/src/time_pair.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - Copyright (C) 2014 Carl Hetherington <cth@carlh.net> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -/** @file src/time_pair.h - * @brief TimePair class. - */ - -#ifndef LIBSUB_TIME_PAIR_H -#define LIBSUB_TIME_PAIR_H - -#include "frame_time.h" -#include "metric_time.h" -#include <boost/optional.hpp> - -namespace sub { - -/** @class TimePair - * @brief A time, expressed either in metric (h:m:s:ms) or frames (h:m:s:f). - */ -class TimePair -{ -public: - TimePair () {} - - TimePair (FrameTime t) - : _frame (t) - {} - - TimePair (MetricTime t) - : _metric (t) - {} - - void set_frame (FrameTime t) { - _frame = t; - _metric = boost::optional<MetricTime> (); - } - - void set_metric (MetricTime t) { - _metric = t; - _frame = boost::optional<FrameTime> (); - } - - boost::optional<FrameTime> frame () const { - return _frame; - } - - boost::optional<MetricTime> metric () const { - return _metric; - } - - FrameTime frame (float fps) const; - MetricTime metric (float fps) const; - - void add (FrameTime t, float fps); - void scale (float f, float fps); - - bool operator== (TimePair const & other) const; - -private: - boost::optional<FrameTime> _frame; - boost::optional<MetricTime> _metric; -}; - -std::ostream& operator<< (std::ostream & s, TimePair const &); - -} - -#endif |
