- if (m_dropFrame) {
- //Get Hours, Minutes, Seconds, Frames from timecode
- int hours, minutes, seconds, frames;
-
- hours = duration.section(':', 0, 0).toInt();
- if (duration.contains('.')) {
- minutes = duration.section('.', 0, 0).section(':', 1, 1).toInt();
- seconds = duration.section('.', 1, 1).section(':', 0, 0).toInt();
- frames = duration.section('.', 1, 1).section(':', 1, 1).toInt();
- } else {
- //Handle Drop Frame timecode frame calculations, even if the timecode supplied uses incorrect "99:99:99:99" format instead of "99:99.99:99"
- minutes = duration.section(':', 1, 1).toInt();
- seconds = duration.section(':', 2, 2).toInt();
- frames = duration.section(':', 3, 3).toInt();
- }
-
- //Calculate the frame count
- int dropRate = (int)((ceil(m_displayedFramesPerSecond) / 30) * 2);
- frames += ((hours * 60 + minutes) * 60 + seconds) * m_displayedFramesPerSecond;
- frames -= dropRate * ((hours * 60 + minutes) - (floor((hours * 60 + minutes) / 10)));
- return frames;
+ if (duration.isEmpty()) {
+ return 0;
+ }
+ int hours, minutes, seconds, frames;
+ int offset = 0;
+ if (duration.at(0) == '-') {
+ offset = 1;
+ hours = duration.mid(1, 2).toInt();
+ } else {
+ hours = duration.left(2).toInt();