timecode

package module
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2022 License: MIT Imports: 4 Imported by: 0

README

Build Status go report card GoDoc codecov

A package for dealing with SMPTE timecode.

It is primarily based on https://www.npmjs.com/package/timecode

frameRate := 29.97
dropFrame := true

tc := timecode.NewTimecode(frameRate, dropFrame)
tc.AddSeconds(10.5)
tc.AddFrames(20)
tc.AddString("05:01:20;18")
tc.SubSeconds(1)

tc2 := timecode.NewTimecode(frameRate, dropFrame)
tc.AddString("05:01:20;18")

tc.Add(tc2)

fmt.Println(tc) // 05:01:30;23

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Timecode

type Timecode struct {
	// contains filtered or unexported fields
}

Timecode is an object for manipulating SMPTE timecodes

func NewTimecode

func NewTimecode(rate float64, drop bool) (*Timecode, error)

NewTimecode returns a new Timecode. It takes the frame rate and a bool which flags it as using drop frame encoding

func (*Timecode) Add

func (tc *Timecode) Add(t *Timecode) *Timecode

Add adds another Timecode object to the timecode.

func (*Timecode) AddFrames

func (tc *Timecode) AddFrames(frames int) *Timecode

AddFrames add frames to the timecode

func (*Timecode) AddSeconds

func (tc *Timecode) AddSeconds(seconds float64) *Timecode

AddSeconds add seconds to the timecode

func (*Timecode) AddString

func (tc *Timecode) AddString(t string) error

AddString adds SMPTE strings in the following formats: timecode strings non-drop 'hh:mm:ss:ff', drop 'hh:mm:ss;ff', or milliseconds 'hh:mm:ss:mmm'

func (*Timecode) Reset

func (tc *Timecode) Reset()

Resets sets the timecode to 0

func (*Timecode) SetDropFrame

func (tc *Timecode) SetDropFrame(drop bool)

SetDropFrame toggles the SMTPE drop frame encoding

func (*Timecode) SetFrameRate

func (tc *Timecode) SetFrameRate(rate float64) error

SetFrameRate sets the timecode's frame rate

func (*Timecode) String

func (tc *Timecode) String() string

String returns a SMTPE timecode string

func (*Timecode) Sub

func (tc *Timecode) Sub(t *Timecode) *Timecode

Subtract subtracts another Timecode object from the timecode

func (*Timecode) SubFrames

func (tc *Timecode) SubFrames(frames int) *Timecode

SubFrames subtract frames from the timecode

func (*Timecode) SubSeconds

func (tc *Timecode) SubSeconds(seconds float64) *Timecode

SubSeconds subtract seconds from the timecode

func (*Timecode) SubString

func (tc *Timecode) SubString(t string) error

SubString subtract SMPTE strings timecode strings non-drop 'hh:mm:ss:ff', drop 'hh:mm:ss;ff', or milliseconds 'hh:mm:ss:mmm'

func (*Timecode) ToSeconds

func (tc *Timecode) ToSeconds() float64

ToSeconds returns the timecode in seconds

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL