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

Stream of serialized states from game clients. More...

#include <IMemoryStream.h>

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

Public Member Functions

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

Detailed Description

Stream of serialized states from game clients.

A memory stream is composed of "frames" of memory representing serialized states of the game client. For each video frame run by the game loop, the game client's state is serialized into a buffer provided by this interface.

Implementation of three types of memory streams are provided:

  • Basic memory stream: has only a current frame, and supports neither rewind nor forward seeking.

    See also
    CBasicMemoryStream
  • Linear memory stream: can grow in one direction. It is possible to rewind, but not fast-forward.

    See also
    CLinearMemoryStream
  • Nonlinear memory stream: can have frames both ahead of and behind the current frame. If a stream is rewound, it is possible to recover these frames by seeking forward again.

    See also
    CNonlinearMemoryStream (TODO)

Constructor & Destructor Documentation

◆ ~IMemoryStream()

virtual KODI::RETRO::IMemoryStream::~IMemoryStream ( )
virtualdefault

Member Function Documentation

◆ AdvanceFrames()

virtual uint64_t KODI::RETRO::IMemoryStream::AdvanceFrames ( uint64_t frameCount)
pure virtual

Seek ahead the specified number of frames.

Returns
The number of frames advanced

Implemented in KODI::RETRO::CBasicMemoryStream, and KODI::RETRO::CLinearMemoryStream.

◆ BeginFrame()

virtual uint8_t * KODI::RETRO::IMemoryStream::BeginFrame ( )
pure virtual

\ 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.

Implemented in KODI::RETRO::CBasicMemoryStream, and KODI::RETRO::CLinearMemoryStream.

◆ CurrentFrame()

virtual const uint8_t * KODI::RETRO::IMemoryStream::CurrentFrame ( ) const
pure virtual

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

Implemented in KODI::RETRO::CBasicMemoryStream, and KODI::RETRO::CLinearMemoryStream.

◆ FrameSize()

virtual size_t KODI::RETRO::IMemoryStream::FrameSize ( ) const
pure virtual

Return the frame size passed to Init()

Implemented in KODI::RETRO::CBasicMemoryStream, and KODI::RETRO::CLinearMemoryStream.

◆ FutureFramesAvailable()

virtual uint64_t KODI::RETRO::IMemoryStream::FutureFramesAvailable ( ) const
pure virtual

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.

Implemented in KODI::RETRO::CBasicMemoryStream, and KODI::RETRO::CLinearMemoryStream.

◆ GetFrameCounter()

virtual uint64_t KODI::RETRO::IMemoryStream::GetFrameCounter ( ) const
pure virtual

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

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

Implemented in KODI::RETRO::CBasicMemoryStream, and KODI::RETRO::CLinearMemoryStream.

◆ Init()

virtual void KODI::RETRO::IMemoryStream::Init ( size_t frameSize,
uint64_t maxFrameCount )
pure virtual

Initialize memory stream.

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

Implemented in KODI::RETRO::CBasicMemoryStream, and KODI::RETRO::CLinearMemoryStream.

◆ MaxFrameCount()

virtual uint64_t KODI::RETRO::IMemoryStream::MaxFrameCount ( ) const
pure virtual

Return the current max frame count.

Implemented in KODI::RETRO::CBasicMemoryStream, and KODI::RETRO::CLinearMemoryStream.

◆ PastFramesAvailable()

virtual uint64_t KODI::RETRO::IMemoryStream::PastFramesAvailable ( ) const
pure virtual

Return the number of frames behind the current frame.

Implemented in KODI::RETRO::CBasicMemoryStream, KODI::RETRO::CDeltaPairMemoryStream, and KODI::RETRO::CLinearMemoryStream.

◆ Reset()

virtual void KODI::RETRO::IMemoryStream::Reset ( )
pure virtual

Free any resources used by this stream.

Implemented in KODI::RETRO::CBasicMemoryStream, KODI::RETRO::CDeltaPairMemoryStream, and KODI::RETRO::CLinearMemoryStream.

◆ RewindFrames()

virtual uint64_t KODI::RETRO::IMemoryStream::RewindFrames ( uint64_t frameCount)
pure virtual

Seek backwards the specified number of frames.

Returns
The number of frames rewound

Implemented in KODI::RETRO::CBasicMemoryStream, KODI::RETRO::CDeltaPairMemoryStream, and KODI::RETRO::CLinearMemoryStream.

◆ SetFrameCounter()

virtual void KODI::RETRO::IMemoryStream::SetFrameCounter ( uint64_t frameCount)
pure virtual

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

Parameters
frameCountThe history of the current frame

Implemented in KODI::RETRO::CBasicMemoryStream, and KODI::RETRO::CLinearMemoryStream.

◆ SetMaxFrameCount()

virtual void KODI::RETRO::IMemoryStream::SetMaxFrameCount ( uint64_t maxFrameCount)
pure virtual

Update the max frame count.

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

Implemented in KODI::RETRO::CBasicMemoryStream, and KODI::RETRO::CLinearMemoryStream.

◆ SubmitFrame()

virtual void KODI::RETRO::IMemoryStream::SubmitFrame ( )
pure virtual

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

Implemented in KODI::RETRO::CBasicMemoryStream, and KODI::RETRO::CLinearMemoryStream.


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