IAudioEncoder Interface used to implement a runtime audio encoder. 更多...
#include <IAudioEncoder.h>
被 FOggVorbisEncoder, FOpusEncoder , 以及 FWavEncoder 继承.
Public 成员函数 | |
| bool | EncodeIfPossible () |
| If you'd like to run audio encoding on a separate thread, use this call. 更多... | |
| int64 | Finalize () |
| Call this once you are finished pushing audio. 更多... | |
| virtual int32 | GetCompressedPacketSize () const =0 |
| Used for internet streaming. 更多... | |
| IAudioEncoder (uint32 AudioBufferSlack, uint32 DataBufferSlack=4096) | |
| Must be constructed with AudioBufferSlack. 更多... | |
| int32 | PopData (uint8 *OutData, int32 DataSize) |
| Pop compressed data. 更多... | |
| bool | PushAudio (const float *InBuffer, int32 NumSamples, bool bEncodeIfPossible=true) |
| Call this function when audio is available. 更多... | |
Protected 成员函数 | |
| virtual bool | EncodeChunk (const TArray< float > &InAudio, TArray< uint8 > &OutBytes)=0 |
| Override this to compress InAudio to OutBytes. 更多... | |
| virtual bool | EndFile (TArray< uint8 > &OutBytes)=0 |
| Override this to compress InAudio to OutBytes. 更多... | |
| void | Init (const FSoundQualityInfo &InQualityInfo) |
| Should be called in the constructor of any implementation of IAudioEncoder. 更多... | |
| virtual int64 | SamplesRequiredPerEncode () const =0 |
| How many samples of decoded audio that are required for a single compression operation. | |
| virtual bool | StartFile (const FSoundQualityInfo &InQualityInfo, TArray< uint8 > &OutFileStart)=0 |
| This should be overridden to, give the properties in InQualityInfo, write a header into OutFileStart. 更多... | |
IAudioEncoder Interface used to implement a runtime audio encoder.
| Audio::IAudioEncoder::IAudioEncoder | ( | uint32 | AudioBufferSlack, |
| uint32 | DataBufferSlack = 4096 |
||
| ) |
Must be constructed with AudioBufferSlack.
Optionally, DataBufferSlack can be called with a different value depending on how often PushAudio, EncodeIfPossible, or PopData will be called.
|
protectedpure virtual |
Override this to compress InAudio to OutBytes.
Returns true on success, false on failure.
| bool Audio::IAudioEncoder::EncodeIfPossible | ( | ) |
If you'd like to run audio encoding on a separate thread, use this call.
Otherwise, ensure that bEncodeIfPossible is set to true when you call PushAudio.
|
protectedpure virtual |
Override this to compress InAudio to OutBytes.
Returns true on success, false on failure.
| int64 Audio::IAudioEncoder::Finalize | ( | ) |
Call this once you are finished pushing audio.
Returns the amount of bytes left to pop if positive, and if negative indicates a failiure.
|
pure virtual |
Used for internet streaming.
Should return the amount of bytes required for a self contained packet.
|
protected |
Should be called in the constructor of any implementation of IAudioEncoder.
Calls StartFile if necessary.
| int32 Audio::IAudioEncoder::PopData | ( | uint8 * | OutData, |
| int32 | DataSize | ||
| ) |
Pop compressed data.
If you are using this encoder for streaming over network, use the size returned by GetCompressedPacketSize(). Returns number of bytes written.
| bool Audio::IAudioEncoder::PushAudio | ( | const float * | InBuffer, |
| int32 | NumSamples, | ||
| bool | bEncodeIfPossible = true |
||
| ) |
Call this function when audio is available.
If you would like to handle compression on a separate thread or call, Call this function with bEncodeIfPossible set to false. Returns true if audio was successfully pushed, false, if the internal buffer is full.
|
protectedpure virtual |
This should be overridden to, give the properties in InQualityInfo, write a header into OutFileStart.
returns true on success, or false on failure.