Skip to main content
Version: 21 Aug 2024

NativeBindings

See ml_media_muxer.h for additional comments.

Inherits from:
MagicLeapNativeBindings

Public Methods

MLResult.Code MLMediaMuxerAddTrack

Add a track with given format information.

public MLResult.Code MLMediaMuxerAddTrack(
ulong muxerHandle,
ulong formatHandle,
out UIntPtr OutTrackIndex
)

Parameters

TypeNameDescription
ulongmuxerHandle
ulongformatHandle
out UIntPtrOutTrackIndex

MLResult.Code MLMediaMuxerConfigure

Configure the Muxer

public MLResult.Code MLMediaMuxerConfigure(
ulong muxerHandle,
int Format,
string Path
)

Parameters

TypeNameDescription
ulongmuxerHandle
intFormat
stringPath

MLResult.Code MLMediaMuxerCreate

Create a Muxer

public MLResult.Code MLMediaMuxerCreate(
out ulong muxerHandle
)

Parameters

TypeNameDescription
out ulongmuxerHandle

MLResult.Code MLMediaMuxerGetSupportedMimes

Get a list of all the supported mime-types for a given Media Muxer Output Format on the Platform. User doesn't own the memory/buffer returned from this API and MUST NOT be freeing or releasing the out_mime_list.

public MLResult.Code MLMediaMuxerGetSupportedMimes(
ulong muxerHandle,
OutputFormat Format,
out IntPtr OutMimeList,
out int OutMimeListSize
)

Parameters

TypeNameDescription
ulongmuxerHandle
OutputFormatFormatOutput formats for MediaMuxer.

Use Muxer.GetSupportedOutputFormats(out OutputFormat[]) to query for all supported output formats for the Muxer. | | out IntPtr |OutMimeList|| | out int |OutMimeListSize||


MLResult.Code MLMediaMuxerGetSupportedOutputFormats

Get a list of all the supported Media Muxer Output Formats on the Platform. User doesn't own the memory/buffer returned from this API and MUST NOT be freeing or releasing the out_format_list.

public MLResult.Code MLMediaMuxerGetSupportedOutputFormats(
ulong muxerHandle,
out IntPtr OutFormatList,
out int OutFormatListSize
)

Parameters

TypeNameDescription
ulongmuxerHandle
out IntPtrOutFormatList
out intOutFormatListSize

MLResult.Code MLMediaMuxerRelease

Release the Muxer

public MLResult.Code MLMediaMuxerRelease(
ulong muxerHandle
)

Parameters

TypeNameDescription
ulongmuxerHandle

MLResult.Code MLMediaMuxerSetLocation

Set and store the geodata (latitude and longitude) in the output file. This should be called before #MLMediaMuxerStart() and after #MLMediaMuxerConfigure. The geodata is stored in udta box if the output format is MLMediaMuxerOutputFormat_MPEG4, and is ignored for other output formats. The geodata is stored according to ISO-6709 standard.

public MLResult.Code MLMediaMuxerSetLocation(
ulong muxerHandle,
float Latitude,
float Longitude
)

Parameters

TypeNameDescription
ulongmuxerHandle
floatLatitude
floatLongitude

MLResult.Code MLMediaMuxerSetOrientationHint

Set the orientation hint for output video playback. This should be called before #MLMediaMuxerStart() and after #MLMediaMuxerConfigure. Calling this method will not rotate the video frame when muxer is generating the file, but add a composition matrix containing the rotation angle in the output video if the output format is MLMediaMuxerOutputFormat_MPEG4 so that a video player can choose the proper orientation for playback. Note that some video players may choose to ignore the composition matrix in a video during playback. By default, the rotation degree is 0.

public MLResult.Code MLMediaMuxerSetOrientationHint(
ulong muxerHandle,
int Degrees
)

Parameters

TypeNameDescription
ulongmuxerHandle
intDegrees

MLResult.Code MLMediaMuxerStart

Start muxing. Make sure all the tracks have been added (#MLMediaMuxerAddTrack) before calling this.

public MLResult.Code MLMediaMuxerStart(
ulong muxerHandle
)

Parameters

TypeNameDescription
ulongmuxerHandle

MLResult.Code MLMediaMuxerStop

Stop muxing. Once the muxer stops, it can not be restarted.

public MLResult.Code MLMediaMuxerStop(
ulong muxerHandle
)

Parameters

TypeNameDescription
ulongmuxerHandle

MLResult.Code MLMediaMuxerWriteSampleData

Writes an encoded sample into the muxer. The application needs to make sure that the samples are written into the right tracks. Also, it needs to make sure the samples for each track are written in chronological order (e. g. in the order they are provided by the encoder. ) For MPEG4 media format, the duration of the last sample in a track can be set by passing an additional empty buffer) with #MLMediaCodecBufferFlag_EOS flag and a suitable presentation timestamp set in time_us (of MLMediaMuxerSampleData structure) as the last sample of that track. This last sample's presentation timestamp shall be a sum of the presentation timestamp and the duration preferred for the original last sample. If no explicit END_OF_STREAM sample was passed, then the duration of the last sample would be the same as that of the sample before that. The buffer can be reused once this method returns.

public MLResult.Code MLMediaMuxerWriteSampleData(
ulong muxerHandle,
in MLMediaMuxerSampleData Data
)

Parameters

TypeNameDescription
ulongmuxerHandle
in MLMediaMuxerSampleDataDataData type that encapsulates sample data to be written in to Muxer.