avi

package
v0.0.0-...-4471bf5 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package avi implements the AVI file format.

See: https://learn.microsoft.com/en-us/windows/win32/directshow/avi-riff-file-reference

Index

Constants

View Source
const (
	// AVIF_HASINDEX indicates the AVI file has an index.
	AVIF_HASINDEX uint32 = 1 << 4
	// AVIF_MUSTUSEINDEX indicates that application should use the index, rather than the physical ordering of the chunks in the file, to determine the order of presentation of the data.
	AVIF_MUSTUSEINDEX uint32 = 1 << 5
	// AVIF_ISINTERLEAVED indicates the AVI file is interleaved.
	AVIF_ISINTERLEAVED uint32 = 1 << 8
	// AVIF_TRUSTCKTYPE use CKType to find key frames
	AVIF_TRUSTCKTYPE uint32 = 1 << 11
	// AVIF_WASCAPTUREFILE indicates the AVI file is a specially allocated file used for capturing real-time video.
	AVIF_WASCAPTUREFILE uint32 = 1 << 16
	// AVIF_COPYRIGHTED indicates the AVI file contains copyrighted data and software.
	AVIF_COPYRIGHTED uint32 = 1 << 17
)
View Source
const (
	// AVISF_DISABLED indicates this stream should not be enabled by default.
	AVISF_DISABLED uint32 = 1 << 0
	// AVISF_VIDEO_PALCHANGES indicates this video stream contains palette changes.
	AVISF_VIDEO_PALCHANGES uint32 = 1 << 16
)
View Source
const (
	// AVIIF_LIST indicates that the data chunk is a 'rec ' list.
	AVIIF_LIST uint32 = 1 << 0
	// AVIIF_KEYFRAME indicates that the data chunk is a key frame.
	AVIIF_KEYFRAME uint32 = 1 << 4
	// AVIIF_NO_TIME indicates that the data chunk does not affect the timing of the stream.
	AVIIF_NO_TIME uint32 = 1 << 8
)

Variables

View Source
var (
	AVI = riff.FourCC{'A', 'V', 'I', ' '}

	ListINFO = riff.FourCC{'I', 'N', 'F', 'O'}
	ListHRDL = riff.FourCC{'h', 'd', 'r', 'l'}
	ListSTRL = riff.FourCC{'s', 't', 'r', 'l'}
	ListMOVI = riff.FourCC{'m', 'o', 'v', 'i'}

	ChunkAVIH = riff.FourCC{'a', 'v', 'i', 'h'} // AVI header

	ChunkSTRH = riff.FourCC{'s', 't', 'r', 'h'} // Stream header
	ChunkSTRF = riff.FourCC{'s', 't', 'r', 'f'} // Stream format
	ChunkSTRD = riff.FourCC{'s', 't', 'r', 'd'} // Stream-header data
	ChunkSTRN = riff.FourCC{'s', 't', 'r', 'n'} // Stream name
	ChunkIDX1 = riff.FourCC{'i', 'd', 'x', '1'}
	ChunkINDX = riff.FourCC{'i', 'n', 'd', 'x'}
)
View Source
var (
	StreamTypeDB = StreamType{'d', 'b'} // Uncompressed video frame
	StreamTypeDC = StreamType{'d', 'c'} // Compressed video frame
	StreamTypePC = StreamType{'p', 'c'} // Palette change
	StreamTypeWB = StreamType{'w', 'b'} // Audio data
)
View Source
var (
	StreamTypeAUDS = riff.FourCC{'a', 'u', 'd', 's'}
	StreamTypeMIDS = riff.FourCC{'m', 'i', 'd', 's'}
	StreamTypeTXTS = riff.FourCC{'t', 'x', 't', 's'}
	StreamTypeVIDS = riff.FourCC{'v', 'i', 'd', 's'}
)

Functions

func NewStreamID

func NewStreamID(id uint8, streamType StreamType) riff.FourCC

Types

type MainHeader

type MainHeader [56]byte

MainHeader defines global information in an AVI file.

See: https://learn.microsoft.com/en-us/previous-versions/windows/desktop/api/Aviriff/ns-aviriff-avimainheader

func (*MainHeader) Flags

func (h *MainHeader) Flags() uint32

func (*MainHeader) Height

func (h *MainHeader) Height() uint32

Height specifies the height of the AVI file in pixels.

func (*MainHeader) InitialFrames

func (h *MainHeader) InitialFrames() uint32

InitialFrames specifies the initial frame for interleaved files.

func (*MainHeader) MaxBytesPerSec

func (h *MainHeader) MaxBytesPerSec() uint32

MaxBytesPerSec specifies the approximate maximum data rate of the file.

func (*MainHeader) MicroSecPerFrame

func (h *MainHeader) MicroSecPerFrame() uint32

MicroSecPerFrame specifies the number of microseconds between frames.

func (*MainHeader) PaddingGranularity

func (h *MainHeader) PaddingGranularity() uint32

PaddingGranularity specifies the alignment for data, in bytes.

func (*MainHeader) SetFlags

func (h *MainHeader) SetFlags(v uint32)

func (*MainHeader) SetHeight

func (h *MainHeader) SetHeight(v uint32)

func (*MainHeader) SetInitialFrames

func (h *MainHeader) SetInitialFrames(v uint32)

func (*MainHeader) SetMaxBytesPerSec

func (h *MainHeader) SetMaxBytesPerSec(v uint32)

func (*MainHeader) SetMicroSecPerFrame

func (h *MainHeader) SetMicroSecPerFrame(v uint32)

func (*MainHeader) SetPaddingGranularity

func (h *MainHeader) SetPaddingGranularity(v uint32)

func (*MainHeader) SetStreams

func (h *MainHeader) SetStreams(v uint32)

func (*MainHeader) SetSuggestedBufferSize

func (h *MainHeader) SetSuggestedBufferSize(v uint32)

func (*MainHeader) SetTotalFrames

func (h *MainHeader) SetTotalFrames(v uint32)

func (*MainHeader) SetWidth

func (h *MainHeader) SetWidth(v uint32)

func (*MainHeader) Streams

func (h *MainHeader) Streams() uint32

Streams specifies the number of streams in the file.

func (*MainHeader) SuggestedBufferSize

func (h *MainHeader) SuggestedBufferSize() uint32

SuggestedBufferSize specifies the suggested buffer size for reading the file.

func (*MainHeader) TotalFrames

func (h *MainHeader) TotalFrames() uint32

TotalFrames specifies the total number of frames of data in the file.

func (*MainHeader) Width

func (h *MainHeader) Width() uint32

Width specifies the width of the AVI file in pixels.

type StreamFormat

type StreamFormat [40]byte

func (*StreamFormat) BitCount

func (f *StreamFormat) BitCount() uint16

func (*StreamFormat) ClrImportant

func (f *StreamFormat) ClrImportant() uint32

func (*StreamFormat) ClrUsed

func (f *StreamFormat) ClrUsed() uint32

func (*StreamFormat) Compression

func (f *StreamFormat) Compression() uint32

func (*StreamFormat) Height

func (f *StreamFormat) Height() uint32

func (*StreamFormat) Planes

func (f *StreamFormat) Planes() uint16

func (*StreamFormat) SetBitCount

func (f *StreamFormat) SetBitCount(v uint16)

func (*StreamFormat) SetClrImportant

func (f *StreamFormat) SetClrImportant(v uint32)

func (*StreamFormat) SetClrUsed

func (f *StreamFormat) SetClrUsed(v uint32)

func (*StreamFormat) SetCompression

func (f *StreamFormat) SetCompression(v uint32)

func (*StreamFormat) SetHeight

func (f *StreamFormat) SetHeight(v uint32)

func (*StreamFormat) SetPlanes

func (f *StreamFormat) SetPlanes(v uint16)

func (*StreamFormat) SetSize

func (f *StreamFormat) SetSize(v uint32)

func (*StreamFormat) SetSizeImage

func (f *StreamFormat) SetSizeImage(v uint32)

func (*StreamFormat) SetWidth

func (f *StreamFormat) SetWidth(v uint32)

func (*StreamFormat) SetXPelsPerMeter

func (f *StreamFormat) SetXPelsPerMeter(v uint32)

func (*StreamFormat) SetYPelsPerMeter

func (f *StreamFormat) SetYPelsPerMeter(v uint32)

func (*StreamFormat) Size

func (f *StreamFormat) Size() uint32

func (*StreamFormat) SizeImage

func (f *StreamFormat) SizeImage() uint32

func (*StreamFormat) Width

func (f *StreamFormat) Width() uint32

func (*StreamFormat) XPelsPerMeter

func (f *StreamFormat) XPelsPerMeter() uint32

func (*StreamFormat) YPelsPerMeter

func (f *StreamFormat) YPelsPerMeter() uint32

type StreamHeader

type StreamHeader [56]byte

func (*StreamHeader) Flags

func (h *StreamHeader) Flags() uint32

func (*StreamHeader) Handler

func (h *StreamHeader) Handler() riff.FourCC

Handler returns a FOURCC that optionally identifies a specific data handler.

func (*StreamHeader) InitialFrames

func (h *StreamHeader) InitialFrames() uint32

func (*StreamHeader) Length

func (h *StreamHeader) Length() uint32

func (*StreamHeader) Priority

func (h *StreamHeader) Priority() uint16

func (*StreamHeader) Quality

func (h *StreamHeader) Quality() uint32

func (*StreamHeader) Rate

func (h *StreamHeader) Rate() uint32

func (*StreamHeader) SampleSize

func (h *StreamHeader) SampleSize() uint32

func (*StreamHeader) Scale

func (h *StreamHeader) Scale() uint32

func (*StreamHeader) SetFlags

func (h *StreamHeader) SetFlags(v uint32)

func (*StreamHeader) SetHandler

func (h *StreamHeader) SetHandler(v riff.FourCC)

func (*StreamHeader) SetInitialFrames

func (h *StreamHeader) SetInitialFrames(v uint32)

func (*StreamHeader) SetLength

func (h *StreamHeader) SetLength(v uint32)

func (*StreamHeader) SetPriority

func (h *StreamHeader) SetPriority(v uint16)

func (*StreamHeader) SetQuality

func (h *StreamHeader) SetQuality(v uint32)

func (*StreamHeader) SetRate

func (h *StreamHeader) SetRate(v uint32)

func (*StreamHeader) SetSampleSize

func (h *StreamHeader) SetSampleSize(v uint32)

func (*StreamHeader) SetScale

func (h *StreamHeader) SetScale(v uint32)

func (*StreamHeader) SetStart

func (h *StreamHeader) SetStart(v uint32)

func (*StreamHeader) SetSuggestedBufferSize

func (h *StreamHeader) SetSuggestedBufferSize(v uint32)

func (*StreamHeader) SetType

func (h *StreamHeader) SetType(v riff.FourCC)

func (*StreamHeader) Start

func (h *StreamHeader) Start() uint32

func (*StreamHeader) SuggestedBufferSize

func (h *StreamHeader) SuggestedBufferSize() uint32

func (*StreamHeader) Type

func (h *StreamHeader) Type() riff.FourCC

Type returns the type of the data contained in the stream.

type StreamType

type StreamType [2]byte

type Writer

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

func NewWriter

func NewWriter(w io.WriterAt) (*Writer, error)

func (*Writer) Close

func (w *Writer) Close() error

func (*Writer) MaxLen

func (w *Writer) MaxLen() uint32

func (*Writer) WriteData

func (w *Writer) WriteData(id riff.FourCC, b []byte, flags uint32) error

func (*Writer) WriteHeader

func (w *Writer) WriteHeader(sh StreamHeader, sf StreamFormat) error

WriteHeader writes the header and metadata information into the first 2048 bytes of the given io.WriterAt.

WriteHeader should be called last as it requires information like total frames.

Jump to

Keyboard shortcuts

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