codec

package
v0.0.0-...-163e08f Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

The aac decoder, to decode the encoded aac frame to PCM samples.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AacDecoder

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

func NewAacDecoder

func NewAacDecoder() *AacDecoder

func (*AacDecoder) AacNumChannels

func (v *AacDecoder) AacNumChannels() int

The number of audio channels after AAC core processing (before PS or MPS processing).

CAUTION: This are not the final number of output channels!

@remark Decoder internal members.

func (*AacDecoder) AacSampleRate

func (v *AacDecoder) AacSampleRate() int

sampling rate in Hz without SBR (from configuration info). @remark Decoder internal members.

func (*AacDecoder) AacSamplesPerFrame

func (v *AacDecoder) AacSamplesPerFrame() int

Samples per frame for the AAC core (from ASC).

1024 or 960 for AAC-LC
512 or 480 for AAC-LD and AAC-ELD

@remark Decoder internal members.

func (*AacDecoder) AudioObjectType

func (v *AacDecoder) AudioObjectType() int

Audio Object Type (from ASC): is set to the appropriate value for MPEG-2 bitstreams (e. g. 2 for AAC-LC). @remark Decoder internal members.

func (*AacDecoder) Bitrate

func (v *AacDecoder) Bitrate() int

Instantaneous bit rate. @remark Decoder internal members.

func (*AacDecoder) ChannelConfig

func (v *AacDecoder) ChannelConfig() int

Channel configuration (0: PCE defined, 1: mono, 2: stereo, ... @remark Decoder internal members.

func (*AacDecoder) Close

func (v *AacDecoder) Close() error

De-allocate all resources of an AAC decoder instance.

func (*AacDecoder) Decode

func (v *AacDecoder) Decode(frame []byte) (pcm []byte, err error)

Decode one audio frame. @param the frame contains encoded aac frame, optional can be nil. @eturn when pcm is nil, should fill more bytes and decode again.

func (*AacDecoder) ExtensionAudioObjectType

func (v *AacDecoder) ExtensionAudioObjectType() int

Extension Audio Object Type (from ASC) @remark Decoder internal members.

func (*AacDecoder) ExtensionSamplingRate

func (v *AacDecoder) ExtensionSamplingRate() int

Extension sampling rate in Hz (from ASC) @remark Decoder internal members.

func (*AacDecoder) FrameSize

func (v *AacDecoder) FrameSize() int

The frame size of the decoded PCM audio signal.

1024 or 960 for AAC-LC
2048 or 1920 for HE-AAC (v2)
512 or 480 for AAC-LD and AAC-ELD

@remark The only really relevant ones for the user.

func (*AacDecoder) InitAdts

func (v *AacDecoder) InitAdts() (err error)

Open the decoder in ADTS mode without ASC, we never know the stream info util got the first frame, because the codec info is insert at begin of each frame. @remark The frame to Decode() is muxed in ADTS format.

func (*AacDecoder) InitRaw

func (v *AacDecoder) InitRaw(asc []byte) (err error)

Open the decoder in RAW mode with ASC. For example, the FLV audio payload is a SequenceHeader(ASC) or RAW AAC data, user can init the decoder with ASC and decode the raw data. @remark user should never get the info util decode one frame.

func (*AacDecoder) NumBadAccessUnits

func (v *AacDecoder) NumBadAccessUnits() int

This is the number of total access units that were considered with errors from numTotalBytes. @remark Statistics.

func (*AacDecoder) NumBadBytes

func (v *AacDecoder) NumBadBytes() int

This is the number of total bytes that were considered with errors from numTotalBytes. @remark Statistics.

func (*AacDecoder) NumChannels

func (v *AacDecoder) NumChannels() int

The number of output audio channels in the decoded and interleaved PCM audio signal. @remark The only really relevant ones for the user.

func (*AacDecoder) NumLostAccessUnits

func (v *AacDecoder) NumLostAccessUnits() int

This integer will reflect the estimated amount of lost access units in case aacDecoder_DecodeFrame() returns AAC_DEC_TRANSPORT_SYNC_ERROR. It will be < 0 if the estimation failed. @remark Statistics.

func (*AacDecoder) NumTotalAccessUnits

func (v *AacDecoder) NumTotalAccessUnits() int

This is the number of total access units that have passed through the decoder. @remark Statistics.

func (*AacDecoder) NumTotalBytes

func (v *AacDecoder) NumTotalBytes() int

This is the number of total bytes that have passed through the decoder. @remark Statistics.

func (*AacDecoder) Profile

func (v *AacDecoder) Profile() int

MPEG-2 profile (from file header) (-1: not applicable (e. g. MPEG-4)). @remark Decoder internal members.

func (*AacDecoder) SampleBits

func (v *AacDecoder) SampleBits() int

The bits of a sample, the fdk aac always use 16bits sample.

func (*AacDecoder) SampleRate

func (v *AacDecoder) SampleRate() int

The samplerate in Hz of the fully decoded PCM audio signal (after SBR processing). @remark The only really relevant ones for the user.

type PaStream

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

func (*PaStream) Close

func (s *PaStream) Close() error

func (*PaStream) Init

func (s *PaStream) Init(callBack StreamCallback) error

func (*PaStream) SetVolume

func (s *PaStream) SetVolume(volume float64) error

func (*PaStream) Start

func (s *PaStream) Start() error

func (*PaStream) Stop

func (s *PaStream) Stop() error

type SetSinkVolume

type SetSinkVolume struct {
	SinkIndex uint32
	SinkName  string
	Volume    uint32
}

type Stream

type Stream interface {
	io.Closer
	Init(callBack StreamCallback) error
	Start() error
	Stop() error
	SetVolume(volume float64) error
}

func NewStream

func NewStream() Stream

type StreamCallback

type StreamCallback func(out []int16, currentTime time.Duration, outputBufferDacTime time.Duration)

Jump to

Keyboard shortcuts

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