Skip to content

Utility functions

Dimitri Podborski edited this page Sep 17, 2020 · 1 revision

ISONewHandle

ISOErr ISONewHandle( u32 handleSize, ISOHandle *outHandle );

Creates a new handle, and allocates handleSize bytes for it. It is OK to call this with a size of zero. This is commonly done when the handle will be used as a parameter to a function that will size it appropriately.

ISOSetHandleSize

ISOErr ISOSetHandleSize( ISOHandle h, u32 handleSize );

Sets the logical size of the handle to handleSize bytes. If this is larger than the number of bytes allocated for this handle, the handle will be grown accordingly. If the new size is smaller than the allocated size the memory is not freed. The only way to free this memory is to dispose of the handle.

ISODisposeHandle

ISOErr ISODisposeHandle( ISOHandle h );

Frees the memory that was allocated for a handle.

ISOGetHandleSize

ISOErr ISOGetHandleSize( ISOHandle h, u32 *outHandleSize );

Use this to determine the present logical size (in bytes) of a handle.

MP4HandleCat

ISOErr MP4HandleCat (	MP4Handle theDstHandle, MP4Handle theSrcHandle);

Appends the data contained in theSrcHandle to data contained in theDstHandle by reallocating, if necessary, the number of bytes allocated for theDstHandle.

ISOSetHandleOffset

ISOErr MP4SetHandleOffset( MP4Handle theHandle, u32 offset );

Sets the handle so that subsequent de-references of it refer to the data starting at the given byte offset. This can be used to cause data to be read from or written to locations after the beginning, leaving room (for example) for an encryption header.