Isle
|
[AI] Buffer for managing streamed DS (Data Stream) chunks and actions. More...
#include <mxdsbuffer.h>
Public Types | |
enum | Type { e_chunk = 0 , e_allocate = 1 , e_preallocated = 2 , e_unknown = 3 } |
[AI] Buffer memory management type. More... | |
Public Member Functions | |
MxDSBuffer () | |
[AI] Constructs a buffer object and initializes all internal pointers and counters. More... | |
~MxDSBuffer () override | |
[AI] Destructor: Releases memory appropriately based on buffer management mode and asserts no references. More... | |
const char * | ClassName () const override |
[AI] Returns the runtime class name for serialization/reflection. More... | |
MxResult | AllocateBuffer (MxU32 p_bufferSize, Type p_mode) |
[AI] Allocates a buffer of a given size and memory mode. More... | |
MxResult | SetBufferPointer (MxU8 *p_buffer, MxU32 p_size) |
[AI] Sets a buffer pointer and records its size. More... | |
MxResult | FUN_100c67b0 (MxStreamController *p_controller, MxDSAction *p_action, MxDSStreamingAction **p_streamingAction) |
[AI] Executes streaming action startup and object creation loop from an initial SI chunk. More... | |
MxResult | CreateObject (MxStreamController *p_controller, MxU32 *p_data, MxDSAction *p_action, MxDSStreamingAction **p_streamingAction) |
[AI] Creates a presenter/action object by deserializing a data block. More... | |
MxResult | StartPresenterFromAction (MxStreamController *p_controller, MxDSAction *p_action1, MxDSAction *p_action2) |
[AI] Launches a presenter for the given action if not already present. More... | |
MxResult | ParseChunk (MxStreamController *p_controller, MxU32 *p_data, MxDSAction *p_action, MxDSStreamingAction **p_streamingAction, MxStreamChunk *p_header) |
[AI] Parses an MxStreamChunk for logical streaming actions, nested chunks, EoS, and splitting. More... | |
MxU8 * | SkipToData () |
[AI] Scans this buffer forward to the next valid object or chunk and returns a pointer to its start. More... | |
MxU8 | ReleaseRef (MxDSChunk *) |
[AI] Decrement the buffer's chunk reference count. More... | |
void | AddRef (MxDSChunk *p_chunk) |
[AI] Increment reference count for this buffer (ownership by a chunk). More... | |
MxResult | CalcBytesRemaining (MxU8 *p_data) |
[AI] Calculates pending bytes remaining to be streamed, updates buffer state accordingly. More... | |
void | FUN_100c6f80 (MxU32 p_writeOffset) |
[AI] Sets the buffer's internal streaming position to the given write offset. More... | |
MxU8 * | FUN_100c6fa0 (MxU8 *p_data) |
[AI] Finds the next chunk boundary in the buffer, starting from an optional pointer. More... | |
MxResult | FUN_100c7090 (MxDSBuffer *p_buf) |
[AI] Copies buffer data and selected internal state from another buffer, if space allows. More... | |
MxU8 * | GetBuffer () |
[AI] Returns a pointer to the managed chunk data buffer. More... | |
undefined4 | GetUnknown14 () |
[AI] Returns the internal value at offset 0x14. More... | |
MxBool | HasRef () |
[AI] Checks whether there are any active references to this buffer. More... | |
MxU16 | GetRefCount () |
[AI] Returns the current buffer reference count. More... | |
Type | GetMode () |
[AI] Returns the current buffer management mode. More... | |
MxU32 | GetWriteOffset () |
[AI] Returns the current buffer write offset (number of bytes with valid data). More... | |
MxU32 | GetBytesRemaining () |
[AI] Returns the number of bytes remaining to stream in this buffer. More... | |
void | SetUnknown14 (undefined4 p_unk0x14) |
[AI] Sets the unknown value at offset 0x14. More... | |
void | SetUnknown1c (undefined4 p_unk0x1c) |
[AI] Sets the unknown value at offset 0x1c. More... | |
void | SetMode (Type p_mode) |
[AI] Sets the buffer memory management mode. More... | |
void | SetUnk30 (MxDSStreamingAction *p_unk0x30) |
[AI] Sets the pointer to the currently relevant streaming action for this buffer. More... | |
![]() | |
MxCore () | |
[AI] Constructs a new MxCore object and assigns it a unique id. More... | |
virtual | ~MxCore () |
[AI] Virtual destructor. Required for correct polymorphic cleanup in derived classes. More... | |
virtual MxLong | Notify (MxParam &p_param) |
[AI] Virtual callback notification mechanism. More... | |
virtual MxResult | Tickle () |
[AI] Called by tickle managers to allow the object to update itself. More... | |
virtual const char * | ClassName () const |
[AI] Returns the runtime class name of this object. More... | |
virtual MxBool | IsA (const char *p_name) const |
[AI] Checks whether this object's class type or parents match the given name. More... | |
MxU32 | GetId () |
[AI] Gets the unique (per-process) id assigned to this object instance. More... | |
Static Public Member Functions | |
static MxCore * | ReadChunk (MxDSBuffer *p_buffer, MxU32 *p_chunkData, MxU16 p_flags) |
[AI] Reads an SI file object/chunk at given position in a buffer. More... | |
static MxResult | Append (MxU8 *p_buffer1, MxU8 *p_buffer2) |
[AI] Appends one chunk/data stream buffer to another, adjusting sizes/headers. More... | |
[AI] Buffer for managing streamed DS (Data Stream) chunks and actions.
This class manages memory for streaming SI file chunks and objects. It keeps track of memory usage, references, and supports allocation and appending of streamed data. It also serves as a unit to bridge stream controller data with presenters/actions/subscribers and mediates actions related to chunk parsing and presenter startup.
[AI] This buffer handles operations such as allocating memory, tracking offsets/remaining bytes, handling reference counting for chunk retention (i.e., for streaming), parsing complex hierarchical/file block formats (e.g., RIFF/LIST/MxCh/MxOb) from media streams, and managing the lifecycle of streaming actions related to playing back/chunking large media resources.
[]
Definition at line 50 of file mxdsbuffer.h.
enum MxDSBuffer::Type |
[AI] Buffer memory management type.
Definition at line 55 of file mxdsbuffer.h.
MxDSBuffer::MxDSBuffer | ( | ) |
[AI] Constructs a buffer object and initializes all internal pointers and counters.
Definition at line 17 of file mxdsbuffer.cpp.
|
override |
[AI] Destructor: Releases memory appropriately based on buffer management mode and asserts no references.
Definition at line 34 of file mxdsbuffer.cpp.
void MxDSBuffer::AddRef | ( | MxDSChunk * | p_chunk | ) |
[AI] Increment reference count for this buffer (ownership by a chunk).
Used for split streaming objects, to avoid premature deallocation.
p_chunk | The chunk gaining a reference. |
Definition at line 408 of file mxdsbuffer.cpp.
[AI] Allocates a buffer of a given size and memory mode.
p_bufferSize | Size, in bytes, to allocate. |
p_mode | Memory allocation mode. |
Definition at line 60 of file mxdsbuffer.cpp.
[AI] Appends one chunk/data stream buffer to another, adjusting sizes/headers.
p_buffer1 | Destination buffer. Its length fields are updated. |
p_buffer2 | Source buffer. Payload is copied (header area skipped). |
Definition at line 509 of file mxdsbuffer.cpp.
[AI] Calculates pending bytes remaining to be streamed, updates buffer state accordingly.
Handles chunk offsets/headers and ensures only requested data is marked as remaining. Used to guide further dequeue/transfer operations.
p_data | Pointer to chunk data in external memory. |
Definition at line 417 of file mxdsbuffer.cpp.
|
overridevirtual |
[AI] Returns the runtime class name for serialization/reflection.
Reimplemented from MxCore.
MxResult MxDSBuffer::CreateObject | ( | MxStreamController * | p_controller, |
MxU32 * | p_data, | ||
MxDSAction * | p_action, | ||
MxDSStreamingAction ** | p_streamingAction | ||
) |
[AI] Creates a presenter/action object by deserializing a data block.
Depending on the FourCC, dispatches to deserialize a chunk or action object and launches a presenter as appropriate.
p_controller | The stream controller to operate on. |
p_data | Pointer to start of object data (FourCC-driven). |
p_action | The parent action. |
p_streamingAction | Output pointer for streaming action. |
Definition at line 163 of file mxdsbuffer.cpp.
MxResult MxDSBuffer::FUN_100c67b0 | ( | MxStreamController * | p_controller, |
MxDSAction * | p_action, | ||
MxDSStreamingAction ** | p_streamingAction | ||
) |
[AI] Executes streaming action startup and object creation loop from an initial SI chunk.
This method is called for each streaming SI data block, processing it to start and attach presenters/actions as needed. Handles splitting, reference counting, and action list updates.
p_controller | The stream controller managing streaming logic. |
p_action | The parent action. |
p_streamingAction | On success, set to created streaming action (output param, may be overwritten/reset). |
Definition at line 102 of file mxdsbuffer.cpp.
void MxDSBuffer::FUN_100c6f80 | ( | MxU32 | p_writeOffset | ) |
[AI] Sets the buffer's internal streaming position to the given write offset.
Updates internal pointers so next SkipToData()/processing resumes at the given offset.
p_writeOffset | The offset (in bytes) to advance buffer pointers. |
Definition at line 450 of file mxdsbuffer.cpp.
[AI] Finds the next chunk boundary in the buffer, starting from an optional pointer.
Advances through RIFF/LIST/MxDa/MxOb/MxCh/MxHd blocks as per SI file format to locate the next significant chunk.
p_data | (Optional) Pointer to start searching from. If nullptr, searches from buffer start. |
Definition at line 459 of file mxdsbuffer.cpp.
MxResult MxDSBuffer::FUN_100c7090 | ( | MxDSBuffer * | p_buf | ) |
[AI] Copies buffer data and selected internal state from another buffer, if space allows.
Used for chunk/A/V buffer transfer.
p_buf | Source buffer. |
Definition at line 495 of file mxdsbuffer.cpp.
MxU8 * MxDSBuffer::GetBuffer | ( | ) |
[AI] Returns a pointer to the managed chunk data buffer.
MxU32 MxDSBuffer::GetBytesRemaining | ( | ) |
[AI] Returns the number of bytes remaining to stream in this buffer.
Type MxDSBuffer::GetMode | ( | ) |
[AI] Returns the current buffer management mode.
MxU16 MxDSBuffer::GetRefCount | ( | ) |
[AI] Returns the current buffer reference count.
undefined4 MxDSBuffer::GetUnknown14 | ( | ) |
[AI] Returns the internal value at offset 0x14.
MxU32 MxDSBuffer::GetWriteOffset | ( | ) |
[AI] Returns the current buffer write offset (number of bytes with valid data).
MxBool MxDSBuffer::HasRef | ( | ) |
[AI] Checks whether there are any active references to this buffer.
TRUE | If referenceCount > 0, FALSE if not. |
MxResult MxDSBuffer::ParseChunk | ( | MxStreamController * | p_controller, |
MxU32 * | p_data, | ||
MxDSAction * | p_action, | ||
MxDSStreamingAction ** | p_streamingAction, | ||
MxStreamChunk * | p_header | ||
) |
[AI] Parses an MxStreamChunk for logical streaming actions, nested chunks, EoS, and splitting.
Handles chunk splitting if necessary, end-of-stream repeats and loop-control, and delegates dispatch to subscribers as appropriate.
p_controller | Stream controller. |
p_data | Data pointer. |
p_action | Parent MxDSAction. |
p_streamingAction | (Output) streaming action pointer. |
p_header | Parsed chunk header. |
Definition at line 240 of file mxdsbuffer.cpp.
|
static |
[AI] Reads an SI file object/chunk at given position in a buffer.
Depending on the FourCC, deserializes appropriate object type. Normally returns either an MxDSObject or MxDSChunk.
p_buffer | Buffer to read from. |
p_chunkData | Pointer to chunk header/FourCC. |
p_flags | Flags to drive the deserialization logic. |
Definition at line 322 of file mxdsbuffer.cpp.
[AI] Decrement the buffer's chunk reference count.
chunk | Pointer to the chunk for which to release a reference. |
Definition at line 399 of file mxdsbuffer.cpp.
[AI] Sets a buffer pointer and records its size.
Sets this buffer to use externally provided memory.
p_buffer | Pointer to memory. |
p_size | Size of memory block. |
Definition at line 89 of file mxdsbuffer.cpp.
void MxDSBuffer::SetMode | ( | Type | p_mode | ) |
[AI] Sets the buffer memory management mode.
p_mode | The buffer management type. |
void MxDSBuffer::SetUnk30 | ( | MxDSStreamingAction * | p_unk0x30 | ) |
[AI] Sets the pointer to the currently relevant streaming action for this buffer.
p_unk0x30 | Pointer to the streaming action. |
void MxDSBuffer::SetUnknown14 | ( | undefined4 | p_unk0x14 | ) |
[AI] Sets the unknown value at offset 0x14.
p_unk0x14 | Value to set for m_unk0x14. |
void MxDSBuffer::SetUnknown1c | ( | undefined4 | p_unk0x1c | ) |
[AI] Sets the unknown value at offset 0x1c.
p_unk0x1c | Value to set for m_unk0x1c. |
MxU8 * MxDSBuffer::SkipToData | ( | ) |
[AI] Scans this buffer forward to the next valid object or chunk and returns a pointer to its start.
Advances internal cursor until the next MxOb (object) or MxCh (chunk) in buffer, or nullptr if there is none left.
Definition at line 352 of file mxdsbuffer.cpp.
MxResult MxDSBuffer::StartPresenterFromAction | ( | MxStreamController * | p_controller, |
MxDSAction * | p_action1, | ||
MxDSAction * | p_action2 | ||
) |
[AI] Launches a presenter for the given action if not already present.
Copies required attributes from the original action, registers it, and notifies the controller to set up the action in the stream.
p_controller | The stream controller. |
p_action1 | Source action to copy information from. |
p_action2 | The deserialized action to execute. |
Definition at line 201 of file mxdsbuffer.cpp.