Documentation
¶
Index ¶
- Constants
- func IndexTableSizeFor(entryCount int) int
- type AudioEntryData
- type ControlDictionaryEntryData
- type DataType
- type Entry
- type EntryBucket
- type EntryBucketPriority
- type EntryData
- type Fix
- type Header
- type HighResVideoEntryData
- type IndexTableEntry
- type LowResVideoEntryData
- type PaletteEntryData
- type PaletteLookupEntryData
- type PaletteResetEntryData
- type SubtitleControl
- type SubtitleEntryData
- type SubtitleHeader
- type Timestamp
- type UnknownEntryData
Constants ¶
const ( // DataTypeEndOfMedia marks the last entry. DataTypeEndOfMedia = DataType(0) // DataTypeLowResVideo for low resolution (low compression) video. DataTypeLowResVideo = DataType(0x21) // DataTypeHighResVideo for high resolution (high compression) video. DataTypeHighResVideo = DataType(0x79) // DataTypeAudio marks an audio entry. DataTypeAudio = DataType(2) // DataTypeSubtitle control for subtitle entries. DataTypeSubtitle = DataType(3) // DataTypePalette describes a color palette. DataTypePalette = DataType(4) // DataTypePaletteReset is a zero-byte entry immediately before a Palette entry. DataTypePaletteReset = DataType(0x4C) // DataTypePaletteLookupList for high compression video. DataTypePaletteLookupList = DataType(5) // DataTypeControlDictionary for high compression video. DataTypeControlDictionary = DataType(0x0D) )
const ( EntryBucketPriorityAudio = 0 EntryBucketPriorityVideoControl = 1 EntryBucketPrioritySubtitleControl = 2 EntryBucketPrioritySubtitle = 3 EntryBucketPriorityFrame = 4 )
List of entry bucket priorities.
const ( SubtitleArea = SubtitleControl(0x41455241) SubtitleTextStd = SubtitleControl(0x20445453) SubtitleTextFrn = SubtitleControl(0x204E5246) SubtitleTextGer = SubtitleControl(0x20524547) )
Subtitle constants are based on four-letter ASCII sequences.
const HeaderSize = 256
HeaderSize specifies the length of a serialized Header in bytes.
const IndexTableEntrySize = 8
IndexTableEntrySize specifies how many bytes a serialized IndexTableEntry uses.
const SubtitleDefaultTextOffset = 16
SubtitleDefaultTextOffset is the typical offset, in bytes, to text content.
const Tag string = "MOVI"
Tag is the identifier key of a MOVI container.
Variables ¶
This section is empty.
Functions ¶
func IndexTableSizeFor ¶ added in v1.8.0
IndexTableSizeFor returns the number of bytes reserved for given amount of table entries.
Types ¶
type AudioEntryData ¶
type AudioEntryData struct {
Samples []byte
}
AudioEntryData is an entry with audio samples.
func AudioEntryFrom ¶
func AudioEntryFrom(r io.Reader, dataSize int) (AudioEntryData, error)
AudioEntryFrom decodes an entry from given data.
func (AudioEntryData) Bytes ¶
func (data AudioEntryData) Bytes() []byte
Bytes returns the raw bytes of the entry.
type ControlDictionaryEntryData ¶
type ControlDictionaryEntryData struct {
Words []compression.ControlWord
}
ControlDictionaryEntryData contains control words for compression.
func ControlDictionaryEntryFrom ¶
func ControlDictionaryEntryFrom(r io.Reader, dataSize int) (ControlDictionaryEntryData, error)
ControlDictionaryEntryFrom decodes an entry from given data.
func (ControlDictionaryEntryData) Bytes ¶
func (data ControlDictionaryEntryData) Bytes() []byte
Bytes serializes the entry.
func (ControlDictionaryEntryData) Type ¶
func (data ControlDictionaryEntryData) Type() DataType
Type describes the entry.
type Entry ¶
type Entry struct { // Timestamp marks the beginning time of the entry. Timestamp Timestamp // Data is a type specific information of a movie. Data EntryData }
Entry describes a timestamped block from a MOVI container.
type EntryBucket ¶
type EntryBucket struct { // Priority helps in merging content from multiple buckets. Priority EntryBucketPriority // Timestamp specifies at which time the bucket should be inserted into the stream. // This is typically derived from one of the timestamps of the contained entries. Timestamp Timestamp // Entries is the list of entries within this bucket. Entries []Entry }
EntryBucket is a set of entries that need to be together within the stream. This exists mainly to cover special cases of entries within a stream that have no valid timestamp.
type EntryBucketPriority ¶
type EntryBucketPriority int
EntryBucketPriority describes the general priority of the bucket. Lower numbers are put before higher numbers if the bucket has the same timestamp.
type EntryData ¶
type EntryData interface { // Type describes the content type of the data. Type() DataType // Bytes returns the raw bytes of the entry. Bytes() []byte }
EntryData describes one entry in a MOVI container.
type Fix ¶
Fix represents a fixed-point number, with 16 bits of fraction and 15 bits of integer number.
func FixFromFloat ¶
FixFromFloat returns a fixed-point number from given floating-point number.
type Header ¶
type Header struct { // Tag is the identifier key of a MOVI container Tag [4]byte // IndexEntryCount specifies how many index entries are in the index. IndexEntryCount int32 // IndexSize specifies how long the index is. IndexSize int32 // ContentSize specifies the length of the content. ContentSize int32 // Duration is the length of the media in seconds. Duration Fix // VideoFrameRate gives a hint on number of frames per second. VideoFrameRate Fix // VideoWidth specifies the width of the video. VideoWidth uint16 // VideoHeight specifies the height of the video. VideoHeight uint16 // VideoBitsPerPixel specifies bit count for color information: 8, 15, 24. VideoBitsPerPixel int16 // VideoPalettePresent specifies whether a palette is set. VideoPalettePresent int16 // AudioChannelCount specifies whether there is audio, and how many channels to use. 0 = no audio, 1 = mono, 2 = stereo. AudioChannelCount int16 // AudioBytesPerSample specifies how many bytes one audio sample has. 1 = 8-bit, 2 = 16-bit. AudioBytesPerSample int16 // AudioSampleRate specifies the sample rate of the audio. AudioSampleRate Fix // contains filtered or unexported fields }
Header is the first entry of a MOVI container.
type HighResVideoEntryData ¶
HighResVideoEntryData is a compressed high-resolution video frame.
func HighResVideoEntryFrom ¶
func HighResVideoEntryFrom(r io.Reader, dataSize int) (HighResVideoEntryData, error)
HighResVideoEntryFrom decodes an entry from given data.
func (HighResVideoEntryData) Bytes ¶
func (data HighResVideoEntryData) Bytes() []byte
Bytes returns the raw bytes of the entry.
func (HighResVideoEntryData) Type ¶
func (data HighResVideoEntryData) Type() DataType
Type describes the entry.
type IndexTableEntry ¶
type IndexTableEntry struct { TimestampFraction uint16 TimestampSecond byte Type byte DataOffset int32 }
IndexTableEntry describes one data entry of a MOVI container.
type LowResVideoEntryData ¶
LowResVideoEntryData is a compressed low-resolution video frame.
func LowResVideoEntryFrom ¶
func LowResVideoEntryFrom(r io.Reader, dataSize int) (LowResVideoEntryData, error)
LowResVideoEntryFrom decodes an entry from given data.
func (LowResVideoEntryData) Bytes ¶
func (data LowResVideoEntryData) Bytes() []byte
Bytes returns the raw bytes of the entry.
func (LowResVideoEntryData) Type ¶
func (data LowResVideoEntryData) Type() DataType
Type describes the entry.
type PaletteEntryData ¶
PaletteEntryData is an entry with a palette.
func PaletteEntryFrom ¶
func PaletteEntryFrom(r io.Reader) (PaletteEntryData, error)
PaletteEntryFrom decodes an entry from given data.
func (PaletteEntryData) Bytes ¶
func (data PaletteEntryData) Bytes() []byte
Bytes returns the raw bytes of the entry.
func (PaletteEntryData) Type ¶
func (data PaletteEntryData) Type() DataType
Type describes the entry.
type PaletteLookupEntryData ¶
type PaletteLookupEntryData struct {
List []byte
}
PaletteLookupEntryData contains a list of palette indices.
func PaletteLookupEntryFrom ¶
func PaletteLookupEntryFrom(r io.Reader, dataSize int) (PaletteLookupEntryData, error)
PaletteLookupEntryFrom decodes an entry from given data.
func (PaletteLookupEntryData) Bytes ¶
func (data PaletteLookupEntryData) Bytes() []byte
Bytes serializes the entry.
func (PaletteLookupEntryData) Type ¶
func (data PaletteLookupEntryData) Type() DataType
Type describes the entry.
type PaletteResetEntryData ¶
type PaletteResetEntryData struct { }
PaletteResetEntryData marks a reset of the palette.
func PaletteResetEntryFrom ¶
func PaletteResetEntryFrom() (PaletteResetEntryData, error)
PaletteResetEntryFrom decodes an entry from given data.
func (PaletteResetEntryData) Bytes ¶
func (data PaletteResetEntryData) Bytes() []byte
Bytes serializes the entry.
func (PaletteResetEntryData) Type ¶
func (data PaletteResetEntryData) Type() DataType
Type describes the entry.
type SubtitleControl ¶
type SubtitleControl uint32
SubtitleControl specifies how to interpret a subtitle entry.
func SubtitleControlForLanguage ¶
func SubtitleControlForLanguage(lang resource.Language) SubtitleControl
SubtitleControlForLanguage returns the corresponding subtitle control for given language.
func (SubtitleControl) String ¶
func (ctrl SubtitleControl) String() string
String returns the string presentation of the control value.
type SubtitleEntryData ¶
type SubtitleEntryData struct { Control SubtitleControl Text []byte }
SubtitleEntryData is an entry with Subtitle samples.
func SubtitleEntryFrom ¶
func SubtitleEntryFrom(r io.Reader, dataSize int) (SubtitleEntryData, error)
SubtitleEntryFrom decodes an entry from given data.
func (SubtitleEntryData) Bytes ¶
func (data SubtitleEntryData) Bytes() []byte
Bytes returns the raw bytes of the entry.
func (SubtitleEntryData) Type ¶
func (data SubtitleEntryData) Type() DataType
Type describes the entry.
type SubtitleHeader ¶
type SubtitleHeader struct { // Control specifies how to interpret the string content Control SubtitleControl // TextOffset specifies the offset, in bytes from beginning of entry data, where the text starts. TextOffset uint32 }
SubtitleHeader is the header structure of a subtitle data.
type Timestamp ¶
Timestamp represents a point in time using fixed resolution.
func TimestampFromDuration ¶
TimestampFromDuration creates a timestamp instance from given duration value.
func TimestampFromSeconds ¶
TimestampFromSeconds creates a timestamp instance from given floating point value.
func TimestampLimit ¶
func TimestampLimit() Timestamp
TimestampLimit returns the highest possible timestamp value.
func (Timestamp) Minus ¶
Minus returns a timestamp with given one removed from the current one. The result is clipped to 0 if subtraction would result in a negative number.
func (Timestamp) Plus ¶
Plus returns a timestamp with the given one added to the current one. The result is saturated if the addition is larger than the timestamp can hold.
func (Timestamp) ToDuration ¶
ToDuration returns the equivalent duration for this timestamp.
type UnknownEntryData ¶
UnknownEntryData is an entry that is not know to this codebase.
func UnknownEntryFrom ¶
UnknownEntryFrom decodes an entry from given data.
func (UnknownEntryData) Bytes ¶
func (data UnknownEntryData) Bytes() []byte
Bytes returns the raw bytes of the entry.
func (UnknownEntryData) Type ¶
func (data UnknownEntryData) Type() DataType
Type describes the entry.