20 #if defined(AJA_MAC) || defined(AJA_LINUX) || defined(AJA_BAREMETAL)
46 m_stdTimecodeForHfr(
true)
51 m_stdTimecodeForHfr(
true)
57 : m_stdTimecodeForHfr(bStdTc)
59 Set(str.c_str(), timeBase, bDropFrame);
63 : m_stdTimecodeForHfr(
true)
65 Set(str.c_str(), timeBase);
83 bool bHasSemicolon =
false;
84 if (str.find(
";", 0) != string::npos)
91 return (
int)::strlen(
"00:00:00:00") + 1;
101 return (uint32_t)(f + .5);
106 return (((x)>=0)?(x):-(x));
112 int64_t frame, frameRate,frameDuration;
123 if ((frameRate == 0) || (frameDuration == 0))
127 else if (frameRate < frameDuration)
134 double dFrameRate = double(frameRate) / double(frameDuration);
138 uint32_t framesPerMin = framesPerSec * 60;
139 uint32_t framesPerHr = framesPerMin * 60;
140 uint32_t framesPerDay = framesPerHr * 24;
145 frame = frame % framesPerDay;
148 h = uint32_t(frame / framesPerHr);
149 frame = frame % framesPerHr;
152 m = uint32_t(frame / framesPerMin);
153 frame = frame % framesPerMin;
156 s = uint32_t(frame / framesPerSec);
159 f = uint32_t(frame % framesPerSec);
165 uint32_t dropFramesPerSec = framesPerSec - droppedFrames;
166 uint32_t dropframesPerMin = (59 * framesPerSec) + dropFramesPerSec;
167 uint32_t dropframesPerTenMin = (9 * dropframesPerMin) + framesPerMin;
168 uint32_t dropframesPerHr = dropframesPerTenMin * 6;
169 uint32_t dropframesPerDay = dropframesPerHr * 24;
172 frame = frame % dropframesPerDay;
175 h = uint32_t(frame / dropframesPerHr);
176 frame = frame % dropframesPerHr;
179 m = uint32_t(10 * (frame / dropframesPerTenMin));
180 frame = frame % dropframesPerTenMin;
183 if (frame >= framesPerMin)
186 frame = frame - framesPerMin;
189 m += uint32_t(frame / dropframesPerMin);
190 frame = frame % dropframesPerMin;
198 s = uint32_t(frame / framesPerSec);
199 frame = frame % framesPerSec;
204 if (frame >= dropFramesPerSec)
207 frame = frame - dropFramesPerSec;
210 s += uint32_t(frame / framesPerSec);
211 frame = frame % framesPerSec;
219 if ( (s == 0) && (m % 10 != 0))
227 uint32_t h = 0,m = 0,s = 0,f = 0;
230 std::ostringstream oss;
233 oss << setfill(
'0') << setw(2) << h <<
":"
234 << setfill(
'0') << setw(2) << m <<
":"
235 << setfill(
'0') << setw(2) << s <<
";"
236 << setfill(
'0') << setw(2) << f;
240 oss << setfill(
'0') << setw(2) << h <<
":"
241 << setfill(
'0') << setw(2) << m <<
":"
242 << setfill(
'0') << setw(2) << s <<
":"
243 << setfill(
'0') << setw(2) << f;
245 str.assign(oss.str());
252 strncpy(pString, s.c_str(), s.length());
263 uint32_t h=0, m=0, s=0, f=0;
266 pBufr[0] = ((f/10) << 4) + (f % 10);
267 pBufr[1] = ((s/10) << 4) + (s % 10);
268 pBufr[2] = ((m/10) << 4) + (m % 10);
269 pBufr[3] = ((h/10) << 4) + (h % 10);
271 pBufr[0] = pBufr[0] | 0x40;
286 int64_t frameRate, frameRate2, frameDuration;
290 frameRate2 = frameRate;
297 if ((frameRate == 0) || (frameDuration == 0))
304 double dFrameRate = double(frameRate2) / double(frameDuration);
308 uint32_t hourFrames = tb*60*60;
309 uint32_t minuteFrames = tb*60;
310 uint32_t totalMinutes = (60*h) + m;
313 if ( (s == 0) && ((m % 10) > 0) && ((f & ~1) == 0))
316 frame = ((hourFrames * h) + (minuteFrames * m) + (tb * s) + f) - (dropFrames * (totalMinutes - (totalMinutes / 10)));
320 double dFrameRate = double(frameRate2) / double(frameDuration);
323 uint32_t hourFrames = tb*60*60;
324 uint32_t minuteFrames = tb*60;
326 frame = ((hourFrames * h) + (minuteFrames * m) + (tb * s) + f);
339 const int valCount = 4;
340 uint32_t val[valCount];
341 ::memset(val,0,
sizeof(val));
346 size_t len = str.length();
349 for (
size_t i = 0; i < len; i++)
351 char theChar = str[len - i - 1];
352 if (::isdigit(theChar))
354 val[valOffset] = val[valOffset] + ((theChar -
'0') * valMult);
367 SetHmsf(val[3], val[2], val[1], val[0], timeBase, bDropFrame);
372 bool bDropFrame =
false;
373 std::string::const_iterator it = str.begin();
374 while(it != str.end())
376 if ((*it ==
';') || (*it ==
'.'))
383 Set(str, timeBase, bDropFrame);
391 bool bHasMark =
false;
392 if ( (str.find(
";", 0) != string::npos) || (str.find(
":", 0) != string::npos) )
399 std::string tmp(str);
402 if (tmp.length() > 11)
415 size_t len = str.length();
417 for (
size_t i = 0; i < len; i++)
419 size_t srcOffset = len - i - 1;
420 if ((str[srcOffset] >=
'0') && (str[srcOffset] <=
'9'))
422 tmp[tgtOffset] = str[srcOffset];
424 if ((tgtOffset == 8) || (tgtOffset == 5) || (tgtOffset == 2))
441 uint32_t f = (((pBufr[0] & 0x30) >> 4) * 10) + (pBufr[0] & 0x0f);
442 uint32_t s = (((pBufr[1] & 0x70) >> 4) * 10) + (pBufr[1] & 0x0f);
443 uint32_t m = (((pBufr[2] & 0x70) >> 4) * 10) + (pBufr[2] & 0x0f);
444 uint32_t h = (((pBufr[3] & 0x30) >> 4) * 10) + (pBufr[3] & 0x0f);
446 SetHmsf(h,m,s,f,timeBase,bDrop);
453 return (inLo >> 10) & 0x01;
465 const uint32_t h0 (((inHi >> 16) & 0xF) );
466 const uint32_t h1 (((inHi >> 24) & 0x3) * 10);
468 const uint32_t m0 (((inHi ) & 0xF) );
469 const uint32_t m1 (((inHi >> 8) & 0x7) * 10);
471 const uint32_t s0 (((inLo >> 16) & 0xF) );
472 const uint32_t s1 (((inLo >> 24) & 0x7) * 10);
485 fieldID = ((inHi & (1u<<27)) != 0);
487 fieldID = ((inLo & (1u<<27)) != 0);
490 const uint32_t numFrames = (((((inLo >> 8) & 0x3) * 10) + (inLo & 0xF)) * 2) + uint32_t(fieldID);
492 f1 = (numFrames / 10) * 10;
496 f0 = ((inLo ) & 0xF);
497 f1 = ((inLo >> 8) & 0x3) * 10;
506 uint32_t dbb(0), low(0), high(0);
508 if (*pDbb) *pDbb = dbb;
509 if (*pLow) *pLow = low;
510 if (*pHigh) *pHigh = high;
546 bool bIsSame =
false;
565 bool bIsLess = (
m_frame < (uint32_t)val);
581 bool bIsGreater = (
m_frame > (uint32_t)val);
591 return !(*
this == val);