Skylicht Engine
Loading...
Searching...
No Matches
Skylicht::Audio::COnlineMemoryStreamCursor Class Reference

Stream cursor for dynamic/online memory streams. Supports trimming data from the start of the stream to save memory. More...

#include <Stream/COnlineMemoryStream.h>

Inheritance diagram for Skylicht::Audio::COnlineMemoryStreamCursor:
Skylicht::Audio::IStreamCursor

Public Member Functions

 COnlineMemoryStreamCursor (COnlineMemoryStream *stream)
virtual int seek (int pos, EOrigin origin)
 Move the cursor position.
virtual int tell ()
 Get current cursor position.
virtual int read (unsigned char *buff, int len)
 Read data from the stream.
virtual bool endOfStream ()
 Check if the cursor is at the end of the stream.
virtual int size ()
 Get total size of the stream.
virtual bool readyReadData (int len)
 Check if a certain amount of data is ready to be read.
virtual void trim ()
 Remove all data before the current cursor position from the stream.

Public Attributes

int m_pos
COnlineMemoryStreamm_stream

Additional Inherited Members

Public Types inherited from Skylicht::Audio::IStreamCursor
enum  EOrigin { OriginStart , OriginCurrent , OriginEnd }
 Origin for seek operations. More...

Detailed Description

Stream cursor for dynamic/online memory streams. Supports trimming data from the start of the stream to save memory.

Member Function Documentation

◆ endOfStream()

virtual bool Skylicht::Audio::COnlineMemoryStreamCursor::endOfStream ( )
virtual

Check if the cursor is at the end of the stream.

Returns
True if at EOF

Implements Skylicht::Audio::IStreamCursor.

◆ read()

virtual int Skylicht::Audio::COnlineMemoryStreamCursor::read ( unsigned char * buff,
int len )
virtual

Read data from the stream.

Parameters
buffDestination buffer
lenNumber of bytes to read
Returns
Number of bytes actually read

Implements Skylicht::Audio::IStreamCursor.

◆ readyReadData()

virtual bool Skylicht::Audio::COnlineMemoryStreamCursor::readyReadData ( int len)
virtual

Check if a certain amount of data is ready to be read.

Parameters
lenNumber of bytes to check
Returns
True if data is available

Implements Skylicht::Audio::IStreamCursor.

◆ seek()

virtual int Skylicht::Audio::COnlineMemoryStreamCursor::seek ( int pos,
EOrigin origin )
virtual

Move the cursor position.

Parameters
posOffset in bytes
originWhere to seek from
Returns
0 on success, or -1 on error

Implements Skylicht::Audio::IStreamCursor.

◆ size()

virtual int Skylicht::Audio::COnlineMemoryStreamCursor::size ( )
virtual

Get total size of the stream.

Returns
Size in bytes

Implements Skylicht::Audio::IStreamCursor.

◆ tell()

virtual int Skylicht::Audio::COnlineMemoryStreamCursor::tell ( )
virtual

Get current cursor position.

Returns
Current position in bytes

Implements Skylicht::Audio::IStreamCursor.

◆ trim()

virtual void Skylicht::Audio::COnlineMemoryStreamCursor::trim ( )
virtual

Remove all data before the current cursor position from the stream.

Reimplemented from Skylicht::Audio::IStreamCursor.


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