Skip to main content
Version: 20 Mar 2024

MLTTMLData

Module: Media Player

TTML data structure. More...

#include <ml_media_ttml.h>

Public Attributes

TypeName
int64_tstart_time_ms
int64_tend_time_ms
char *text
MLTTMLLayoutAlignmenttext_alignment
MLTTMLImagebitmap
floatline
The position of the line_anchor of the cue box within the viewport in the direction orthogonal to the writing direction, or MLTTMLDimen_Unset.
MLTTMLLineTypeline_type
The cue line type.
MLTTMLAnchorTypeline_anchor
floatposition
The fractional position of the position_anchor of the cue box within the viewport in the direction orthogonal to line, or MLTTMLDimen_Unset.
MLTTMLAnchorTypeposition_anchor
floatsize
floatbitmap_height
boolwindow_color_set
uint32_twindow_color
MLTTMLTextSizeTypetext_size_type
floattext_size

Detailed Description

struct MLTTMLData;

TTML data structure.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 20

Public Attributes Documentation

start_time_ms

int64_t start_time_ms;

Track cue start time in milliseconds.


end_time_ms

int64_t end_time_ms;

Track cue end time in milliseconds.


text

char * text;

The cue text encoded as UTF-8. Or null if this is an image cue.


text_alignment

MLTTMLLayoutAlignment text_alignment;
TypeDescription
MLTTMLLayoutAlignmentCue text alignment within the cue box.

The alignment of the cue text within the cue box.


bitmap

MLTTMLImage bitmap;
TypeDescription
MLTTMLImageByte data for TTML image cues.

The cue image if this is an image cue, an empty image otherwise.


line

float line;

The position of the line_anchor of the cue box within the viewport in the direction orthogonal to the writing direction, or MLTTMLDimen_Unset.

When set, the interpretation of the value depends on the value of line_type. For horizontal text and line_type equal to MLTTMLLineType_Fraction, this is the fractional vertical position relative to the top of the viewport.


line_type

MLTTMLLineType line_type;

The cue line type.

TypeDescription
MLTTMLLineTypeCue line type.

MLTTMLLineType_Fraction indicates that line is a fractional position within the viewport.

MLTTMLLineType_Number indicates that line is a line number, where the size of each line is taken to be the size of the first line of the cue. When line is greater than or equal to 0 lines count from the start of the viewport, with 0 indicating zero offset from the start edge. When line is negative lines count from the end of the viewport, with -1 indicating zero offset from the end edge. For horizontal text the line spacing is the height of the first line of the cue, and the start and end of the viewport are the top and bottom respectively.

Note that it's particularly important to consider the effect of line_anchor when using MLTTMLLineType_Number.


(line == 0 && line_anchor == MLTTMLAnchorType_Start)

Positions a (potentially multi-line) cue at the very top of the viewport.


(line == -1 && line_anchor == MLTTMLAnchorType_EndD)

Positions a (potentially multi-line) cue at the very bottom of the viewport.


(line == 0 && line_anchor == MLTTMLAnchorType_End)

and ```cpp

(line == -1 && line_anchor == MLTTMLAnchorType_Start)


Position cues entirely outside of the viewport.

```cpp

(line == 1 && line_anchor == MLTTMLAnchorType_End)

Positions a cue so that only the last line is visible at the top of the viewport.


(line == -2 && line_anchor == MLTTMLAnchorType_Start)

Position a cue so that only its first line is visible at the bottom of the viewport.


line_anchor

MLTTMLAnchorType line_anchor;
TypeDescription
MLTTMLAnchorTypeCue anchor type.

The cue box anchor in the direction of line.


position

float position;

The fractional position of the position_anchor of the cue box within the viewport in the direction orthogonal to line, or MLTTMLDimen_Unset.

For horizontal text, this is the horizontal position relative to the left of the viewport. Note that positioning is relative to the left of the viewport even in the case of right-to-left text.


position_anchor

MLTTMLAnchorType position_anchor;
TypeDescription
MLTTMLAnchorTypeCue anchor type.

The cue box anchor in the direction of position.


size

float size;

The cue box size in the writing direction, as a fraction of the viewport size or MLTTMLDimen_Unset.


bitmap_height

float bitmap_height;

The cue bitmap height as a fraction of the viewport size or MLTTMLDimen_Unset if the bitmap should be displayed at its natural height given the bitmap dimensions and the specified size.


window_color_set

bool window_color_set;

Specifies whether or not the window_color property is set.


window_color

uint32_t window_color;

The cue window fill color in ARGB format.


text_size_type

MLTTMLTextSizeType text_size_type;
TypeDescription
MLTTMLTextSizeTypeCue text size type.

The cue default text size type, or MLTTMLTextSizeType_Unset if this cue has no default text size.


text_size

float text_size;

The cue default text size, or MLTTMLDimen_Unset if this cue has no default.