suptext

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PDS uint8 = 0x14 // Palettes definition
	ODS uint8 = 0x15 // Object definition
	PCS uint8 = 0x16 // Presentation composition
	WDS uint8 = 0x17 // Windows definition
	END uint8 = 0x80
)
View Source
const CompositionObjectExtendedSize = 16
View Source
const CompositionObjectSize = 8
View Source
const JSONIndent = "  "
View Source
const MagicBytes = "PG" // 0x5047
View Source
const ObjectMinSize = 7
View Source
const PaletteSize = 5
View Source
const PresentationCompositionSize = 11
View Source
const SegmentHeaderSize = 13
View Source
const TimestampAccuracy = 90 // Hz
View Source
const WindowDefinitionSize = 9

Variables

This section is empty.

Functions

func CreateImage

func CreateImage(pixels [][]uint8, palettes [256]PaletteDefinition) (*image.RGBA, error)

func FormatMilliseconds

func FormatMilliseconds(ts uint32) string

func GetImageBytesJPEG

func GetImageBytesJPEG(img *image.RGBA) ([]byte, error)

func RLEDecode

func RLEDecode(bytes []byte) ([][]uint8, error)

func RunOCR

func RunOCR(ocr *gosseract.Client, img []byte) (string, error)

Types

type CompositionObject

type CompositionObject struct {
	ObjID      uint16
	WinID      uint8
	Cropped    uint8
	Hpos       uint16
	Vpos       uint16
	HCropPos   uint16
	VCropPos   uint16
	CropWidth  uint16
	CropHeight uint16
}

func NewCompositionObject

func NewCompositionObject(bytes []byte) (CompositionObject, error)

type DisplaySet

type DisplaySet struct {
	PCS Section
	WDS Section
	PDS Section
	ODS Section
	END Section
}

func (*DisplaySet) AppendSRT

func (d *DisplaySet) AppendSRT(ocr *gosseract.Client, f *os.File, i uint, ets string) error

func (*DisplaySet) IsEpochEnd

func (d *DisplaySet) IsEpochEnd() bool

func (*DisplaySet) IsEpochStart

func (d *DisplaySet) IsEpochStart() bool

func (*DisplaySet) OCR

func (d *DisplaySet) OCR(ocr *gosseract.Client) (string, error)

func (*DisplaySet) Print

func (d *DisplaySet) Print()

func (*DisplaySet) StartTS

func (d *DisplaySet) StartTS() string

type ObjectData

type ObjectData struct {
	ID      uint16
	Version uint8
	Last    uint8
	Length  uint32 // uint24
	Width   uint16
	Height  uint16
	Data    []byte `json:"-"`
}

func NewObjectData

func NewObjectData(bytes []byte) (ObjectData, error)

type PGS

type PGS struct {
	Sections []DisplaySet
}

func ReadPGS

func ReadPGS(r *bufio.Reader) (PGS, error)

func (*PGS) GetSectionEndTimestamp

func (p *PGS) GetSectionEndTimestamp(start_section int) string

func (*PGS) PrintDisplaySet

func (p *PGS) PrintDisplaySet(i uint)

func (*PGS) PrintPGS

func (p *PGS) PrintPGS()

func (*PGS) PrintSectionType

func (p *PGS) PrintSectionType(t uint8)

func (*PGS) ToSRT

func (p *PGS) ToSRT(fout *os.File) error

type PaletteData

type PaletteData struct {
	ID          uint8
	Version     uint8
	NumPalettes uint8
	Palettes    [256]PaletteDefinition `json:"-"`
}

func NewPaletteData

func NewPaletteData(bytes []byte) (PaletteData, error)

type PaletteDefinition

type PaletteDefinition struct {
	Y  uint8 // Luminance
	Cr uint8 // ColorDiffRed
	Cb uint8 // ColorDiffBlue
	A  uint8 // Transparency
}

type PresentationCompositionData

type PresentationCompositionData struct {
	Width         uint16
	Height        uint16
	Framerate     uint8
	Num           uint16
	State         uint8
	PaletteUpdate uint8
	PaletteID     uint8
	NumComps      uint8
	Comps         []CompositionObject
}

func NewPresentationData

func NewPresentationData(bytes []byte) (PresentationCompositionData, error)

type Section

type Section struct {
	PTS  uint32
	DTS  uint32
	Type uint8
	Size uint16
	Data SectionData
}

func NewSection

func NewSection(bytes []byte) (Section, error)

func (*Section) Print

func (s *Section) Print()

type SectionData

type SectionData interface{}

type WindowDefinition

type WindowDefinition struct {
	WinID  uint8
	Hpos   uint16
	Vpos   uint16
	Width  uint16
	Height uint16
}

type WindowsData

type WindowsData struct {
	NumWindows uint8
	Windows    []WindowDefinition
}

func NewWindowsData

func NewWindowsData(bytes []byte) (WindowsData, error)

Jump to

Keyboard shortcuts

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