Timecode class
Some parts have been copied / inspired by the pytimecode library by Joshua Banton
https://pypi.org/project/pytimecode.py/
Notes: *There is a 24 hour SMPTE Timecode limit, so if your time exceeds that limit, it will roll over.
Timecode Does all the calculation over frames, so the main data it holds is frames, then when required it converts the frames to a timecode by using the frame rate setting.
Note: Drop frame timecodes operate by reporting higher frame numbers than really exist so that 29.97 timecodes stay in sync with 30 fps ones, etc.
Drop Frame Example:
at 29.97 fps, the next frame after 00:00:59;29 will be 00:01:00;02 (skipping 0 & 1) See the document here: https://www.connect.ecuad.ca/~mrose/pdf_documents/timecode.pdf
Drop Frame Calculations are done by implementing code found here:
Constructors
- Timecode({TimecodeFramerate? framerate, int startFrames = 0})
- Creates a new Timecode instance.
- Timecode.atSeconds(double seconds, {TimecodeFramerate? framerate})
-
Creates a timecode at a specific number of seconds with a specified framerate.
factory
- Timecode.atTimecode(String timecodeString, {TimecodeFramerate? framerate})
-
Creates a timecode with a specific timecode string and framerate.
factory
Properties
- ff → int
-
will always honor the drop frame setting in the framerate
no setter
- forceFractionalSeconds ↔ bool
-
getter/setter pair
- fps → double
-
no setter
- frac → int
-
fractional seconds in milliseconds honors drop frame
no setter
- frameCount ↔ int
-
keeps track of the actual frame count
getter/setter pair
- frameDelimiter → String
-
no setter
- framerate ↔ TimecodeFramerate
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setteroverride
- hh → int
-
no setter
- integerFps → int
-
no setter
- isDropFrame → bool
-
no setter
- isMillis → bool
-
no setter
- millis → int
-
millis reflects the realtime duration of this instance
no setter
- mm → int
-
no setter
- parts ↔ TimecodeData
-
the real timecode parts get updated whenever frames are changed
getter/setter pair
- running → bool
-
reports whether the timecode internal timer is running
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- ss → int
-
no setter
- started → bool
-
reports whether the timecode has a start time
no setter
- startingFrame ↔ int
-
this is the frame to use whenever we
reset
this timecodegetter/setter pair - startTime ↔ DateTime?
-
the real time when this timecode was "started"
getter/setter pair
-
updateStream
→ Stream<
bool> -
a stream of updates when the timecode internal timer is running
NOTE: The stream gets another
true
value every time it updates.no setter
Methods
-
addFrames(
int n) → void -
addSeconds(
double seconds) → void - can use fractional seconds
-
back(
) → void -
divFrames(
int n) → void -
multFrames(
int n) → void -
next(
) → void -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
now(
) → String - Will run an update and then return the string representation of this timecode.
-
pause(
) → void - Will pause the internal timecode timer so that it can be resumed.
-
reset(
) → void -
Will reset the timecode instance to the frame identified by
startingFrame
which was set when the object is created but may have been updated since then. -
resume(
) → void - Will resume a paused internal timer or will start one now.
-
start(
{bool fromCurrentFrame = false}) → void -
Will "start" a timecode by recording the current start time.
Subsequent calls to
update
will then update the frames from the elapsed time since this start time. -
stop(
{bool andReset = true}) → void -
Will stop a timecode and reset the
startTime
tonull
-
subFrames(
int n) → void -
toString(
) → String -
A string representation of this object.
override
-
update(
) → void - Will be called by the internal timer, or may be called at any time.
Operators
-
operator *(
int multiplier) → Timecode -
operator +(
Timecode other) → Timecode -
operator -(
Timecode other) → Timecode -
operator /(
int divisor) → Timecode -
operator <(
Timecode other) → dynamic -
operator ==(
Object other) → bool -
The equality operator.
override
-
operator >(
Timecode other) → dynamic
Static Methods
-
parseToFrames(
String timecodeString, {TimecodeFramerate? framerate}) → int -
The default format for a
timecodeString
isHH:MM:SS:FF
whereFF
stands for the number of frames after the current second and may be0 <= FF < fps
.