UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
IStreamedCompressedInfo Class Referenceabstract

#include <AudioDecompress.h>

+ Inheritance diagram for IStreamedCompressedInfo:

Public Member Functions

ENGINE_API IStreamedCompressedInfo ()
 
virtual ENGINE_API ~IStreamedCompressedInfo ()
 
virtual ENGINE_API bool ReadCompressedInfo (const uint8 *InSrcBufferData, uint32 InSrcBufferDataSize, FSoundQualityInfo *QualityInfo) override
 
virtual ENGINE_API bool ReadCompressedData (uint8 *Destination, bool bLooping, uint32 BufferSize) override
 
virtual ENGINE_API void SeekToTime (const float SeekTime) override
 
virtual ENGINE_API void SeekToFrame (const uint32 SeekFrame) override
 
virtual ENGINE_API void ExpandFile (uint8 *DstBuffer, struct FSoundQualityInfo *QualityInfo) override
 
virtual void EnableHalfRate (bool HalfRate) override
 
virtual uint32 GetSourceBufferSize () const override
 
virtual bool UsesVorbisChannelOrdering () const override
 
virtual int GetStreamBufferSize () const override
 
virtual bool SupportsStreaming () const override
 
virtual ENGINE_API bool StreamCompressedInfoInternal (const FSoundWaveProxyPtr &InWaveProxy, FSoundQualityInfo *QualityInfo) override
 
virtual ENGINE_API bool StreamCompressedData (uint8 *Destination, bool bLooping, uint32 BufferSize, int32 &OutNumBytesStreamed) override
 
virtual int32 GetCurrentChunkIndex () const override
 
virtual int32 GetCurrentChunkOffset () const override
 
virtual bool IsStreamedCompressedInfo () const override
 
virtual bool ParseHeader (const uint8 *InSrcBufferData, uint32 InSrcBufferDataSize, FSoundQualityInfo *QualityInfo)=0
 
virtual bool CreateDecoder ()=0
 
virtual FDecodeResult Decode (const uint8 *CompressedData, const int32 CompressedDataSize, uint8 *OutPCMData, const int32 OutputPCMDataSize)=0
 
virtual void PrepareToLoop ()
 
virtual int32 GetFrameSize ()=0
 
virtual uint32 GetMaxFrameSizeSamples () const =0
 
int32 GetStreamSeekBlockIndex () const
 
int32 GetStreamSeekBlockOffset () const
 
- Public Member Functions inherited from ICompressedAudioInfo
ENGINE_API ICompressedAudioInfo ()
 
virtual ENGINE_API ~ICompressedAudioInfo ()
 
virtual bool ReleaseStreamChunk (bool bBlockUntilReleased)
 
ENGINE_API bool StreamCompressedInfo (USoundWave *Wave, struct FSoundQualityInfo *QualityInfo)
 
ENGINE_API bool StreamCompressedInfo (const FSoundWaveProxyPtr &Wave, struct FSoundQualityInfo *QualityInfo)
 
virtual ENGINE_API bool HasError () const
 
virtual const FSoundWaveProxyPtrGetStreamingSoundWave () const
 

Protected Member Functions

ENGINE_API uint32 Read (void *Outbuffer, uint32 DataSize)
 
int32 DecompressToPCMBuffer (uint16 FrameSize)
 
uint32 IncrementCurrentSampleCount (uint32 NewSamples)
 
uint32 WriteFromDecodedPCM (uint8 *Destination, uint32 BufferSize)
 
uint32 ZeroBuffer (uint8 *Destination, uint32 BufferSize)
 
ENGINE_API const uint8GetLoadedChunk (const FSoundWaveProxyPtr &InSoundWave, uint32 ChunkIndex, uint32 &OutChunkSize)
 
void RetainNextChunkInSequence (const FSoundWaveProxyPtr &InSoundWave, const uint32 InChunkIndex)
 
const FStreamedAudioChunkSeekTableGetCurrentSeekTable () const
 
FStreamedAudioChunkSeekTableGetCurrentSeekTable ()
 
- Protected Member Functions inherited from ICompressedAudioInfo
bool WantsFilteredLogging () const
 

Protected Attributes

bool bIsStreaming
 
const uint8SrcBufferData
 
uint32 SrcBufferDataSize
 
uint32 SrcBufferOffset
 
uint32 AudioDataOffset
 
uint32 AudioDataChunkIndex
 
uint32 TrueSampleCount
 
uint32 CurrentSampleCount
 
uint8 NumChannels
 
uint32 MaxFrameSizeSamples
 
uint32 SampleStride
 
TArray< uint8LastDecodedPCM
 
uint32 LastPCMByteSize
 
uint32 LastPCMOffset
 
bool bStoringEndOfFile
 
int32 CurrentChunkIndex
 
uint32 SrcBufferPadding
 
FAudioChunkHandle CurCompressedChunkHandle
 
FAudioChunkHandle NextPlayingChunkHandle
 
TPimplPtr< FStreamedAudioChunkSeekTableCurrentChunkSeekTable
 
std::atomic< int32StreamSeekBlockIndex
 
int32 StreamSeekBlockOffset
 
uint32 StreamSeekToAudioFrames = INDEX_NONE
 
- Protected Attributes inherited from ICompressedAudioInfo
bool bHasError = false
 
bool bWantsFilteredLogging = false
 
FSoundWaveProxyPtr StreamingSoundWave
 

Detailed Description

Default implementation of a streamed compressed audio format. Can be subclassed to support streaming of a specific asset format. Handles all the platform independent aspects of file format streaming for you (dealing with UE streamed assets)

Constructor & Destructor Documentation

◆ IStreamedCompressedInfo()

IStreamedCompressedInfo::IStreamedCompressedInfo ( )

◆ ~IStreamedCompressedInfo()

IStreamedCompressedInfo::~IStreamedCompressedInfo ( )
virtualdefault

Member Function Documentation

◆ CreateDecoder()

virtual bool IStreamedCompressedInfo::CreateDecoder ( )
pure virtual

Create the compression format dependent decoder object.

Implemented in FPcmAudioInfoHybrid, FBinkAudioInfo, FOpusAudioInfo, and FRadAudioInfo.

◆ Decode()

virtual FDecodeResult IStreamedCompressedInfo::Decode ( const uint8 CompressedData,
const int32  CompressedDataSize,
uint8 OutPCMData,
const int32  OutputPCMDataSize 
)
pure virtual

Decode the input compressed frame data into output PCMData buffer.

Implemented in FPcmAudioInfoHybrid, FBinkAudioInfo, FOpusAudioInfo, and FRadAudioInfo.

◆ DecompressToPCMBuffer()

int32 IStreamedCompressedInfo::DecompressToPCMBuffer ( uint16  FrameSize)
protected

Decompresses a frame of data to PCM buffer

Parameters
FrameSizeSize of the frame in bytes
Returns
The number of audio frames that were decompressed (< 0 indicates error)

◆ EnableHalfRate()

virtual void IStreamedCompressedInfo::EnableHalfRate ( bool  HalfRate)
inlineoverridevirtual

Sets decode to half-rate

Parameters
HalfRateWhether Half rate is enabled

Implements ICompressedAudioInfo.

◆ ExpandFile()

void IStreamedCompressedInfo::ExpandFile ( uint8 DstBuffer,
struct FSoundQualityInfo QualityInfo 
)
overridevirtual

Decompress an entire data file to a TArray

Implements ICompressedAudioInfo.

◆ GetCurrentChunkIndex()

virtual int32 IStreamedCompressedInfo::GetCurrentChunkIndex ( ) const
inlineoverridevirtual

Gets the chunk index that was last read from (for Streaming Manager requests)

Reimplemented from ICompressedAudioInfo.

◆ GetCurrentChunkOffset()

virtual int32 IStreamedCompressedInfo::GetCurrentChunkOffset ( ) const
inlineoverridevirtual

Gets the offset into the chunk that was last read to (for Streaming Manager priority)

Reimplemented from ICompressedAudioInfo.

◆ GetCurrentSeekTable() [1/2]

FStreamedAudioChunkSeekTable & IStreamedCompressedInfo::GetCurrentSeekTable ( )
protected

◆ GetCurrentSeekTable() [2/2]

const FStreamedAudioChunkSeekTable & IStreamedCompressedInfo::GetCurrentSeekTable ( ) const
protected

Gets the current chunks seektable instance (or creates one)

Returns
the currently loaded chunk seektable

◆ GetFrameSize()

virtual int32 IStreamedCompressedInfo::GetFrameSize ( )
pure virtual

Return the size of the current compression frame

Implemented in FPcmAudioInfoHybrid, FBinkAudioInfo, FOpusAudioInfo, and FRadAudioInfo.

◆ GetLoadedChunk()

const uint8 * IStreamedCompressedInfo::GetLoadedChunk ( const FSoundWaveProxyPtr InSoundWave,
uint32  ChunkIndex,
uint32 OutChunkSize 
)
protected

Helper function for getting a chunk of compressed audio.

Parameters
InSoundWavePointer to the soundwave to get compressed audio from.
ChunkIndexthe index of the chunk to get from InSoundWave.
[out]OutChunkSizethe size of the chunk.
Returns
a pointer to the chunk if it's loaded, nullptr otherwise.

◆ GetMaxFrameSizeSamples()

virtual uint32 IStreamedCompressedInfo::GetMaxFrameSizeSamples ( ) const
pure virtual

The size of the decode PCM buffer size.

Implemented in FPcmAudioInfoHybrid, FBinkAudioInfo, FOpusAudioInfo, and FRadAudioInfo.

◆ GetSourceBufferSize()

virtual uint32 IStreamedCompressedInfo::GetSourceBufferSize ( ) const
inlineoverridevirtual

Gets the size of the source buffer originally passed to the info class (bytes)

Implements ICompressedAudioInfo.

◆ GetStreamBufferSize()

virtual int IStreamedCompressedInfo::GetStreamBufferSize ( ) const
inlineoverridevirtual

Gets the preferred size for a streaming buffer for this decompression scheme

Implements ICompressedAudioInfo.

◆ GetStreamSeekBlockIndex()

int32 IStreamedCompressedInfo::GetStreamSeekBlockIndex ( ) const
inline

◆ GetStreamSeekBlockOffset()

int32 IStreamedCompressedInfo::GetStreamSeekBlockOffset ( ) const
inline

◆ IncrementCurrentSampleCount()

uint32 IStreamedCompressedInfo::IncrementCurrentSampleCount ( uint32  NewSamples)
protected

Adds to the count of samples that have currently been decoded

Parameters
NewSamplesHow many samples have been decoded
Returns
How many samples were actually part of the true sample count

◆ IsStreamedCompressedInfo()

virtual bool IStreamedCompressedInfo::IsStreamedCompressedInfo ( ) const
inlineoverridevirtual

Returns whether this instance can be cast to a IStreamedCompressedInfo. Surprisingly SupportsStreaming doesn't work for this.

Reimplemented from ICompressedAudioInfo.

◆ ParseHeader()

virtual bool IStreamedCompressedInfo::ParseHeader ( const uint8 InSrcBufferData,
uint32  InSrcBufferDataSize,
FSoundQualityInfo QualityInfo 
)
pure virtual

Parse the header information from the input source buffer data. This is dependent on compression format.

Implemented in FPcmAudioInfoHybrid, FBinkAudioInfo, FOpusAudioInfo, and FRadAudioInfo.

◆ PrepareToLoop()

virtual void IStreamedCompressedInfo::PrepareToLoop ( )
inlinevirtual

Optional method to allow decoder to prepare to loop.

Reimplemented in FPcmAudioInfoHybrid, FOpusAudioInfo, and FRadAudioInfo.

◆ Read()

uint32 IStreamedCompressedInfo::Read ( void Outbuffer,
uint32  DataSize 
)
protected

Reads from the internal source audio buffer stream of the given data size.

◆ ReadCompressedData()

bool IStreamedCompressedInfo::ReadCompressedData ( uint8 Destination,
bool  bLooping,
uint32  BufferSize 
)
overridevirtual

Decompresses data to raw PCM data.

Parameters
Destinationwhere to place the decompressed sound
bLoopingwhether to loop the sound by seeking to the start, or pad the buffer with zeroes
BufferSizenumber of bytes of PCM data to create
Returns
bool true if the end of the data was reached (for both single shot and looping sounds)

Implements ICompressedAudioInfo.

◆ ReadCompressedInfo()

bool IStreamedCompressedInfo::ReadCompressedInfo ( const uint8 InSrcBufferData,
uint32  InSrcBufferDataSize,
FSoundQualityInfo QualityInfo 
)
overridevirtual

Reads the header information of a compressed format

Parameters
InSrcBufferDataSource compressed data
InSrcBufferDataSizeSize of compressed data
QualityInfoQuality Info (to be filled out). This can be null in the case of most implementations of FSoundBuffer::ReadCompressedInfo

Implements ICompressedAudioInfo.

◆ RetainNextChunkInSequence()

void IStreamedCompressedInfo::RetainNextChunkInSequence ( const FSoundWaveProxyPtr InSoundWave,
const uint32  InChunkIndex 
)
protected

◆ SeekToFrame()

void IStreamedCompressedInfo::SeekToFrame ( const uint32  Frame)
overridevirtual

Seeks to specific frame in the audio (Some formats might not be seekable)

Implements ICompressedAudioInfo.

Reimplemented in FPcmAudioInfoHybrid, FOpusAudioInfo, FBinkAudioInfo, and FRadAudioInfo.

◆ SeekToTime()

void IStreamedCompressedInfo::SeekToTime ( const float  SeekTime)
overridevirtual

Seeks to time (Some formats might not be seekable)

Implements ICompressedAudioInfo.

Reimplemented in FPcmAudioInfoHybrid, FOpusAudioInfo, FBinkAudioInfo, and FRadAudioInfo.

◆ StreamCompressedData()

bool IStreamedCompressedInfo::StreamCompressedData ( uint8 Destination,
bool  bLooping,
uint32  BufferSize,
int32 OutNumBytesStreamed 
)
overridevirtual

Decompresses streamed data to raw PCM data.

Parameters
Destinationwhere to place the decompressed sound
bLoopingwhether to loop the sound by seeking to the start, or pad the buffer with zeros
BufferSizenumber of bytes of PCM data to create
Returns
bool true if the end of the data was reached (for both single shot and looping sounds)

Reimplemented from ICompressedAudioInfo.

◆ StreamCompressedInfoInternal()

bool IStreamedCompressedInfo::StreamCompressedInfoInternal ( const FSoundWaveProxyPtr InWaveProxy,
FSoundQualityInfo QualityInfo 
)
overridevirtual

Internal override implemented by subclasses.

Implements ICompressedAudioInfo.

◆ SupportsStreaming()

virtual bool IStreamedCompressedInfo::SupportsStreaming ( ) const
inlineoverridevirtual

Whether this decompression class supports streaming decompression

Reimplemented from ICompressedAudioInfo.

◆ UsesVorbisChannelOrdering()

virtual bool IStreamedCompressedInfo::UsesVorbisChannelOrdering ( ) const
inlineoverridevirtual

Whether the decompressed audio will be arranged using Vorbis' channel ordering See http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-800004.3.9 for details

Implements ICompressedAudioInfo.

◆ WriteFromDecodedPCM()

uint32 IStreamedCompressedInfo::WriteFromDecodedPCM ( uint8 Destination,
uint32  BufferSize 
)
protected

Writes data from decoded PCM buffer, taking into account whether some PCM has been written before

Parameters
DestinationWhere to place the decoded sound
BufferSizeSize of the destination buffer in bytes
Returns
How many bytes were written

◆ ZeroBuffer()

uint32 IStreamedCompressedInfo::ZeroBuffer ( uint8 Destination,
uint32  BufferSize 
)
protected

Zeroes the contents of a buffer

Parameters
DestinationBuffer to zero
BufferSizeSize of the destination buffer in bytes
Returns
How many bytes were zeroed

Member Data Documentation

◆ AudioDataChunkIndex

uint32 IStreamedCompressedInfo::AudioDataChunkIndex
protected

The chunk index where the actual audio data starts.

◆ AudioDataOffset

uint32 IStreamedCompressedInfo::AudioDataOffset
protected

Where the actual audio data starts in the current streamed chunk. Accounts for header offset.

◆ bIsStreaming

bool IStreamedCompressedInfo::bIsStreaming
protected

bool set before ParseHeader. Whether we are streaming a file or not.

◆ bStoringEndOfFile

bool IStreamedCompressedInfo::bStoringEndOfFile
protected

If we're currently reading the final buffer.

◆ CurCompressedChunkHandle

FAudioChunkHandle IStreamedCompressedInfo::CurCompressedChunkHandle
protected

Chunk Handle to ensure that this chunk of streamed audio is not deleted while we are using it.

◆ CurrentChunkIndex

int32 IStreamedCompressedInfo::CurrentChunkIndex
protected

The current chunk index in the streamed chunks.

◆ CurrentChunkSeekTable

TPimplPtr<FStreamedAudioChunkSeekTable> IStreamedCompressedInfo::CurrentChunkSeekTable
protected

If there's a chunked seek-table present, this contains the current chunks portion.

◆ CurrentSampleCount

uint32 IStreamedCompressedInfo::CurrentSampleCount
protected

How many samples we've currently read in the source file.

◆ LastDecodedPCM

TArray<uint8> IStreamedCompressedInfo::LastDecodedPCM
protected

The decoded PCM byte array from the last decoded frame.

◆ LastPCMByteSize

uint32 IStreamedCompressedInfo::LastPCMByteSize
protected

The amount of PCM data in bytes was decoded last.

◆ LastPCMOffset

uint32 IStreamedCompressedInfo::LastPCMOffset
protected

The current offset in the last decoded PCM buffer.

◆ MaxFrameSizeSamples

uint32 IStreamedCompressedInfo::MaxFrameSizeSamples
protected

The maximum number of samples per decode frame.

◆ NextPlayingChunkHandle

FAudioChunkHandle IStreamedCompressedInfo::NextPlayingChunkHandle
protected

Handle to the next chunk in sequence. Added once we're playing, to prevent it being dropped before it's played.

◆ NumChannels

uint8 IStreamedCompressedInfo::NumChannels
protected

Number of channels (left/right) in the source file.

◆ SampleStride

uint32 IStreamedCompressedInfo::SampleStride
protected

The number of bytes per interleaved sample (NumChannels * sizeof(int16)).

◆ SrcBufferData

const uint8* IStreamedCompressedInfo::SrcBufferData
protected

Ptr to the current streamed chunk.

◆ SrcBufferDataSize

uint32 IStreamedCompressedInfo::SrcBufferDataSize
protected

Size of the current streamed chunk.

◆ SrcBufferOffset

uint32 IStreamedCompressedInfo::SrcBufferOffset
protected

What byte we're currently reading in the streamed chunk.

◆ SrcBufferPadding

uint32 IStreamedCompressedInfo::SrcBufferPadding
protected

Number of bytes of padding used, overridden in some implementations. Defaults to 0.

◆ StreamSeekBlockIndex

std::atomic<int32> IStreamedCompressedInfo::StreamSeekBlockIndex
protected

When a streaming seek request comes down, this is the block we are going to. INDEX_NONE means no seek pending. When using the legacy streaming system this is read on a thread other than the decompression thread to prime the correct chunk, so it needs an atomic. It's only ever set on one thread, and the read has no timing restrictions, so no lock is necessary. Also the legacy streamer isn't used anymore anyway.

This and StreamSeekBlockOffset are expected to be set by the codec's SeekToTime() function.

◆ StreamSeekBlockOffset

int32 IStreamedCompressedInfo::StreamSeekBlockOffset
protected

When a streaming seek request comes down, this is the offset in to the block we want to start decoding from.

◆ StreamSeekToAudioFrames

uint32 IStreamedCompressedInfo::StreamSeekToAudioFrames = INDEX_NONE
protected

If using the Chunked seek-tables, we request the seek in samples so we can resolve after the chunk table loads.

◆ TrueSampleCount

uint32 IStreamedCompressedInfo::TrueSampleCount
protected

The total sample count of the source file.


The documentation for this class was generated from the following files: