Skip to main content
Version: 11 Nov 2025

ml_media_ttml.h

Classes​

Name
structMLTTMLImage
Byte data for TTML image cues.
structMLTTMLData
TTML data structure.

Types​

Name
typedef struct MLTTMLImageMLTTMLImage
Byte data for TTML image cues.
typedef struct MLTTMLDataMLTTMLData
TTML data structure.

Enums​

Name
enumMLTTMLLayoutAlignment
{
MLTTMLLayoutAlignment_Unspecified = 0x7FFFFFFF,
MLTTMLLayoutAlignment_Normal = 0,
MLTTMLLayoutAlignment_Center = 1,
MLTTMLLayoutAlignment_Opposite = 2,
MLTTMLLayoutAlignment_Ensure32Bits = 0x7FFFFFFF
}
Cue text alignment within the cue box.
enumMLTTMLLineType
{
MLTTMLLineType_Unset = 0x7FFFFFFF,
MLTTMLLineType_Fraction = 0,
MLTTMLLineType_Number = 1,
MLTTMLLineType_Ensure32Bits = 0x7FFFFFFF
}
Cue line type.
enumMLTTMLAnchorType
{
MLTTMLAnchorType_Unset = 0x7FFFFFFF,
MLTTMLAnchorType_Start = 0,
MLTTMLAnchorType_Middle = 1,
MLTTMLAnchorType_End = 2,
MLTTMLAnchorType_Ensure32Bits = 0x7FFFFFFF
}
Cue anchor type.
enumMLTTMLTextSizeType
{
MLTTMLTextSizeType_Unset = 0x7FFFFFFF,
MLTTMLTextSizeType_Fractional = 0,
MLTTMLTextSizeType_Fractional_Ignore_Padding = 1,
MLTTMLTextSizeType_Absolute = 2,
MLTTMLTextSizeType_Ensure32Bits = 0x7FFFFFFF
}
Cue text size type.

Attributes​

Name
const floatMLTTMLDimen_Unset
An unset position, width or size which is negative of maximum finite value of float (-FLT_MAX).

Enums Documentation​

MLTTMLLayoutAlignment​

EnumeratorValueDescription
MLTTMLLayoutAlignment_Unspecified0x7FFFFFFFAn unspecified alignment value.
MLTTMLLayoutAlignment_Normal0Normal alignment relative to text direction.
MLTTMLLayoutAlignment_Center1Centered alignment.
MLTTMLLayoutAlignment_Opposite2Opposite alignment relative to text direction.
MLTTMLLayoutAlignment_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Cue text alignment within the cue box.

API Level:

  • 20

MLTTMLLineType​

EnumeratorValueDescription
MLTTMLLineType_Unset0x7FFFFFFFAn unset line type value.
MLTTMLLineType_Fraction0Line position is fractional position within the viewport.
MLTTMLLineType_Number1Line position is number of lines, interpretation also depends on the line anchor type.
MLTTMLLineType_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Cue line type.

API Level:

  • 20

MLTTMLAnchorType​

EnumeratorValueDescription
MLTTMLAnchorType_Unset0x7FFFFFFFAn unset anchor type value.
MLTTMLAnchorType_Start0Anchors the left (for horizontal positions) or top (for vertical positions) edge of the cue box.
MLTTMLAnchorType_Middle1Anchors the middle of the cue box.
MLTTMLAnchorType_End2Anchors the right (for horizontal positions) or bottom (for vertical positions) edge of the cue box.
MLTTMLAnchorType_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Cue anchor type.

API Level:

  • 20

MLTTMLTextSizeType​

EnumeratorValueDescription
MLTTMLTextSizeType_Unset0x7FFFFFFFAn unset text size type value.
MLTTMLTextSizeType_Fractional0Text size is measured as a fraction of the viewport size minus the view padding.
MLTTMLTextSizeType_Fractional_Ignore_Padding1Text size is measured as a fraction of the viewport size, ignoring the view padding.
MLTTMLTextSizeType_Absolute2Text size is measured in number of pixels.
MLTTMLTextSizeType_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Cue text size type.

API Level:

  • 20

Types Documentation​

MLTTMLImage​

typedef struct MLTTMLImage MLTTMLImage;

Byte data for TTML image cues.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 20

MLTTMLData​

typedef struct MLTTMLData MLTTMLData;

TTML data structure.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 20

Attributes Documentation​

MLTTMLDimen_Unset​

static const float MLTTMLDimen_Unset = -3.402823466e+38F;

An unset position, width or size which is negative of maximum finite value of float (-FLT_MAX).

API Level:

  • 20

Source code​

// %BANNER_BEGIN%
// ---------------------------------------------------------------------
// %COPYRIGHT_BEGIN%
// Copyright (c) 2017 Magic Leap, Inc. All Rights Reserved.
// Use of this file is governed by the Software License Agreement,
// located here: https://www.magicleap.com/software-license-agreement-ml2
// Terms and conditions applicable to third-party materials accompanying
// this distribution may also be found in the top-level NOTICE file
// appearing herein.
// %COPYRIGHT_END%
// ---------------------------------------------------------------------
// %BANNER_END%

#pragma once

#include "ml_api.h"

ML_EXTERN_C_BEGIN

static const float MLTTMLDimen_Unset = -3.402823466e+38F;

typedef enum MLTTMLLayoutAlignment {
MLTTMLLayoutAlignment_Unspecified = 0x7FFFFFFF,
MLTTMLLayoutAlignment_Normal = 0,
MLTTMLLayoutAlignment_Center = 1,
MLTTMLLayoutAlignment_Opposite = 2,
MLTTMLLayoutAlignment_Ensure32Bits = 0x7FFFFFFF
} MLTTMLLayoutAlignment;

typedef enum MLTTMLLineType {
MLTTMLLineType_Unset = 0x7FFFFFFF,
MLTTMLLineType_Fraction = 0,
MLTTMLLineType_Number = 1,
MLTTMLLineType_Ensure32Bits = 0x7FFFFFFF
} MLTTMLLineType;

typedef enum MLTTMLAnchorType {
MLTTMLAnchorType_Unset = 0x7FFFFFFF,
MLTTMLAnchorType_Start = 0,
MLTTMLAnchorType_Middle = 1,
MLTTMLAnchorType_End = 2,
MLTTMLAnchorType_Ensure32Bits = 0x7FFFFFFF
} MLTTMLAnchorType;

typedef enum MLTTMLTextSizeType {
MLTTMLTextSizeType_Unset = 0x7FFFFFFF,
MLTTMLTextSizeType_Fractional = 0,
MLTTMLTextSizeType_Fractional_Ignore_Padding = 1,
MLTTMLTextSizeType_Absolute = 2,
MLTTMLTextSizeType_Ensure32Bits = 0x7FFFFFFF
} MLTTMLTextSizeType;

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLTTMLImage {
size_t size;
uint8_t *data;
} MLTTMLImage;

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLTTMLData {
int64_t start_time_ms;
int64_t end_time_ms;
char *text;
MLTTMLLayoutAlignment text_alignment;
MLTTMLImage bitmap;
float line;
MLTTMLLineType line_type;
MLTTMLAnchorType line_anchor;
float position;
MLTTMLAnchorType position_anchor;
float size;
float bitmap_height;
bool window_color_set;
uint32_t window_color;
MLTTMLTextSizeType text_size_type;
float text_size;
} MLTTMLData;

ML_EXTERN_C_END