diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-11-29 22:06:51 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-11-29 22:06:51 +0000 |
commit | 34773ee5c0c48b4758a136ee66b2fb1f7ab48d45 (patch) | |
tree | 0f4c38b6f4a146f03061005f5ec2302a2875f0cd /libs/surfaces | |
parent | 515d19c74519599c53d6fc85c1af2647f390d95f (diff) |
provide operator<< for Timecode::Time
git-svn-id: svn://localhost/ardour2/branches/3.0@6208 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/surfaces')
-rw-r--r-- | libs/surfaces/control_protocol/control_protocol/timecode.h | 12 | ||||
-rw-r--r-- | libs/surfaces/control_protocol/smpte.cc | 6 |
2 files changed, 18 insertions, 0 deletions
diff --git a/libs/surfaces/control_protocol/control_protocol/timecode.h b/libs/surfaces/control_protocol/control_protocol/timecode.h index f30234b248..6b04b70cc3 100644 --- a/libs/surfaces/control_protocol/control_protocol/timecode.h +++ b/libs/surfaces/control_protocol/control_protocol/timecode.h @@ -19,6 +19,7 @@ #ifndef __ardour_timecode_h__ #define __ardour_timecode_h__ +#include <ostream> #include <inttypes.h> namespace Timecode { @@ -51,6 +52,15 @@ struct Time { subframes = 0; rate = a_rate; } + + std::ostream& print (std::ostream& ostr) const { + if (negative) { + ostr << '-'; + } + ostr << hours << ':' << minutes << ':' << seconds << ':' << frames << '.' << subframes << " @" << rate << (drop ? " drop" : " nondrop"); + return ostr; + } + }; Wrap increment( Time& timecode, uint32_t ); @@ -67,4 +77,6 @@ void hours_floor( Time& timecode ); } // namespace Timecode +std::ostream& operator<<(std::ostream& ostr, const Timecode::Time& t); + #endif // __ardour_timecode_h__ diff --git a/libs/surfaces/control_protocol/smpte.cc b/libs/surfaces/control_protocol/smpte.cc index 555dc86d38..10edd62542 100644 --- a/libs/surfaces/control_protocol/smpte.cc +++ b/libs/surfaces/control_protocol/smpte.cc @@ -426,3 +426,9 @@ hours_floor( Time& timecode ) } // namespace Timecode + +std::ostream& +operator<<(std::ostream& ostr, const Timecode::Time& t) +{ + return t.print (ostr); +} |