Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
KODI::RETRO::CLinearMemoryStream Class Referenceabstract

#include <LinearMemoryStream.h>

Inheritance diagram for KODI::RETRO::CLinearMemoryStream:
KODI::RETRO::IMemoryStream KODI::RETRO::CDeltaPairMemoryStream

Public Member Functions

 CLinearMemoryStream ()
 
 ~CLinearMemoryStream () override=default
 
void Init (size_t frameSize, uint64_t maxFrameCount) override
 Initialize memory stream.
 
void Reset () override
 Free any resources used by this stream.
 
size_t FrameSize () const override
 Return the frame size passed to Init()
 
uint64_t MaxFrameCount () const override
 Return the current max frame count.
 
void SetMaxFrameCount (uint64_t maxFrameCount) override
 Update the max frame count.
 
uint8_tBeginFrame () override
 
void SubmitFrame () override
 Indicate that a frame of size FrameSize() has been written to the location returned from BeginFrame()
 
const uint8_tCurrentFrame () const override
 Get a pointer to the current frame.
 
uint64_t FutureFramesAvailable () const override
 Return the number of frames ahead of the current frame.
 
uint64_t AdvanceFrames (uint64_t frameCount) override
 Seek ahead the specified number of frames.
 
uint64_t PastFramesAvailable () const override=0
 Return the number of frames behind the current frame.
 
uint64_t RewindFrames (uint64_t frameCount) override=0
 Seek backwards the specified number of frames.
 
uint64_t GetFrameCounter () const override
 Get the total number of frames played until the current frame.
 
void SetFrameCounter (uint64_t frameCount) override
 Set the total number of frames played until the current frame.
 
- Public Member Functions inherited from KODI::RETRO::IMemoryStream
virtual ~IMemoryStream ()=default
 

Protected Member Functions

virtual void SubmitFrameInternal ()=0
 
virtual void CullPastFrames (uint64_t frameCount)=0
 
uint64_t BufferSize () const
 

Protected Attributes

size_t m_paddedFrameSize
 
uint64_t m_maxFrames
 
std::unique_ptr< uint32_t[]> m_currentFrame
 
std::unique_ptr< uint32_t[]> m_nextFrame
 
bool m_bHasCurrentFrame
 
bool m_bHasNextFrame
 
uint64_t m_currentFrameHistory
 

Constructor & Destructor Documentation

◆ CLinearMemoryStream()

CLinearMemoryStream::CLinearMemoryStream ( )

◆ ~CLinearMemoryStream()

KODI::RETRO::CLinearMemoryStream::~CLinearMemoryStream ( )
overridedefault

Member Function Documentation

◆ AdvanceFrames()

uint64_t KODI::RETRO::CLinearMemoryStream::AdvanceFrames ( uint64_t frameCount)
inlineoverridevirtual

Seek ahead the specified number of frames.

Returns
The number of frames advanced

Implements KODI::RETRO::IMemoryStream.

◆ BeginFrame()

uint8_t * CLinearMemoryStream::BeginFrame ( )
overridevirtual

\ brief Get a pointer to which FrameSize() bytes can be written

The buffer exposed by this function is passed to the game client, which fills it with a serialization of its current state.

Implements KODI::RETRO::IMemoryStream.

◆ BufferSize()

uint64_t CLinearMemoryStream::BufferSize ( ) const
protected

◆ CullPastFrames()

virtual void KODI::RETRO::CLinearMemoryStream::CullPastFrames ( uint64_t frameCount)
protectedpure virtual

◆ CurrentFrame()

const uint8_t * CLinearMemoryStream::CurrentFrame ( ) const
overridevirtual

Get a pointer to the current frame.

This function must have no side effects. The pointer is valid until the stream is modified.

Returns
A buffer of size FrameSize(), or nullptr if the stream is empty

Implements KODI::RETRO::IMemoryStream.

◆ FrameSize()

size_t KODI::RETRO::CLinearMemoryStream::FrameSize ( ) const
inlineoverridevirtual

Return the frame size passed to Init()

Implements KODI::RETRO::IMemoryStream.

◆ FutureFramesAvailable()

uint64_t KODI::RETRO::CLinearMemoryStream::FutureFramesAvailable ( ) const
inlineoverridevirtual

Return the number of frames ahead of the current frame.

If the stream supports forward seeking, frames that are passed over during a "rewind" operation can be recovered again.

Implements KODI::RETRO::IMemoryStream.

◆ GetFrameCounter()

uint64_t KODI::RETRO::CLinearMemoryStream::GetFrameCounter ( ) const
inlineoverridevirtual

Get the total number of frames played until the current frame.

Returns
The history of the current frame, or 0 for unknown

Implements KODI::RETRO::IMemoryStream.

◆ Init()

void CLinearMemoryStream::Init ( size_t frameSize,
uint64_t maxFrameCount )
overridevirtual

Initialize memory stream.

Parameters
frameSizeThe size of the serialized memory state
maxFrameCountThe maximum number of frames this stream can hold

Implements KODI::RETRO::IMemoryStream.

◆ MaxFrameCount()

uint64_t KODI::RETRO::CLinearMemoryStream::MaxFrameCount ( ) const
inlineoverridevirtual

Return the current max frame count.

Implements KODI::RETRO::IMemoryStream.

◆ PastFramesAvailable()

uint64_t KODI::RETRO::CLinearMemoryStream::PastFramesAvailable ( ) const
overridepure virtual

Return the number of frames behind the current frame.

Implements KODI::RETRO::IMemoryStream.

Implemented in KODI::RETRO::CDeltaPairMemoryStream.

◆ Reset()

void CLinearMemoryStream::Reset ( )
overridevirtual

Free any resources used by this stream.

Implements KODI::RETRO::IMemoryStream.

◆ RewindFrames()

uint64_t KODI::RETRO::CLinearMemoryStream::RewindFrames ( uint64_t frameCount)
overridepure virtual

Seek backwards the specified number of frames.

Returns
The number of frames rewound

Implements KODI::RETRO::IMemoryStream.

Implemented in KODI::RETRO::CDeltaPairMemoryStream.

◆ SetFrameCounter()

void KODI::RETRO::CLinearMemoryStream::SetFrameCounter ( uint64_t frameCount)
inlineoverridevirtual

Set the total number of frames played until the current frame.

Parameters
frameCountThe history of the current frame

Implements KODI::RETRO::IMemoryStream.

◆ SetMaxFrameCount()

void CLinearMemoryStream::SetMaxFrameCount ( uint64_t maxFrameCount)
overridevirtual

Update the max frame count.

Old frames may be deleted if the max frame count is reduced.

Implements KODI::RETRO::IMemoryStream.

◆ SubmitFrame()

void CLinearMemoryStream::SubmitFrame ( )
overridevirtual

Indicate that a frame of size FrameSize() has been written to the location returned from BeginFrame()

Implements KODI::RETRO::IMemoryStream.

◆ SubmitFrameInternal()

virtual void KODI::RETRO::CLinearMemoryStream::SubmitFrameInternal ( )
protectedpure virtual

Member Data Documentation

◆ m_bHasCurrentFrame

bool KODI::RETRO::CLinearMemoryStream::m_bHasCurrentFrame
protected

◆ m_bHasNextFrame

bool KODI::RETRO::CLinearMemoryStream::m_bHasNextFrame
protected

◆ m_currentFrame

std::unique_ptr<uint32_t[]> KODI::RETRO::CLinearMemoryStream::m_currentFrame
protected

Simple double-buffering. After XORing the two states, the next becomes the current, and the current becomes a buffer for the next call to CGameClient::Serialize().

◆ m_currentFrameHistory

uint64_t KODI::RETRO::CLinearMemoryStream::m_currentFrameHistory
protected

◆ m_maxFrames

uint64_t KODI::RETRO::CLinearMemoryStream::m_maxFrames
protected

◆ m_nextFrame

std::unique_ptr<uint32_t[]> KODI::RETRO::CLinearMemoryStream::m_nextFrame
protected

◆ m_paddedFrameSize

size_t KODI::RETRO::CLinearMemoryStream::m_paddedFrameSize
protected

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