diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-08-03 17:03:22 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-08-14 21:07:49 +0100 |
| commit | e0c524cbc4f006a4319c3ce8aa7625f9d70d054a (patch) | |
| tree | 92d11ab7ce01416a70c8389bd1ebbe8fffff0e13 /src/lib | |
| parent | cd06ec145bf9617615fae7d620cf51ad5b486293 (diff) | |
Add DCP size and length to player.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/util.cc | 16 | ||||
| -rw-r--r-- | src/lib/util.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc index 4ffe3bd12..1f5b29101 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -127,6 +127,22 @@ seconds_to_hms (int s) return buffer; } +string +time_to_hmsf (DCPTime time, Frame rate) +{ + Frame f = time.frames_round (rate); + int s = f / rate; + f -= (s * rate); + int m = s / 60; + s -= m * 60; + int h = m / 60; + m -= h * 60; + + char buffer[64]; + snprintf (buffer, sizeof(buffer), "%d:%02d:%02d.%d", h, m, s, static_cast<int>(f)); + return buffer; +} + /** @param s Number of seconds. * @return String containing an approximate description of s (e.g. "about 2 hours") */ diff --git a/src/lib/util.h b/src/lib/util.h index b152b67b5..d4616a7c9 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -60,6 +60,7 @@ struct AVSubtitle; class AudioBuffers; extern std::string seconds_to_hms (int); +extern std::string time_to_hmsf (DCPTime time, Frame rate); extern std::string seconds_to_approximate_hms (int); extern double seconds (struct timeval); extern void dcpomatic_setup (); |
