Versions in this module Expand all Collapse all v1 v1.0.0 Jan 30, 2023 Changes in this version + const LanguageChinese + const LanguageEnglish + const LanguageFrench + const LanguageJapanese + const LanguageNorwegian + var BytesBOM = []byte + var ColorBlack = &Color + var ColorBlue = &Color + var ColorCyan = &Color + var ColorGray = &Color + var ColorGreen = &Color + var ColorLime = &Color + var ColorMagenta = &Color + var ColorMaroon = &Color + var ColorNavy = &Color + var ColorOlive = &Color + var ColorPurple = &Color + var ColorRed = &Color + var ColorSilver = &Color + var ColorTeal = &Color + var ColorWhite = &Color + var ColorYellow = &Color + var ErrInvalidExtension = errors.New("astisub: invalid extension") + var ErrNoSubtitlesToWrite = errors.New("astisub: no subtitles to write") + var ErrNoValidTeletextPID = errors.New("astisub: no valid teletext PID") + var JustificationCentered = Justification(3) + var JustificationLeft = Justification(2) + var JustificationRight = Justification(4) + var JustificationUnchanged = Justification(1) + var Now = func() time.Time + type Color struct + Alpha uint8 + Blue uint8 + Green uint8 + Red uint8 + func (c *Color) SSAString() string + func (c *Color) TTMLString() string + type Item struct + Comments []string + EndAt time.Duration + Index int + InlineStyle *StyleAttributes + Lines []Line + Region *Region + StartAt time.Duration + Style *Style + func (i Item) String() string + type Justification int + type Line struct + Items []LineItem + VoiceName string + func (l Line) String() string + type LineItem struct + InlineStyle *StyleAttributes + Style *Style + Text string + func (li LineItem) STLString() string + type Metadata struct + Comments []string + Framerate int + Language string + SSACollisions string + SSAOriginalEditing string + SSAOriginalScript string + SSAOriginalTiming string + SSAOriginalTranslation string + SSAPlayDepth *int + SSAPlayResX *int + SSAPlayResY *int + SSAScriptType string + SSAScriptUpdatedBy string + SSASynchPoint string + SSATimer *float64 + SSAUpdateDetails string + SSAWrapStyle string + STLCountryOfOrigin string + STLCreationDate *time.Time + STLDisplayStandardCode string + STLEditorContactDetails string + STLEditorName string + STLMaximumNumberOfDisplayableCharactersInAnyTextRow *int + STLMaximumNumberOfDisplayableRows *int + STLOriginalEpisodeTitle string + STLPublisher string + STLRevisionDate *time.Time + STLRevisionNumber int + STLSubtitleListReferenceCode string + STLTimecodeStartOfProgramme time.Duration + STLTranslatedEpisodeTitle string + STLTranslatedProgramTitle string + STLTranslatorContactDetails string + STLTranslatorName string + TTMLCopyright string + Title string + type Options struct + Filename string + STL STLOptions + Teletext TeletextOptions + type Region struct + ID string + InlineStyle *StyleAttributes + Style *Style + type SSAOptions struct + OnInvalidLine func(line string) + OnUnknownSectionName func(name string) + type STLOptions struct + IgnoreTimecodeStartOfProgramme bool + type STLPosition struct + MaxRows int + Rows int + VerticalPosition int + type Style struct + ID string + InlineStyle *StyleAttributes + Style *Style + type StyleAttributes struct + SSAAlignment *int + SSAAlphaLevel *float64 + SSAAngle *float64 + SSABackColour *Color + SSABold *bool + SSABorderStyle *int + SSAEffect string + SSAEncoding *int + SSAFontName string + SSAFontSize *float64 + SSAItalic *bool + SSALayer *int + SSAMarginLeft *int + SSAMarginRight *int + SSAMarginVertical *int + SSAMarked *bool + SSAOutline *float64 + SSAOutlineColour *Color + SSAPrimaryColour *Color + SSAScaleX *float64 + SSAScaleY *float64 + SSASecondaryColour *Color + SSAShadow *float64 + SSASpacing *float64 + SSAStrikeout *bool + SSAUnderline *bool + STLBoxing *bool + STLItalics *bool + STLJustification *Justification + STLPosition *STLPosition + STLUnderline *bool + TTMLBackgroundColor *string + TTMLColor *string + TTMLDirection *string + TTMLDisplay *string + TTMLDisplayAlign *string + TTMLExtent *string + TTMLFontFamily *string + TTMLFontSize *string + TTMLFontStyle *string + TTMLFontWeight *string + TTMLLineHeight *string + TTMLOpacity *string + TTMLOrigin *string + TTMLOverflow *string + TTMLPadding *string + TTMLShowBackground *string + TTMLTextAlign *string + TTMLTextDecoration *string + TTMLTextOutline *string + TTMLUnicodeBidi *string + TTMLVisibility *string + TTMLWrapOption *string + TTMLWritingMode *string + TTMLZIndex *int + TeletextColor *Color + TeletextDoubleHeight *bool + TeletextDoubleSize *bool + TeletextDoubleWidth *bool + TeletextSpacesAfter *int + TeletextSpacesBefore *int + WebVTTAlign string + WebVTTItalics bool + WebVTTLine string + WebVTTLines int + WebVTTPosition string + WebVTTRegionAnchor string + WebVTTScroll string + WebVTTSize string + WebVTTVertical string + WebVTTViewportAnchor string + WebVTTWidth string + type Subtitles struct + Items []*Item + Metadata *Metadata + Regions map[string]*Region + Styles map[string]*Style + func NewSubtitles() *Subtitles + func Open(o Options) (s *Subtitles, err error) + func OpenFile(filename string) (*Subtitles, error) + func ReadFromSRT(i io.Reader) (o *Subtitles, err error) + func ReadFromSSA(i io.Reader) (o *Subtitles, err error) + func ReadFromSSAWithOptions(i io.Reader, opts SSAOptions) (o *Subtitles, err error) + func ReadFromSTL(i io.Reader, opts STLOptions) (o *Subtitles, err error) + func ReadFromTTML(i io.Reader) (o *Subtitles, err error) + func ReadFromTeletext(r io.Reader, o TeletextOptions) (s *Subtitles, err error) + func ReadFromWebVTT(i io.Reader) (o *Subtitles, err error) + func (s *Subtitles) Add(d time.Duration) + func (s *Subtitles) ApplyLinearCorrection(actual1, desired1, actual2, desired2 time.Duration) + func (s *Subtitles) ForceDuration(d time.Duration, addDummyItem bool) + func (s *Subtitles) Fragment(f time.Duration) + func (s *Subtitles) Merge(i *Subtitles) + func (s *Subtitles) Optimize() + func (s *Subtitles) Order() + func (s *Subtitles) RemoveStyling() + func (s *Subtitles) Unfragment() + func (s Subtitles) Duration() time.Duration + func (s Subtitles) IsEmpty() bool + func (s Subtitles) Write(dst string) (err error) + func (s Subtitles) WriteToSRT(o io.Writer) (err error) + func (s Subtitles) WriteToSSA(o io.Writer) (err error) + func (s Subtitles) WriteToSTL(o io.Writer) (err error) + func (s Subtitles) WriteToTTML(o io.Writer) (err error) + func (s Subtitles) WriteToWebVTT(o io.Writer) (err error) + type TTMLIn struct + Framerate int + Lang string + Metadata TTMLInMetadata + Regions []TTMLInRegion + Styles []TTMLInStyle + Subtitles []TTMLInSubtitle + Tickrate int + XMLName xml.Name + type TTMLInDuration struct + func (d *TTMLInDuration) UnmarshalText(i []byte) (err error) + type TTMLInHeader struct + ID string + Style string + type TTMLInItem struct + Style string + Text string + XMLName xml.Name + type TTMLInItems []TTMLInItem + func (i *TTMLInItems) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error) + type TTMLInMetadata struct + Copyright string + Title string + type TTMLInRegion struct + XMLName xml.Name + type TTMLInStyle struct + XMLName xml.Name + type TTMLInStyleAttributes struct + BackgroundColor *string + Color *string + Direction *string + Display *string + DisplayAlign *string + Extent *string + FontFamily *string + FontSize *string + FontStyle *string + FontWeight *string + LineHeight *string + Opacity *string + Origin *string + Overflow *string + Padding *string + ShowBackground *string + TextAlign *string + TextDecoration *string + TextOutline *string + UnicodeBidi *string + Visibility *string + WrapOption *string + WritingMode *string + ZIndex *int + type TTMLInSubtitle struct + Begin *TTMLInDuration + End *TTMLInDuration + ID string + Items string + Region string + Style string + type TTMLOut struct + Lang string + Metadata *TTMLOutMetadata + Regions []TTMLOutRegion + Styles []TTMLOutStyle + Subtitles []TTMLOutSubtitle + XMLName xml.Name + XMLNamespaceTTM string + XMLNamespaceTTS string + type TTMLOutDuration time.Duration + func (t TTMLOutDuration) MarshalText() ([]byte, error) + type TTMLOutHeader struct + ID string + Style string + type TTMLOutItem struct + Style string + Text string + XMLName xml.Name + type TTMLOutMetadata struct + Copyright string + Title string + type TTMLOutRegion struct + XMLName xml.Name + type TTMLOutStyle struct + XMLName xml.Name + type TTMLOutStyleAttributes struct + BackgroundColor *string + Color *string + Direction *string + Display *string + DisplayAlign *string + Extent *string + FontFamily *string + FontSize *string + FontStyle *string + FontWeight *string + LineHeight *string + Opacity *string + Origin *string + Overflow *string + Padding *string + ShowBackground *string + TextAlign *string + TextDecoration *string + TextOutline *string + UnicodeBidi *string + Visibility *string + WrapOption *string + WritingMode *string + ZIndex *int + type TTMLOutSubtitle struct + Begin TTMLOutDuration + End TTMLOutDuration + ID string + Items []TTMLOutItem + Region string + Style string + type TeletextOptions struct + PID int + Page int