Skip to main content
Version: 20 Mar 2024

NativeBindings

See ml_media_format.h for additional comments.

Inherits from:
MagicLeapNativeBindings

Public Methods

MLResult.Code MLMediaFormatCreate

Create an empty format object.

public MLResult.Code MLMediaFormatCreate(
out ulong outHandle
)

Parameters

TypeNameDescription
out ulongoutHandle

MLResult.Code MLMediaFormatCreateAudio

Create a audio format object.

public MLResult.Code MLMediaFormatCreateAudio(
string MimeType,
int SampleRate,
int ChannelCount,
out ulong outHandle
)

Parameters

TypeNameDescription
stringMimeType
intSampleRate
intChannelCount
out ulongoutHandle

MLResult.Code MLMediaFormatCreateCopy

Create a copy of the format handle provided.

public MLResult.Code MLMediaFormatCreateCopy(
ulong handle,
out ulong outHandle
)

Parameters

TypeNameDescription
ulonghandle
out ulongoutHandle

MLResult.Code MLMediaFormatCreateSubtitle

Create a subtitle format object.

public MLResult.Code MLMediaFormatCreateSubtitle(
string MimeType,
string Language,
out ulong outHandle
)

Parameters

TypeNameDescription
stringMimeType
stringLanguage
out ulongoutHandle

MLResult.Code MLMediaFormatCreateVideo

Create a video format object.

public MLResult.Code MLMediaFormatCreateVideo(
string mimeType,
int Width,
int Height,
out ulong outHandle
)

Parameters

TypeNameDescription
stringmimeType
intWidth
intHeight
out ulongoutHandle

MLResult.Code MLMediaFormatDestroy

Destroy a format object.

public MLResult.Code MLMediaFormatDestroy(
ulong handle
)

Parameters

TypeNameDescription
ulonghandle

MLResult.Code MLMediaFormatGetKeyByteBuffer

Obtain the value of a ByteBuffer key.

public MLResult.Code MLMediaFormatGetKeyByteBuffer(
ulong handle,
string name,
out MLMediaFormatByteArray OutBuffer
)

Parameters

TypeNameDescription
ulonghandle
stringname
out MLMediaFormatByteArrayOutBuffer

MLResult.Code MLMediaFormatGetKeySize

Obtain the size of a key.

public MLResult.Code MLMediaFormatGetKeySize(
ulong handle,
string name,
out ulong outSize
)

Parameters

TypeNameDescription
ulonghandle
stringname
out ulongoutSize

MLResult.Code MLMediaFormatGetKeyString

Obtain the value of a string key. User shall allocate at least #MAX_KEY_STRING_SIZE bytes of memory for storing the output key string.

public MLResult.Code MLMediaFormatGetKeyString(
ulong handle,
string name,
IntPtr outString
)

Parameters

TypeNameDescription
ulonghandle
stringname
IntPtroutString

MLResult.Code MLMediaFormatGetKeyValueFloat

Obtain the value of an float key.

public MLResult.Code MLMediaFormatGetKeyValueFloat(
ulong handle,
string name,
out float outKey
)

Parameters

TypeNameDescription
ulonghandle
stringname
out floatoutKey

MLResult.Code MLMediaFormatGetKeyValueInt32

Obtain the value of an integer key. For example, use #MLMediaFormat_Key_Frame_Rate key to get the framerate of a video track.

public MLResult.Code MLMediaFormatGetKeyValueInt32(
ulong handle,
string name,
out int outKey
)

Parameters

TypeNameDescription
ulonghandle
stringname
out intoutKey

MLResult.Code MLMediaFormatGetKeyValueInt64

Obtain the value of an long key. For example, use MLMediaFormat_Key_Duration key to get duration of a track.

public MLResult.Code MLMediaFormatGetKeyValueInt64(
ulong handle,
string name,
out long outKey
)

Parameters

TypeNameDescription
ulonghandle
stringname
out longoutKey

MLResult.Code MLMediaFormatKeyByteBufferRelease

Release the ByteBuffer acquired by MLMediaFormatGetKeyByteBuffer.

public MLResult.Code MLMediaFormatKeyByteBufferRelease(
ulong handle,
ref MLMediaFormatByteArray buffer
)

Parameters

TypeNameDescription
ulonghandle
ref MLMediaFormatByteArraybuffer

MLResult.Code MLMediaFormatObjectToString

Obtain the human readable representation of the format. User shall allocate at least #MAX_FORMAT_STRING_SIZE bytes of memory for storing the output format string. The format string contains a list of key-value pairs, which can be extracted individually via the suitable "GetKeyValue" APIs.

public MLResult.Code MLMediaFormatObjectToString(
ulong handle,
IntPtr outString
)

Parameters

TypeNameDescription
ulonghandle
IntPtroutString

MLResult.Code MLMediaFormatSetKeyByteBuffer

Set the value of a ByteBuffer key.

public MLResult.Code MLMediaFormatSetKeyByteBuffer(
ulong handle,
string name,
ref MLMediaFormatByteArray Buffer
)

Parameters

TypeNameDescription
ulonghandle
stringname
ref MLMediaFormatByteArrayBuffer

MLResult.Code MLMediaFormatSetKeyFloat

Set the value of a float key.

public MLResult.Code MLMediaFormatSetKeyFloat(
ulong handle,
string name,
float keyValue
)

Parameters

TypeNameDescription
ulonghandle
stringname
floatkeyValue

MLResult.Code MLMediaFormatSetKeyInt32

Set the value of an integer key.

public MLResult.Code MLMediaFormatSetKeyInt32(
ulong handle,
string name,
int keyValue
)

Parameters

TypeNameDescription
ulonghandle
stringname
intkeyValue

MLResult.Code MLMediaFormatSetKeyInt64

Set the value of a long key.

public MLResult.Code MLMediaFormatSetKeyInt64(
ulong handle,
string name,
long keyValue
)

Parameters

TypeNameDescription
ulonghandle
stringname
longkeyValue

MLResult.Code MLMediaFormatSetKeySize

Set the size of a key.

public MLResult.Code MLMediaFormatSetKeySize(
ulong handle,
string name,
ulong keySize
)

Parameters

TypeNameDescription
ulonghandle
stringname
ulongkeySize

MLResult.Code MLMediaFormatSetKeyString

Set the value of a string key.

public MLResult.Code MLMediaFormatSetKeyString(
ulong handle,
string name,
string KeyValue
)

Parameters

TypeNameDescription
ulonghandle
stringname
stringKeyValue

Public Attributes

MAX_FORMAT_STRING_SIZE

Internal max size of format string.


public static int MAX_FORMAT_STRING_SIZE = 512;


MAX_KEY_STRING_SIZE

Internal max size of key string.


public static int MAX_KEY_STRING_SIZE = 64;