movie

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HighResDefaultWidth  = 600
	HighResDefaultHeight = 300
)

Constants for video.

Variables

This section is empty.

Functions

func ContainSoundData

func ContainSoundData(soundData audio.L8) []byte

ContainSoundData packs a sound data into a container and encodes it.

func Write

func Write(dest io.Writer, container Container, cp text.Codepage) error

Write encodes the provided container into the given writer.

Types

type Audio

type Audio struct {
	Sound audio.L8
}

Audio represents the sound part of a movie.

type Cache

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

Cache retrieves movie container from a localizer and keeps them decoded until they are invalidated.

func NewCache

func NewCache(cp text.Codepage, localizer resource.Localizer) *Cache

NewCache returns a new instance.

func (*Cache) Audio

func (cache *Cache) Audio(key resource.Key) (sound audio.L8, err error)

Audio retrieves and caches the underlying movie, and returns the audio only.

func (*Cache) Container added in v1.4.0

func (cache *Cache) Container(key resource.Key) (Container, error)

Container retrieves and caches the underlying movie, and returns the complete container.

func (*Cache) InvalidateResources

func (cache *Cache) InvalidateResources(ids []resource.ID)

InvalidateResources lets the cache remove any movies from resources that are specified in the given slice.

func (*Cache) SizeWarning added in v1.4.0

func (cache *Cache) SizeWarning(key resource.Key) bool

SizeWarning returns true if the given movie is cached and is larger than the underlying archive would support.

func (*Cache) Subtitles added in v1.4.0

func (cache *Cache) Subtitles(key resource.Key, language resource.Language) (SubtitleList, error)

Subtitles retrieves and caches the underlying movie, and returns the subtitles for given language.

func (*Cache) Video added in v1.4.0

func (cache *Cache) Video(key resource.Key) ([]Scene, error)

Video retrieves and caches the underlying movie, and returns the complete list of decoded scenes.

type Container

type Container struct {
	Audio     Audio
	Video     Video
	Subtitles Subtitles
}

Container wraps the information and data of a MOVI container.

func Read

func Read(source io.ReadSeeker, cp text.Codepage) (Container, error)

Read tries to extract a MOVI container from the provided reader. On success the position of the reader is past the last data entry. On failure the position of the reader is undefined.

type Frame added in v1.4.0

type Frame struct {
	Pixels      []byte
	DisplayTime time.Duration
}

Frame describes a bitmap and how long it shall be displayed.

type HighResFrame added in v1.4.0

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

HighResFrame contains the compressed information of a high-resolution picture in a scene.

func (HighResFrame) WithDisplayTime added in v1.4.0

func (frame HighResFrame) WithDisplayTime(displayTime time.Duration) HighResFrame

WithDisplayTime returns a new instance with the given display time set.

type HighResScene added in v1.4.0

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

HighResScene is a set of frames with high-resolution compression.

func HighResSceneFrom added in v1.4.0

func HighResSceneFrom(ctx context.Context, scene Scene, width, height int) (HighResScene, error)

HighResSceneFrom compresses given scene and returns the compression result.

func (HighResScene) WithFrameDisplayTime added in v1.4.0

func (scene HighResScene) WithFrameDisplayTime(displayTime time.Duration) HighResScene

WithFrameDisplayTime returns a new scene instance with the given display time set for all frames.

type Scene added in v1.4.0

type Scene struct {
	Palette bitmap.Palette
	Frames  []Frame
}

Scene describes a series of frames that share a common palette. Ideally, they also share the same framerate.

type Subtitle

type Subtitle struct {
	Timestamp time.Duration
	Text      string
}

Subtitle is a timestamped text for subtitles.

type SubtitleList added in v1.4.0

type SubtitleList struct {
	Entries []Subtitle
}

SubtitleList describes the textual representation of a movie in one language.

type Subtitles added in v1.4.0

type Subtitles struct {
	PerLanguage [resource.LanguageCount]SubtitleList
}

Subtitles contains all the subtitles in all languages.

func (Subtitles) ArePresent added in v1.4.0

func (sub Subtitles) ArePresent() bool

ArePresent returns true if at least one language makes use of subtitles.

type Video added in v1.4.0

type Video struct {
	// Width is the width of the video in pixel.
	Width uint16
	// Height is the height of the video in pixel.
	Height uint16
	// Scenes contain the frames of the video.
	Scenes []HighResScene
}

Video describes the visual part of a movie.

func (Video) Decompress added in v1.4.0

func (video Video) Decompress() ([]Scene, error)

Decompress unpacks all the frames of all scenes.

func (Video) StartPalette added in v1.4.0

func (video Video) StartPalette() bitmap.Palette

StartPalette returns the palette of the first scene. If no scene is present, a black palette is returned.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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