Documentation
¶
Index ¶
- func EffectiveBitsPerSample(format SampleFormat, bitsPerSample int) int
- func IsCodecParameters[T any](p CodecParameters) bool
- func Plane[T SampleType](f *AudioFrame, planeIndex int) []T
- type AudioAttributes
- type AudioFrame
- type AudioFrameOption
- type ChannelCategory
- type ChannelLayout
- func (l ChannelLayout) AmbisonicOrder() uint8
- func (l ChannelLayout) ChannelCount() int
- func (l ChannelLayout) Contains(c ChannelPosition) bool
- func (l ChannelLayout) CustomChannels() []ChannelPosition
- func (l ChannelLayout) Enumerate() []ChannelPosition
- func (l ChannelLayout) Index(c ChannelPosition) int
- func (l ChannelLayout) IsAmbisonic() bool
- func (l ChannelLayout) IsSpatial() bool
- func (l ChannelLayout) IsUnspecified() bool
- func (l ChannelLayout) Mask() ChannelPosition
- func (l ChannelLayout) Order() ChannelCategory
- func (l ChannelLayout) String() string
- func (l *ChannelLayout) UnmarshalText(value []byte) error
- func (l ChannelLayout) Validate() error
- type ChannelPosition
- type CodecID
- type CodecParameters
- type Dts
- type Error
- type ErrorAction
- type ErrorHandler
- type Frame
- type MediaAttributes
- type MediaType
- type Packet
- type PacketKind
- type PacketOption
- type PiplineStage
- type Profile
- type Pts
- type ResourceBase
- type Retainer
- type SampleFormat
- func (f SampleFormat) BitsPerSample() int
- func (f SampleFormat) BytesPerSample() int
- func (f SampleFormat) IsFloat() bool
- func (f SampleFormat) IsInteger() bool
- func (f SampleFormat) IsPacked() bool
- func (f SampleFormat) IsPlanar() bool
- func (f SampleFormat) Packed() SampleFormat
- func (f SampleFormat) Planar() SampleFormat
- type SampleType
- type StreamInfo
- type StreamSet
- type VideoAttributes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EffectiveBitsPerSample ¶
func EffectiveBitsPerSample(format SampleFormat, bitsPerSample int) int
func IsCodecParameters ¶
func IsCodecParameters[T any](p CodecParameters) bool
func Plane ¶
func Plane[T SampleType](f *AudioFrame, planeIndex int) []T
Types ¶
type AudioAttributes ¶
type AudioAttributes struct {
SampleRate int
Format SampleFormat
BitsPerSample int
ChannelLayout ChannelLayout
}
func (AudioAttributes) ChannelCount ¶
func (a AudioAttributes) ChannelCount() int
func (AudioAttributes) EffectiveBitsPerSample ¶
func (a AudioAttributes) EffectiveBitsPerSample() int
type AudioFrame ¶
type AudioFrame struct {
ResourceBase
Format SampleFormat
// BitsPerSample is the significant sample width carried by this frame.
// It may differ from the container's nominal format width (for example,
// FLAC 12-bit samples are carried in an S16 frame).
BitsPerSample int
Layout ChannelLayout
SampleRate int
Samples int
// contains filtered or unexported fields
}
func NewAudioFrame ¶
func NewAudioFrame(format SampleFormat, layout ChannelLayout, sampleRate, samples int, opts ...AudioFrameOption) *AudioFrame
func (*AudioFrame) Planes ¶
func (f *AudioFrame) Planes() [][]byte
func (*AudioFrame) Pts ¶
func (f *AudioFrame) Pts() Pts
type AudioFrameOption ¶
type AudioFrameOption func(*AudioFrame)
func WithAudioBitsPerSample ¶
func WithAudioBitsPerSample(bitsPerSample int) AudioFrameOption
func WithAudioPts ¶
func WithAudioPts(pts Pts) AudioFrameOption
type ChannelCategory ¶
type ChannelCategory uint8
const ( OrderUnspecified ChannelCategory = iota OrderNative OrderCustom OrderAmbisonic )
type ChannelLayout ¶
type ChannelLayout struct {
// contains filtered or unexported fields
}
var ( LayoutMono1 ChannelLayout = NewNativeLayout(FrontCenter) LayoutDualMono2 ChannelLayout = NewCustomLayout(FrontCenter, FrontCenter) LayoutStereo2_0 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight) LayoutStereo2_1 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | LowFrequency) LayoutStereo3_0 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | FrontCenter) LayoutStereo3_1 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | FrontCenter | LowFrequency) LayoutSurround3_0 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | BackCenter) LayoutQuad4_0 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | BackLeft | BackRight) LayoutSideQuad4_0 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | SideLeft | SideRight) LayoutSurround4_0 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | FrontCenter | BackCenter) LayoutSurround4_1 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | FrontCenter | LowFrequency | BackCenter) LayoutFront5_0 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | FrontCenter | BackLeft | BackRight) LayoutFront5_1 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | FrontCenter | BackLeft | BackRight | LowFrequency) LayoutSide5_0 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | SideLeft | SideRight | FrontCenter) LayoutSide5_1 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | SideLeft | SideRight | FrontCenter | LowFrequency) LayoutAtmos5_1_4 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | FrontCenter | LowFrequency | BackLeft | BackRight | TopFrontLeft | TopFrontRight | TopBackLeft | TopBackRight) LayoutHexagonal6_0 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | FrontCenter | BackLeft | BackRight | BackCenter) LayoutHexagonal6_1 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | FrontCenter | LowFrequency | BackLeft | BackRight | BackCenter) LayoutFront6_0 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | FrontCenter | FrontLeftOfCenter | FrontRightOfCenter | BackCenter) LayoutSide6_0 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | SideLeft | SideRight | FrontCenter | BackCenter) LayoutSide6_1 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | SideLeft | SideRight | FrontCenter | LowFrequency | BackCenter) LayoutWide7_1 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | FrontCenter | LowFrequency | BackLeft | BackRight | FrontLeftOfCenter | FrontRightOfCenter) LayoutSide7_0 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | SideLeft | SideRight | FrontCenter | BackLeft | BackRight) LayoutSide7_1 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | SideLeft | SideRight | FrontCenter | BackLeft | BackRight | LowFrequency) LayoutSurround7_1 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | FrontCenter | LowFrequency | BackLeft | BackRight | SideLeft | SideRight) LayoutAtmos7_1_4 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | FrontCenter | LowFrequency | BackLeft | BackRight | SideLeft | SideRight | TopFrontLeft | TopFrontRight | TopBackLeft | TopBackRight) LayoutOctagonal8_0 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | FrontCenter | BackLeft | BackRight | BackCenter | SideLeft | SideRight) LayoutSurround9_0 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | FrontCenter | BackLeft | BackRight | SideLeft | SideRight | FrontLeftOfCenter | FrontRightOfCenter) LayoutSurround9_1 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | FrontCenter | LowFrequency | BackLeft | BackRight | SideLeft | SideRight | FrontLeftOfCenter | FrontRightOfCenter) LayoutSurround11_0 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | FrontCenter | BackLeft | BackRight | SideLeft | SideRight | FrontLeftOfCenter | FrontRightOfCenter | BackCenter | TopCenter) LayoutSurround11_1 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | FrontCenter | LowFrequency | BackLeft | BackRight | SideLeft | SideRight | FrontLeftOfCenter | FrontRightOfCenter | BackCenter | TopCenter) LayoutAtmos11_1_4 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | FrontCenter | LowFrequency | BackLeft | BackRight | SideLeft | SideRight | FrontLeftOfCenter | FrontRightOfCenter | BackCenter | TopCenter | TopFrontLeft | TopFrontRight | TopBackLeft | TopBackRight) LayoutAtmos11_1_6 ChannelLayout = NewNativeLayout(FrontLeft | FrontRight | FrontCenter | LowFrequency | BackLeft | BackRight | SideLeft | SideRight | FrontLeftOfCenter | FrontRightOfCenter | BackCenter | TopCenter | TopFrontLeft | TopFrontCenter | TopFrontRight | TopBackLeft | TopBackCenter | TopBackRight) )
func NewAmbisonicLayout ¶
func NewAmbisonicLayout(order uint8) ChannelLayout
func NewCustomLayout ¶
func NewCustomLayout(layout ...ChannelPosition) ChannelLayout
func NewNativeLayout ¶
func NewNativeLayout(mask ChannelPosition) ChannelLayout
func NewUnspecified ¶
func NewUnspecified(channels int) ChannelLayout
func ParseChannelLayout ¶
func ParseChannelLayout(value string) (ChannelLayout, error)
func (ChannelLayout) AmbisonicOrder ¶
func (l ChannelLayout) AmbisonicOrder() uint8
func (ChannelLayout) ChannelCount ¶
func (l ChannelLayout) ChannelCount() int
func (ChannelLayout) Contains ¶
func (l ChannelLayout) Contains(c ChannelPosition) bool
func (ChannelLayout) CustomChannels ¶
func (l ChannelLayout) CustomChannels() []ChannelPosition
func (ChannelLayout) Enumerate ¶
func (l ChannelLayout) Enumerate() []ChannelPosition
func (ChannelLayout) Index ¶
func (l ChannelLayout) Index(c ChannelPosition) int
func (ChannelLayout) IsAmbisonic ¶
func (l ChannelLayout) IsAmbisonic() bool
func (ChannelLayout) IsSpatial ¶
func (l ChannelLayout) IsSpatial() bool
func (ChannelLayout) IsUnspecified ¶
func (l ChannelLayout) IsUnspecified() bool
func (ChannelLayout) Mask ¶
func (l ChannelLayout) Mask() ChannelPosition
func (ChannelLayout) Order ¶
func (l ChannelLayout) Order() ChannelCategory
func (ChannelLayout) String ¶
func (l ChannelLayout) String() string
func (*ChannelLayout) UnmarshalText ¶
func (l *ChannelLayout) UnmarshalText(value []byte) error
func (ChannelLayout) Validate ¶
func (l ChannelLayout) Validate() error
type ChannelPosition ¶
type ChannelPosition uint64
const ( FrontLeft ChannelPosition = 1 << iota FrontRight FrontCenter LowFrequency BackLeft BackRight FrontLeftOfCenter FrontRightOfCenter BackCenter SideLeft SideRight TopCenter TopFrontLeft TopFrontCenter TopFrontRight TopBackLeft TopBackCenter TopBackRight )
type CodecParameters ¶
CodecParameters is an opaque codec configuration payload.
Consumers must only interpret Data when they recognize Schema. The type is deliberately generic so codec and container plugins can evolve without adding codec-specific fields to core media types.
func NewCodecParameters ¶
func NewCodecParameters[T any](data []byte) CodecParameters
func (CodecParameters) Clone ¶
func (p CodecParameters) Clone() CodecParameters
Clone returns an independent copy of the parameter payload.
type ErrorHandler ¶
type ErrorHandler interface {
Handle(err *Error) ErrorAction
}
type MediaAttributes ¶
type MediaAttributes struct {
Codec CodecID
CodecParameters CodecParameters
Video VideoAttributes
Audio AudioAttributes
}
type Packet ¶
type Packet struct {
ResourceBase
MediaType MediaType
StreamIndex int
Kind PacketKind
CodecParameters []CodecParameters
PTS Pts
DTS Dts
Timebase time.Rational
// contains filtered or unexported fields
}
func NewPacket ¶
func NewPacket(size int, opts ...PacketOption) *Packet
func NewPacketEvent ¶
func NewPacketEvent(kind PacketKind, streamIndex int, parameters []CodecParameters) *Packet
func NewPacketFromData ¶
func NewPacketFromData(data []byte, opts ...PacketOption) *Packet
NewPacketFromData transfers ownership of data to the returned packet. The caller must not modify or retain data after this call.
type PacketKind ¶
type PacketKind uint8
const ( PacketKindData PacketKind = iota PacketKindStreamEnd )
type PacketOption ¶
type PacketOption func(*Packet)
func WithDts ¶
func WithDts(dts Dts) PacketOption
func WithPts ¶
func WithPts(pts Pts) PacketOption
func WithStreamIndex ¶
func WithStreamIndex(idx int) PacketOption
type PiplineStage ¶
type PiplineStage string
const ( StageDemuxer PiplineStage = "demuxer" StageDecoder PiplineStage = "decoder" StageFilter PiplineStage = "filter" StageEncoder PiplineStage = "encoder" StageMuxer PiplineStage = "muxer" )
type Profile ¶
type Profile struct {
Type MediaType
MediaAttributes
}
type ResourceBase ¶
type ResourceBase struct {
// contains filtered or unexported fields
}
func (*ResourceBase) Init ¶
func (r *ResourceBase) Init(free func())
func (*ResourceBase) Release ¶
func (r *ResourceBase) Release()
func (*ResourceBase) Retain ¶
func (r *ResourceBase) Retain()
type SampleFormat ¶
type SampleFormat string
const ( SampleFormatUnknown SampleFormat = "" // Interleaved SampleFormatU8 SampleFormat = "u8" // Unsigned 8-bit SampleFormatS8 SampleFormat = "s8" // Signed 8-bit SampleFormatS16 SampleFormat = "s16" // Signed 16-bit SampleFormatS24 SampleFormat = "s24" // Signed 24-bit SampleFormatS32 SampleFormat = "s32" // Signed 32-bit SampleFormatF32 SampleFormat = "f32" // Float 32-bit SampleFormatF64 SampleFormat = "f64" // Double 64-bit // Planar SampleFormatU8P SampleFormat = "u8p" // Unsigned 8-bit SampleFormatS8P SampleFormat = "s8p" // Signed 8-bit SampleFormatS16P SampleFormat = "s16p" // Signed 16-bit SampleFormatS24P SampleFormat = "s24p" // Signed 24-bit SampleFormatS32P SampleFormat = "s32p" // Signed 32-bit SampleFormatF32P SampleFormat = "f32p" // Float 32-bit (recommended) SampleFormatF64P SampleFormat = "f64p" // Double 64-bit )
func (SampleFormat) BitsPerSample ¶
func (f SampleFormat) BitsPerSample() int
BitsPerSample returns the storage width of one sample in bits (e.g. 24 for SampleFormatS24), regardless of packed/planar layout.
func (SampleFormat) BytesPerSample ¶
func (f SampleFormat) BytesPerSample() int
func (SampleFormat) IsFloat ¶
func (f SampleFormat) IsFloat() bool
func (SampleFormat) IsInteger ¶
func (f SampleFormat) IsInteger() bool
func (SampleFormat) IsPacked ¶
func (f SampleFormat) IsPacked() bool
func (SampleFormat) IsPlanar ¶
func (f SampleFormat) IsPlanar() bool
func (SampleFormat) Packed ¶
func (f SampleFormat) Packed() SampleFormat
func (SampleFormat) Planar ¶
func (f SampleFormat) Planar() SampleFormat
type StreamInfo ¶
type StreamInfo struct {
Index int
Type MediaType
Metadata metadata.Bundle
IsDefault bool
Duration time.Duration
MediaAttributes
}
func CloneStreams ¶
func CloneStreams(streams []StreamInfo) []StreamInfo
CloneStreams returns an independent copy of streams, deep-cloning each element.
func (StreamInfo) Clone ¶
func (s StreamInfo) Clone() StreamInfo
Clone returns an independent copy that shares no state with s.
type StreamSet ¶
type StreamSet map[string]StreamInfo
StreamSet holds one StreamInfo per named port, for nodes whose ports can carry different stream shapes (e.g. a mixer's independent input/output ports).
type VideoAttributes ¶
type VideoAttributes struct {
}
Source Files
¶
- entity_codec.go
- entity_frame.go
- entity_frame_audio.go
- entity_packet.go
- entity_profile.go
- entity_resource.go
- entity_resource_base.go
- entity_stream.go
- error.go
- factory_frame_audio.go
- factory_packet.go
- prop_attributes.go
- prop_format.go
- prop_layout.go
- prop_layout_builder.go
- prop_layout_custom.go
- prop_layout_position.go
- prop_layout_presets.go
- time.go