frame

package
v1.10.2 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: Apache-2.0 Imports: 2 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioFrame

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

AudioFrame is a decoded (or to-be-encoded) audio frame.

func NewAudioFrame

func NewAudioFrame(stream int) (*AudioFrame, error)

NewAudioFrame allocates an audio frame for the given stream.

func (*AudioFrame) AllocateBuffers

func (f *AudioFrame) AllocateBuffers() error

AllocateBuffers allocates sample/pixel data buffers for the frame based on its currently-set format fields (sample format, channel layout and number of samples for audio; width, height and pixel format for video).

func (*AudioFrame) Close

func (f *AudioFrame) Close() error

Close releases the frame's resources.

func (*AudioFrame) IncPts

func (f *AudioFrame) IncPts(v int64)

IncPts advances the frame's Pts by v.

func (*AudioFrame) MakeWritable

func (f *AudioFrame) MakeWritable() error

MakeWritable ensures the frame's data buffers are exclusively owned before mutating them in place. Needed before reusing the same Frame for a second call to Encoder.Encode, since the encoder may retain a reference to the buffer from the first call.

func (*AudioFrame) SetStream added in v1.9.3

func (f *AudioFrame) SetStream(stream int)

SetStream reassigns the stream this frame is tagged as belonging to - used when the stream numbering a frame was decoded with doesn't match the numbering an output needs it encoded under (e.g. task/encoder, which extracts a subset of an input's streams into a densely, zero-based renumbered output).

func (*AudioFrame) Stream

func (f *AudioFrame) Stream() int

type Frame

type Frame interface {
	Stream() int   // The stream this frame belongs to
	SetStream(int) // Reassign the stream this frame belongs to
	Close() error  // Release the frame's resources
}

Frame is the decoded (or to-be-encoded) output for a single stream. It is implemented by AudioFrame and VideoFrame (both backed by an AVFrame - the same underlying FFmpeg struct for either kind) and SubtitleFrame (backed by an AVSubtitle, which FFmpeg represents and codes completely separately from AVFrame, via its own legacy encode/decode API).

type SubtitleFrame

type SubtitleFrame struct {
	*ff.AVSubtitle
	// contains filtered or unexported fields
}

SubtitleFrame is a decoded (or to-be-encoded) subtitle.

func NewSubtitleFrame

func NewSubtitleFrame(stream int, sub *ff.AVSubtitle) *SubtitleFrame

NewSubtitleFrame wraps an already-populated AVSubtitle - either decoded by Decoder, or built by the caller for Encoder.Encode - for the given stream.

func (*SubtitleFrame) Close

func (f *SubtitleFrame) Close() error

Close releases the subtitle's resources.

func (*SubtitleFrame) SetStream added in v1.9.3

func (f *SubtitleFrame) SetStream(stream int)

SetStream reassigns the stream this frame is tagged as belonging to - see mediaFrame.SetStream.

func (*SubtitleFrame) Stream

func (f *SubtitleFrame) Stream() int

type VideoFrame

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

VideoFrame is a decoded (or to-be-encoded) video frame.

func NewVideoFrame

func NewVideoFrame(stream int) (*VideoFrame, error)

NewVideoFrame allocates a video frame for the given stream.

func (*VideoFrame) AllocateBuffers

func (f *VideoFrame) AllocateBuffers() error

AllocateBuffers allocates sample/pixel data buffers for the frame based on its currently-set format fields (sample format, channel layout and number of samples for audio; width, height and pixel format for video).

func (*VideoFrame) Close

func (f *VideoFrame) Close() error

Close releases the frame's resources.

func (*VideoFrame) IncPts

func (f *VideoFrame) IncPts(v int64)

IncPts advances the frame's Pts by v.

func (*VideoFrame) MakeWritable

func (f *VideoFrame) MakeWritable() error

MakeWritable ensures the frame's data buffers are exclusively owned before mutating them in place. Needed before reusing the same Frame for a second call to Encoder.Encode, since the encoder may retain a reference to the buffer from the first call.

func (*VideoFrame) SetStream added in v1.9.3

func (f *VideoFrame) SetStream(stream int)

SetStream reassigns the stream this frame is tagged as belonging to - used when the stream numbering a frame was decoded with doesn't match the numbering an output needs it encoded under (e.g. task/encoder, which extracts a subset of an input's streams into a densely, zero-based renumbered output).

func (*VideoFrame) Stream

func (f *VideoFrame) Stream() int

Jump to

Keyboard shortcuts

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