device

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InitTimer uint32 = (1 << iota)
	InitVideo
	InitAudio
	InitEvent
)

Flag Define

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioBuffer

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

AudioBuffer audio play buffer

func NewAudioBuffer

func NewAudioBuffer(bufferCount int,
	frequency int,
	samples int,
) *AudioBuffer

NewAudioBuffer create new audio buffer

func (*AudioBuffer) AddBuffer

func (buffer *AudioBuffer) AddBuffer(data []byte)

AddBuffer add date to buffer

func (*AudioBuffer) Channels

func (buffer *AudioBuffer) Channels() av.ChannelLayout

Channels channel layout

func (*AudioBuffer) Format

func (buffer *AudioBuffer) Format() av.SampleFormat

Format sample format

func (*AudioBuffer) Frequency

func (buffer *AudioBuffer) Frequency() int

Frequency freq

func (*AudioBuffer) Process

func (buffer *AudioBuffer) Process(byteLength int) (rslt []byte)

Process process buffer

func (*AudioBuffer) RecommendSampleCount

func (buffer *AudioBuffer) RecommendSampleCount() int

RecommendSampleCount recommended sample count

type AudioFormat

type AudioFormat int

AudioFormat audio format define

type AudioFrequencySampler

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

AudioFrequencySampler generate sampling audio

func NewFrequencySampler

func NewFrequencySampler(baseFrequency int, layout av.ChannelLayout, freqInfo []int, samples int) (*AudioFrequencySampler, error)

NewFrequencySampler create new sampler

func (*AudioFrequencySampler) Channels

func (sampler *AudioFrequencySampler) Channels() av.ChannelLayout

Channels return channel layout

func (*AudioFrequencySampler) Format

func (sampler *AudioFrequencySampler) Format() av.SampleFormat

Format audio format

func (*AudioFrequencySampler) Frequency

func (sampler *AudioFrequencySampler) Frequency() int

Frequency base frequency

func (*AudioFrequencySampler) Process

func (sampler *AudioFrequencySampler) Process(len int) (rslt []byte)

Process process sampler

func (*AudioFrequencySampler) RecommendSampleCount

func (sampler *AudioFrequencySampler) RecommendSampleCount() int

RecommendSampleCount sampling count

type AudioProcessor

type AudioProcessor interface {
	Process(len int) []byte
	Frequency() int
	Format() av.SampleFormat
	Channels() av.ChannelLayout
	RecommendSampleCount() int
}

AudioProcessor interface

type PacketDecoder

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

PacketDecoder audio packet decoder

func NewPacketDecoder

func NewPacketDecoder(srcCodec av.AudioCodecData,
	dstLayout av.ChannelLayout,
	dstFrequency int,
	bufferCount int,
) *PacketDecoder

NewPacketDecoder make new packet decoder

func (*PacketDecoder) Channels

func (decoder *PacketDecoder) Channels() av.ChannelLayout

Channels channel layout

func (*PacketDecoder) Decode

func (decoder *PacketDecoder) Decode(pkt av.Packet) (err error)

Decode decode packet

func (*PacketDecoder) Format

func (decoder *PacketDecoder) Format() av.SampleFormat

Format sample format

func (*PacketDecoder) Frequency

func (decoder *PacketDecoder) Frequency() int

Frequency freq

func (*PacketDecoder) Initialize

func (decoder *PacketDecoder) Initialize() (err error)

Initialize initialize decoder

func (*PacketDecoder) Process

func (decoder *PacketDecoder) Process(byteLength int) (rslt []byte)

Process process buffer

func (*PacketDecoder) RecommendSampleCount

func (decoder *PacketDecoder) RecommendSampleCount() (samples int)

RecommendSampleCount recommended sample count

type PacketTranscoder

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

PacketTranscoder struct for transcoder

func NewTranscoder

func NewTranscoder(src av.AudioCodecData,
	forceDecoding bool,
	codec av.CodecType,
	sampleRate int,
	layout av.ChannelLayout,
	bitrate int,
	options *map[string]interface{},
) (trans *PacketTranscoder, err error)

NewTranscoder create new transcoder instance

func (*PacketTranscoder) Close

func (trans *PacketTranscoder) Close() (err error)

Close close transcoder

func (*PacketTranscoder) Do

func (trans *PacketTranscoder) Do(src av.Packet) (out []av.Packet, err error)

Do the transcode

func (*PacketTranscoder) OutCodecData

func (trans *PacketTranscoder) OutCodecData() (codecData av.AudioCodecData)

OutCodecData Output AudioCodecData

func (*PacketTranscoder) Setup

func (trans *PacketTranscoder) Setup() (err error)

Setup Transcoder setup

type Service

type Service struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Service sdl device context

func (*Service) Initialize

func (service *Service) Initialize(capability uint32,
	audioContext AudioProcessor)

Initialize initialize service

func (*Service) Start

func (service *Service) Start() (err error)

Start start service

func (*Service) Status

func (service *Service) Status() bool

Status read service status

func (*Service) Stop

func (service *Service) Stop()

Stop stop service

Jump to

Keyboard shortcuts

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