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) 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).
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) 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).