AJA NTV2 SDK  17.5.0.1492
NTV2 SDK 17.5.0.1492
timecode.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #ifndef AJA_TIMECODE_H
9 #define AJA_TIMECODE_H
11 
16 typedef enum
17 {
21 
22 
29 {
30 public:
31  AJATimeCode();
32  AJATimeCode(uint32_t frame, bool bStdTcForHfr=true);
33  AJATimeCode(const std::string &str, const AJATimeBase& timeBase, bool bDropFrame, bool bStdTcForHfr=true);
34  AJATimeCode(const std::string &str, const AJATimeBase& timeBase);
35  AJATimeCode(const AJATimeCode& other);
36 
37  virtual ~AJATimeCode();
38 
52  static uint32_t CalcFrame(uint32_t h, uint32_t m, uint32_t s, uint32_t f, const AJATimeBase& timeBase, bool bDropFrame, bool bStdTcForHfr, uint32_t addFrame);
53 
67  static uint32_t CalcHmsf(uint32_t &h, uint32_t &m, uint32_t &s, uint32_t &f, uint32_t frame, const AJATimeBase& timeBase, bool bDropFrame, bool bStdTcForHfr);
68 
69 
80  void QueryString(std::string &str, const AJATimeBase& timeBase, bool bDropFrame, bool bStdTcForHfr, AJATimecodeNotation notation = AJA_TIMECODE_LEGACY);
81 
91  void QueryString(std::string &str, const AJATimeBase& timeBase, bool bDropFrame, AJATimecodeNotation notation = AJA_TIMECODE_LEGACY);
92 
100  void QuerySMPTEString(char *pString, const AJATimeBase& timeBase, bool bDropFrame);
101 
107  static int QuerySMPTEStringSize(void);
108 
114  uint32_t QueryFrame(void) const;
115 
116 
122  bool QueryStdTimecodeForHfr() { return m_stdTcForHfr; }
123 
134  void QueryHmsf(uint32_t &h, uint32_t &m, uint32_t &s, uint32_t &f, const AJATimeBase& timeBase, bool bDropFrame) const;
135 
141  void Set(uint32_t frame);
142 
149  void Set(const std::string &str, const AJATimeBase& timeBase);
150 
158  void SetWithCleanup(const std::string &str, const AJATimeBase& timeBase, bool bDrop);
159 
167  void Set(const std::string &str, const AJATimeBase& timeBase, bool bDropFrame);
168 
181  void SetHmsf(uint32_t h, uint32_t m, uint32_t s, uint32_t f, const AJATimeBase& timeBase, bool bDropFrame, bool bStdTcForHfr, uint32_t addFrame);
182  void SetHmsf(uint32_t h, uint32_t m, uint32_t s, uint32_t f, const AJATimeBase& timeBase, bool bDropFrame);
183 
190  void SetSMPTEString(const char *pBufr, const AJATimeBase& timeBase);
191 
200  void SetRP188 (const uint32_t inDBB, const uint32_t inLo, const uint32_t inHi, const AJATimeBase & inTimeBase);
201 
213  void QueryRP188(uint32_t & outDBB, uint32_t & outLo, uint32_t & outHi, const AJATimeBase & timeBase, const bool bDrop);
214 
220  void SetStdTimecodeForHfr(bool bStdTc) {m_stdTcForHfr = bStdTc;}
221 
222 
228  static bool QueryIsDropFrame(const std::string &str);
229 
230 
231  static int QueryStringSize(void);
232 
240  static bool QueryIsRP188DropFrame (const uint32_t inDBB, const uint32_t inLo, const uint32_t inHi);
241 
242  AJATimeCode& operator=(const AJATimeCode &val);
243  AJATimeCode& operator+=(const AJATimeCode &val);
244  AJATimeCode& operator-=(const AJATimeCode &val);
245  AJATimeCode& operator+=(const int32_t val);
246  AJATimeCode& operator-=(const int32_t val);
247  const AJATimeCode operator+(const AJATimeCode &val) const;
248  const AJATimeCode operator+(const int32_t val) const;
249  const AJATimeCode operator-(const AJATimeCode &val) const;
250  const AJATimeCode operator-(const int32_t val) const;
251  bool operator==(const AJATimeCode &val) const;
252  bool operator<(const AJATimeCode &val) const;
253  bool operator<(const int32_t val) const;
254  bool operator>(const AJATimeCode &val) const;
255  bool operator>(const int32_t val) const;
256  bool operator!=(const AJATimeCode &val) const;
257 
258  #if !defined(NTV2_DEPRECATE_17_5)
259  void QueryString(char *pStr, const AJATimeBase& tb, bool df, AJATimecodeNotation notation = AJA_TIMECODE_LEGACY);
260  void QueryRP188(uint32_t *pDbb, uint32_t *pLo, uint32_t *pHi, const AJATimeBase& tb, bool drop);
261  #endif // NTV2_DEPRECATE_17_5
262 private:
263  uint32_t m_frame;
264  bool m_stdTcForHfr;
265 }; // AJATimeCode
266 
267 #endif // AJA_TIMECODE_H
AJA_TIMECODE_LEGACY
@ AJA_TIMECODE_LEGACY
Legacy notation (e.g. 01:02:03;29 .. 01:02:03:58)
Definition: timecode.h:18
AJA_EXPORT
#define AJA_EXPORT
Definition: export.h:34
nlohmann::json_abiNLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON_v3_11_NLOHMANN_JSON_VERSION_PATCH::detail::operator<
bool operator<(const value_t lhs, const value_t rhs) noexcept
comparison operator for JSON types
Definition: json.hpp:2902
nlohmann::json_abiNLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON_v3_11_NLOHMANN_JSON_VERSION_PATCH::operator==
bool operator==(const json_pointer< RefStringTypeLhs > &lhs, const json_pointer< RefStringTypeRhs > &rhs) noexcept
Definition: json.hpp:14737
AJATimeBase
Definition: timebase.h:18
AJA_TIMECODE_STANDARD
@ AJA_TIMECODE_STANDARD
AJA standard notation (e.g. 01;02;03.29 .. 01;02;03;29 .. 01:02:03#58)
Definition: timecode.h:19
AJATimeCode::SetStdTimecodeForHfr
void SetStdTimecodeForHfr(bool bStdTc)
Definition: timecode.h:220
operator+=
NTV2VideoFormatSet & operator+=(NTV2VideoFormatSet &inOutSet, const NTV2VideoFormatSet inSet)
Appends the given NTV2VideoFormatSet contents into the given set.
Definition: ntv2publicinterface.cpp:1072
nlohmann::json_abiNLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON_v3_11_NLOHMANN_JSON_VERSION_PATCH::operator!=
bool operator!=(const json_pointer< RefStringTypeLhs > &lhs, const json_pointer< RefStringTypeRhs > &rhs) noexcept
Definition: json.hpp:14762
AJATimeCode::QueryStdTimecodeForHfr
bool QueryStdTimecodeForHfr()
Definition: timecode.h:122
AJATimecodeNotation
AJATimecodeNotation
Identifies the timecode format used in AJATimeCode::QueryString.
Definition: timecode.h:16
AJATimeCode
Utility class for timecodes.
Definition: timecode.h:28
timebase.h
Declares the AJATimeBase class.