// %BANNER_BEGIN%
// ---------------------------------------------------------------------
// %COPYRIGHT_BEGIN%
// Copyright (c) (2018-2022) 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%
namespace UnityEngine.XR.MagicLeap
{
using System;
using System.Runtime.InteropServices;
///
/// MLMediaTTML description goes here.
///
public partial class MLMediaTTML
{
///
/// See ml_media_ttml.h for additional comments.
///
private class NativeBindings : Native.MagicLeapNativeBindings
{
///
/// TTML data structure.
///
[StructLayout(LayoutKind.Sequential)]
public struct MLTTMLData
{
///
/// Track cue start time in milliseconds.
///
public long StartTimeMs;
///
/// Track cue end time in milliseconds.
///
public long EndTimeMs;
///
/// The cue text encoded as UTF-8. Or null if this is an image cue.
///
public string Text;
///
/// The alignment of the cue text within the cue box.
///
public MLTTMLLayoutAlignment TextAlignment;
///
/// The cue image if this is an image cue, an empty image otherwise.
///
public MLTTMLImage Bitmap;
///
/// The position of the #line_anchor of the cue box within the viewport in the direction orthogonal to the writing direction,
/// or . When set, the interpretation of the value depends on the value of #line_type.
/// For horizontal text and equal to ,
/// this is the fractional vertical position relative to the top of the viewport.
///
public float Line;
///
/// The cue line type. indicates that #line is a fractional position within the viewport.
/// 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 when using .
///
public MLTTMLLineType LineType;
///
/// The cue box anchor in the direction of line.
///
public MLTTMLAnchorType LineAnchor;
///
/// The fractional position of the #position_anchor of the cue box within the viewport in the direction orthogonal to #line,
/// or .
/// 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.
///
public float Position;
///
/// The cue box anchor in the direction of position.
///
public MLTTMLAnchorType PositionAnchor;
///
/// The cue box size in the writing direction, as a fraction of the viewport size or .
///
public float Size;
///
/// The cue bitmap height as a fraction of the viewport size or
/// if the bitmap should be displayed at its natural height given the bitmap dimensions and the specified #size.
///
public float BitmapHeight;
///
/// Specifies whether or not the property is set.
///
public bool WindowColorSet;
///
/// The cue window fill color in ARGB format.
///
public uint WindowColor;
///
/// The cue default text size type, or or if this cue has no default text size.
///
public MLTTMLTextSizeType TextSizeType;
///
/// The cue default text size, or if this cue has no default.
///
public float TextSize;
///
/// Create and return an initialized version of this struct.
///
/// A new instance of this struct.
public static MLTTMLData Create()
{
return new MLTTMLData()
{
};
}
};
///
/// Byte data for TTML image cues.
///
[StructLayout(LayoutKind.Sequential)]
public struct MLTTMLImage
{
///
/// Image size in bytes.
///
public uint Size;
///
/// Byte data of the image.
///
public IntPtr Data;
///
/// Create and return an initialized version of this struct.
///
/// A new instance of this struct.
public static MLTTMLImage Create()
{
return new MLTTMLImage()
{
Data = IntPtr.Zero,
Size = 0,
};
}
public static MLTTMLImage Create(IntPtr pointer, uint bufferLength)
{
return new MLTTMLImage()
{
Data = pointer,
Size = bufferLength,
};
}
};
}
}
}