summaryrefslogtreecommitdiff
path: root/src/dcp_time.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-06-05 19:14:54 +0100
committerCarl Hetherington <cth@carlh.net>2015-06-05 19:14:54 +0100
commit331b2f8297b2b8a6db07a22dbbff7f913fe7a2f1 (patch)
tree45f281eaddb46e988e9f6c05b36fd553da0f010c /src/dcp_time.cc
parent96bf4824ca6b378648950bfbd4565b8368c8eca0 (diff)
Bits of tidying; comments.
Diffstat (limited to 'src/dcp_time.cc')
-rw-r--r--src/dcp_time.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/dcp_time.cc b/src/dcp_time.cc
index 5d9bed81..43c1ee49 100644
--- a/src/dcp_time.cc
+++ b/src/dcp_time.cc
@@ -38,11 +38,22 @@ Time::Time (int frame, int frames_per_second, int tcr_)
set (double (frame) / frames_per_second, tcr_);
}
+/** Construct a Time with a timecode rate of 24 and using the supplied
+ * number of seconds.
+ *
+ * @param seconds A number of seconds.
+ */
Time::Time (double seconds)
{
set (seconds, 24);
}
+/** Construct a Time with specified timecode rate and using the supplied
+ * number of seconds.
+ *
+ * @param seconds A number of seconds.
+ * @param tcr_ Timecode rate to use.
+ */
void
Time::set (double seconds, int tcr_)
{
@@ -66,7 +77,7 @@ Time::set (double seconds, int tcr_)
}
}
-/** @param time String of the form HH:MM:SS:EE */
+/** @param time String of the form HH:MM:SS:EE[E] */
Time::Time (string time, int tcr_)
: tcr (tcr_)
{
@@ -251,18 +262,26 @@ Time::as_string () const
return str.str ();
}
+/** @param tcr_ Timecode rate with which the return value should be counted.
+ * @return the total number of editable units that this time consists of at the specified timecode rate.
+ * For example, as_editable_units (24) returns the total time in frames at 24fps.
+ */
int64_t
Time::as_editable_units (int tcr_) const
{
return (int64_t(e) * float (tcr_ / tcr)) + int64_t(s) * tcr_ + int64_t(m) * 60 * tcr_ + int64_t(h) * 60 * 60 * tcr_;
}
+/** @return the total number of seconds that this time consists of */
double
Time::as_seconds () const
{
return h * 3600 + m * 60 + s + double(e) / tcr;
}
+/** @param tcr_ New timecode rate.
+ * @return A new Time which is this time at the spcified new timecode rate.
+ */
Time
Time::rebase (int tcr_) const
{