Documentation
¶
Index ¶
- type Event
- type Format
- type Subtitle
- func (s Subtitle) RemoveHI() Subtitle
- func (s Subtitle) RemoveIds(ids []uint) Subtitle
- func (s Subtitle) Save(filename string) error
- func (s Subtitle) Shift(delta time.Duration, clamp bool) Subtitle
- func (s Subtitle) Stretch(factor float64, anchor time.Duration) Subtitle
- func (s Subtitle) TrimAfter(t time.Duration) Subtitle
- func (s Subtitle) TrimBefore(t time.Duration) Subtitle
- func (s Subtitle) TrimFirst(n int) Subtitle
- func (s Subtitle) TrimLast(n int) Subtitle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Format ¶
type Format interface {
Name() string
Extensions() []string
Decode(r io.Reader) (Subtitle, error)
Encode(w io.Writer, s Subtitle) error
}
Format represents a subtitle file format (SRT, ASS, etc.).
func DetectFormat ¶
DetectFormat returns a Format based on the filename's extension.
type Subtitle ¶
type Subtitle struct {
Events []Event
}
Subtitle is a collection of events.
func (Subtitle) RemoveHI ¶
RemoveHI removes hearing impaired annotations like (sobbing) or [loud noise] from event text. Events that become empty after removal are excluded.
func (Subtitle) Save ¶
Save writes the subtitle to a file, detecting format from the filename extension.
func (Subtitle) Shift ¶
Shift returns a new Subtitle with all events shifted by delta. If clamp is true, negative times are clamped to zero.
func (Subtitle) Stretch ¶
Stretch returns a new Subtitle with all times scaled around an anchor. newT = (t - anchor) * factor + anchor.
func (Subtitle) TrimBefore ¶
TrimBefore removes all events that start before the given timestamp.