Documentation ¶
Index ¶
- type SwrContext
- func (swrCtx *SwrContext) Close()
- func (swrCtx *SwrContext) Convert(in []byte, inCount int) ([]byte, int)
- func (swrCtx *SwrContext) ConvertChan(ctx context.Context, inChan <-chan []byte) (context.Context, chan<- []byte)
- func (swrCtx *SwrContext) ConvertFrame(input *goavutil.AVFrame) (*goavutil.AVFrame, int)
- func (swrCtx *SwrContext) ConvertFrameChan(ctx context.Context, inputChan <-chan *goavutil.AVFrame) (context.Context, <-chan *goavutil.AVFrame)
- func (swrCtx *SwrContext) ConvertFrameToFrame(output *goavutil.AVFrame, input *goavutil.AVFrame) int
- func (swrCtx *SwrContext) ConvertUnsafeToUnsafe(out *unsafe.Pointer, outCount int, in *unsafe.Pointer, inCount int) int
- func (swrCtx *SwrContext) DropOutput(count int) int
- func (swrCtx *SwrContext) Free()
- func (swrCtx *SwrContext) GetDelay(base int64) int64
- func (swrCtx *SwrContext) GetInChLayout() (*goavutil.AVChannelLayout, int)
- func (swrCtx *SwrContext) GetInSampleFmt() (avutil.CAVSampleFormat, int)
- func (swrCtx *SwrContext) GetInSampleRate() (int64, int)
- func (swrCtx *SwrContext) GetOutChLayout() (*goavutil.AVChannelLayout, int)
- func (swrCtx *SwrContext) GetOutSampleFmt() (avutil.CAVSampleFormat, int)
- func (swrCtx *SwrContext) GetOutSampleRate() (int64, int)
- func (swrCtx *SwrContext) Init() int
- func (swrCtx *SwrContext) InjectSilence(count int) int
- func (swrCtx *SwrContext) IsInitialized() bool
- func (swrCtx *SwrContext) NextPts(pts int64) int64
- func (swrCtx *SwrContext) SetChannelMapping() int
- func (swrCtx *SwrContext) SetCompensation(pts int64, sampleDelta int, compensationDistance int) int
- func (swrCtx *SwrContext) SetInChLayout(layout *goavutil.AVChannelLayout) int
- func (swrCtx *SwrContext) SetInSampleFmt(fmt avutil.CAVSampleFormat) int
- func (swrCtx *SwrContext) SetInSampleRate(sampleRate int64) int
- func (swrCtx *SwrContext) SetMatrix() int
- func (swrCtx *SwrContext) SetOutChLayout(layout *goavutil.AVChannelLayout) int
- func (swrCtx *SwrContext) SetOutSampleFmt(fmt avutil.CAVSampleFormat) int
- func (swrCtx *SwrContext) SetOutSampleRate(sampleRate int64) int
- func (swrCtx *SwrContext) SwrConfigFrame(output *goavutil.AVFrame, input *goavutil.AVFrame) int
- func (swrCtx *SwrContext) SwrGetOutSamples(inSamples int) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SwrContext ¶
type SwrContext struct {
CSwrContext *swresample.CSwrContext
}
func NewSwrContext ¶
func NewSwrContext() *SwrContext
func NewSwrContextWithOpts ¶
func NewSwrContextWithOpts(outChLayout *goavutil.AVChannelLayout, outSampleFmt avutil.CAVSampleFormat, outSampleRate int, inChLayout *goavutil.AVChannelLayout, inSampleFmt avutil.CAVSampleFormat, inSampleRate int) (*SwrContext, int)
func (*SwrContext) Close ¶ added in v0.0.4
func (swrCtx *SwrContext) Close()
func (*SwrContext) Convert ¶
func (swrCtx *SwrContext) Convert(in []byte, inCount int) ([]byte, int)
Convert slice to new slice.
func (*SwrContext) ConvertChan ¶ added in v0.0.4
func (swrCtx *SwrContext) ConvertChan(ctx context.Context, inChan <-chan []byte) (context.Context, chan<- []byte)
Convert frame data from channel.
Parameter:
ctx: The context.Context to cancel this goroutine. inChan: The []byte channel.
Return:
context.Context: The context.Context to get the cause of this gorouine. <-chan []byte: The channel to read converted frame data.
Example:
ctx, outDataCh = trans.swrCtx.ConvertChan(parentCtx, inDataCh) for { select { case <-ctx.Done(): break loop case outData, ok := <-outDataCh: if !ok { break loop } // do something. } } err := context.Cause(ctx) if err != nil { panic(err) }
func (*SwrContext) ConvertFrame ¶
Convert AVFrame to new AVFrame.
Example:
outFrame, code := ConvertFrame(inFrame)
func (*SwrContext) ConvertFrameChan ¶ added in v0.0.4
func (swrCtx *SwrContext) ConvertFrameChan(ctx context.Context, inputChan <-chan *goavutil.AVFrame) (context.Context, <-chan *goavutil.AVFrame)
Convert AVFrame from channel.
Parameter:
ctx: The context.Context to cancel this goroutine. inputChan: The AVFrame channel.
Return:
context.Context: The context.Context to get the cause of this gorouine. <-chan *goavutil.AVFrame: The channel to read converted AVFrame.
Example:
ctx, outFrameCh = trans.swrCtx.ConvertFrameChan(parentCtx, inFrameCh) for { select { case <-ctx.Done(): break loop case frame, ok := <-outFrameCh: if !ok { break loop } // do something. } } err := context.Cause(ctx) if err != nil { panic(err) }
func (*SwrContext) ConvertFrameToFrame ¶ added in v0.0.4
func (swrCtx *SwrContext) ConvertFrameToFrame(output *goavutil.AVFrame, input *goavutil.AVFrame) int
Convert AVFrame to existing AVFrame.
Example:
output := goavutil.AllocAVFrame() output.SetChLayout(outChLayout) output.SetSampleRate(int(outSampleRate)) output.SetFormat(int(outSampleFmt)) code := swrCtx.ConvertFrameToFrame(output, input)
func (*SwrContext) ConvertUnsafeToUnsafe ¶ added in v0.0.4
func (swrCtx *SwrContext) ConvertUnsafeToUnsafe(out *unsafe.Pointer, outCount int, in *unsafe.Pointer, inCount int) int
Convert pointer to pointer.
func (*SwrContext) DropOutput ¶ added in v0.0.4
func (swrCtx *SwrContext) DropOutput(count int) int
func (*SwrContext) Free ¶
func (swrCtx *SwrContext) Free()
func (*SwrContext) GetDelay ¶
func (swrCtx *SwrContext) GetDelay(base int64) int64
func (*SwrContext) GetInChLayout ¶
func (swrCtx *SwrContext) GetInChLayout() (*goavutil.AVChannelLayout, int)
func (*SwrContext) GetInSampleFmt ¶
func (swrCtx *SwrContext) GetInSampleFmt() (avutil.CAVSampleFormat, int)
func (*SwrContext) GetInSampleRate ¶
func (swrCtx *SwrContext) GetInSampleRate() (int64, int)
func (*SwrContext) GetOutChLayout ¶
func (swrCtx *SwrContext) GetOutChLayout() (*goavutil.AVChannelLayout, int)
func (*SwrContext) GetOutSampleFmt ¶
func (swrCtx *SwrContext) GetOutSampleFmt() (avutil.CAVSampleFormat, int)
func (*SwrContext) GetOutSampleRate ¶
func (swrCtx *SwrContext) GetOutSampleRate() (int64, int)
func (*SwrContext) Init ¶
func (swrCtx *SwrContext) Init() int
func (*SwrContext) InjectSilence ¶ added in v0.0.4
func (swrCtx *SwrContext) InjectSilence(count int) int
func (*SwrContext) IsInitialized ¶ added in v0.0.4
func (swrCtx *SwrContext) IsInitialized() bool
func (*SwrContext) NextPts ¶ added in v0.0.4
func (swrCtx *SwrContext) NextPts(pts int64) int64
func (*SwrContext) SetChannelMapping ¶ added in v0.0.4
func (swrCtx *SwrContext) SetChannelMapping() int
func (*SwrContext) SetCompensation ¶ added in v0.0.4
func (swrCtx *SwrContext) SetCompensation(pts int64, sampleDelta int, compensationDistance int) int
func (*SwrContext) SetInChLayout ¶
func (swrCtx *SwrContext) SetInChLayout(layout *goavutil.AVChannelLayout) int
func (*SwrContext) SetInSampleFmt ¶
func (swrCtx *SwrContext) SetInSampleFmt(fmt avutil.CAVSampleFormat) int
func (*SwrContext) SetInSampleRate ¶
func (swrCtx *SwrContext) SetInSampleRate(sampleRate int64) int
func (*SwrContext) SetMatrix ¶ added in v0.0.4
func (swrCtx *SwrContext) SetMatrix() int
func (*SwrContext) SetOutChLayout ¶
func (swrCtx *SwrContext) SetOutChLayout(layout *goavutil.AVChannelLayout) int
func (*SwrContext) SetOutSampleFmt ¶
func (swrCtx *SwrContext) SetOutSampleFmt(fmt avutil.CAVSampleFormat) int
func (*SwrContext) SetOutSampleRate ¶
func (swrCtx *SwrContext) SetOutSampleRate(sampleRate int64) int
func (*SwrContext) SwrConfigFrame ¶ added in v0.0.4
func (*SwrContext) SwrGetOutSamples ¶ added in v0.0.4
func (swrCtx *SwrContext) SwrGetOutSamples(inSamples int) int
Click to show internal directories.
Click to hide internal directories.