mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
Caption support (#2462)
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
29
vendor/github.com/asticode/go-astits/clock_reference.go
generated
vendored
Normal file
29
vendor/github.com/asticode/go-astits/clock_reference.go
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
package astits
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// ClockReference represents a clock reference
|
||||
// Base is based on a 90 kHz clock and extension is based on a 27 MHz clock
|
||||
type ClockReference struct {
|
||||
Base, Extension int64
|
||||
}
|
||||
|
||||
// newClockReference builds a new clock reference
|
||||
func newClockReference(base, extension int64) *ClockReference {
|
||||
return &ClockReference{
|
||||
Base: base,
|
||||
Extension: extension,
|
||||
}
|
||||
}
|
||||
|
||||
// Duration converts the clock reference into duration
|
||||
func (p ClockReference) Duration() time.Duration {
|
||||
return time.Duration(p.Base*1e9/90000) + time.Duration(p.Extension*1e9/27000000)
|
||||
}
|
||||
|
||||
// Time converts the clock reference into time
|
||||
func (p ClockReference) Time() time.Time {
|
||||
return time.Unix(0, p.Duration().Nanoseconds())
|
||||
}
|
||||
Reference in New Issue
Block a user