Skip to main content
Version: 21 Aug 2024

ml_media_cea708_caption.h

Classes

Name
structMLCea708CaptionColor
Cea708 Caption Color.
structMLCea708CaptionPenAttr
Cea708 Caption Pen Attributes.
structMLCea708CaptionPenColor
Cea708 Caption Pen Color.
structMLCea708CaptionPenLocation
Cea708 Caption Pen Location.
structMLCea708CaptionWindowAttr
Cea708 Caption Window Attributes.
structMLCea708CaptionWindow
Cea708 Caption Window.
structMLCea708CaptionEvent
Cea708 Caption Event.

Types

Name
typedef struct MLCea708CaptionColorMLCea708CaptionColor
Cea708 Caption Color.
typedef struct MLCea708CaptionPenAttrMLCea708CaptionPenAttr
Cea708 Caption Pen Attributes.
typedef struct MLCea708CaptionPenColorMLCea708CaptionPenColor
Cea708 Caption Pen Color.
typedef struct MLCea708CaptionPenLocationMLCea708CaptionPenLocation
Cea708 Caption Pen Location.
typedef struct MLCea708CaptionWindowAttrMLCea708CaptionWindowAttr
Cea708 Caption Window Attributes.
typedef struct MLCea708CaptionWindowMLCea708CaptionWindow
Cea708 Caption Window.
typedef struct MLCea708CaptionEventMLCea708CaptionEvent
Cea708 Caption Event.
typedef void()(MLHandle cc_handle, const MLCea708CaptionEvent event, void *data)MLMediaCea708ParserEmitEventCallback
Callback signature called when Cea708 parser emits event.

Enums

Name
enumAnonymous Enum 17
{
MLCea708CaptionWindows_Max = 8
}
Cea708 Caption maximum windows constant.
enumAnonymous Enum 18
{
MLCea708CaptionEmitCommandBuffer_MaxSize = 20
}
Maximum size for Cea708 Caption Emit command buffers.
enumMLCea708CaptionEmitCommand
{
MLCea708CaptionEmitCommand_Buffer = 1,
MLCea708CaptionEmitCommand_Control = 2,
MLCea708CaptionEmitCommand_CWX = 3,
MLCea708CaptionEmitCommand_CLW = 4,
MLCea708CaptionEmitCommand_DSW = 5,
MLCea708CaptionEmitCommand_HDW = 6,
MLCea708CaptionEmitCommand_TGW = 7,
MLCea708CaptionEmitCommand_DLW = 8,
MLCea708CaptionEmitCommand_DLY = 9,
MLCea708CaptionEmitCommand_DLC = 10,
MLCea708CaptionEmitCommand_RST = 11,
MLCea708CaptionEmitCommand_SPA = 12,
MLCea708CaptionEmitCommand_SPC = 13,
MLCea708CaptionEmitCommand_SPL = 14,
MLCea708CaptionEmitCommand_SWA = 15,
MLCea708CaptionEmitCommand_DFX = 16,
MLCea708CaptionEmitCommand_Ensure32Bits = 0x7FFFFFFF
}
Cea708 Caption Emit Commands constants.
enumMLCea708CaptionEmitCommandControl
{
MLCea708CaptionEmitCommandControl_ETX = 0x03,
MLCea708CaptionEmitCommandControl_BS = 0x08,
MLCea708CaptionEmitCommandControl_FF = 0x0c,
MLCea708CaptionEmitCommandControl_HCR = 0x0e,
MLCea708CaptionEmitCommandControl_Ensure32Bits = 0x7FFFFFFF
}
Cea708 Caption Emit Command Control constants.
enumMLCea708CaptionColorOpacity
{
MLCea708CaptionColorOpacity_SOLID = 0,
MLCea708CaptionColorOpacity_FLASH = 1,
MLCea708CaptionColorOpacity_TRANSLUCENT = 2,
MLCea708CaptionColorOpacity_TRANSPARENT = 3,
MLCea708CaptionColorOpacity_Ensure32Bits = 0x7FFFFFFF
}
Cea708 Caption Color Opacity constants.
enumMLCea708CaptionPenSize
{
MLCea708CaptionPenSize_SMALL = 0,
MLCea708CaptionPenSize_STANDARD = 1,
MLCea708CaptionPenSize_LARGE = 2,
MLCea708CaptionPenSize_Ensure32Bits = 0x7FFFFFFF
}
Cea708 Caption Pen Size constants.
enumMLCea708CaptionPenOffset
{
MLCea708CaptionPenOffset_SUBSCRIPT = 0,
MLCea708CaptionPenOffset_NORMAL = 1,
MLCea708CaptionPenOffset_SUPERSCRIPT = 2,
MLCea708CaptionPenOffset_Ensure32Bits = 0x7FFFFFFF
}
Cea708 Caption Pen Offset constants.

Functions

Name
MLResultMLMediaCea708ParserCreate(MLHandle * out_handle)
Create Cea708 parser object.
MLResultMLMediaCea708ParserParse(MLHandle cc_handle, const uint8_t * subtitle_data, uint32_t subtitle_data_size)
Provide Cea708 parser with subtitle raw data for parsing.
MLResultMLMediaCea708ParserDestroy(MLHandle cc_handle)
Release Cea708 parser object.
MLResultMLMediaCea708ParserSetEmitEventCallback(MLHandle cc_handle, MLMediaCea708ParserEmitEventCallback on_emit_event_callback, void * data)
Set callback to get notified when a caption event has generated.

Enums Documentation

Anonymous Enum 17

EnumeratorValueDescription
MLCea708CaptionWindows_Max8

Cea708 Caption maximum windows constant.

API Level:

  • 8

Anonymous Enum 18

EnumeratorValueDescription
MLCea708CaptionEmitCommandBuffer_MaxSize20

Maximum size for Cea708 Caption Emit command buffers.

API Level:

  • 8

MLCea708CaptionEmitCommand

EnumeratorValueDescription
MLCea708CaptionEmitCommand_Buffer1Buffer.
MLCea708CaptionEmitCommand_Control2Control.
MLCea708CaptionEmitCommand_CWX3SetCurrentWindow tells the caption decoder which window the following commands describe: SetWindowAttributes SetPenAttributes SetPenColor SetPenLocation. If the window specified has not already been created with a DefineWindow command then, SetCurrentWindow and the window property commands can be safely ignored.
MLCea708CaptionEmitCommand_CLW4ClearWindows clears all the windows specified in the 8 bit window bitmap.
MLCea708CaptionEmitCommand_DSW5DisplayWindows displays all the windows specified in the 8 bit window bitmap.
MLCea708CaptionEmitCommand_HDW6HideWindows hides all the windows specified in the 8 bit window bitmap.
MLCea708CaptionEmitCommand_TGW7ToggleWindows hides all displayed windows, and displays all hidden windows specified in the 8 bit window bitmap.
MLCea708CaptionEmitCommand_DLW8DeleteWindows deletes all the windows specified in the 8 bit window bitmap. If the current window, as specified by the last SetCurrentWindow command, is deleted then the current window becomes undefined and the window attribute commands should have no effect until after the next SetCurrentWindow or DefineWindow command.
MLCea708CaptionEmitCommand_DLY9Delay suspends all processing of the current service, except for DelayCancel and Reset scanning.
MLCea708CaptionEmitCommand_DLC10DelayCancel terminates any active delay and resumes normal command processing. DelayCancel should be scanned for during a Delay.
MLCea708CaptionEmitCommand_RST11Reset deletes all windows, cancels any active delay, and clears the buffer before the Reset command. Reset should be scanned for during a Delay.
MLCea708CaptionEmitCommand_SPA12The SetPenAttributes command specifies how certain attributes of subsequent characters are to be rendered in the current window, until the next SetPenAttributes command.
MLCea708CaptionEmitCommand_SPC13SetPenColor sets the foreground, background, and edge color for the subsequent characters.
MLCea708CaptionEmitCommand_SPL14SetPenLocation sets the location of for the next bit of appended text in the current window. It has two parameters, row and column.
MLCea708CaptionEmitCommand_SWA15SetWindowAttributes Sets the window attributes of the current window.
MLCea708CaptionEmitCommand_DFX16DefineWindow0-7 creates one of the eight windows used by a caption decoder.
MLCea708CaptionEmitCommand_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Cea708 Caption Emit Commands constants.

API Level:

  • 8

MLCea708CaptionEmitCommandControl

EnumeratorValueDescription
MLCea708CaptionEmitCommandControl_ETX0x03End of Text.
MLCea708CaptionEmitCommandControl_BS0x08
MLCea708CaptionEmitCommandControl_FF0x0c
MLCea708CaptionEmitCommandControl_HCR0x0e
MLCea708CaptionEmitCommandControl_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Cea708 Caption Emit Command Control constants.

API Level:

  • 8

MLCea708CaptionColorOpacity

EnumeratorValueDescription
MLCea708CaptionColorOpacity_SOLID0
MLCea708CaptionColorOpacity_FLASH1
MLCea708CaptionColorOpacity_TRANSLUCENT2
MLCea708CaptionColorOpacity_TRANSPARENT3
MLCea708CaptionColorOpacity_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Cea708 Caption Color Opacity constants.

API Level:

  • 8

MLCea708CaptionPenSize

EnumeratorValueDescription
MLCea708CaptionPenSize_SMALL0
MLCea708CaptionPenSize_STANDARD1
MLCea708CaptionPenSize_LARGE2
MLCea708CaptionPenSize_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Cea708 Caption Pen Size constants.

API Level:

  • 8

MLCea708CaptionPenOffset

EnumeratorValueDescription
MLCea708CaptionPenOffset_SUBSCRIPT0
MLCea708CaptionPenOffset_NORMAL1
MLCea708CaptionPenOffset_SUPERSCRIPT2
MLCea708CaptionPenOffset_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Cea708 Caption Pen Offset constants.

API Level:

  • 8

Types Documentation

MLCea708CaptionColor

typedef struct MLCea708CaptionColor MLCea708CaptionColor;

Cea708 Caption Color.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 8

MLCea708CaptionPenAttr

typedef struct MLCea708CaptionPenAttr MLCea708CaptionPenAttr;

Cea708 Caption Pen Attributes.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 8

MLCea708CaptionPenColor

typedef struct MLCea708CaptionPenColor MLCea708CaptionPenColor;

Cea708 Caption Pen Color.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 8

MLCea708CaptionPenLocation

typedef struct MLCea708CaptionPenLocation MLCea708CaptionPenLocation;

Cea708 Caption Pen Location.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 8

MLCea708CaptionWindowAttr

typedef struct MLCea708CaptionWindowAttr MLCea708CaptionWindowAttr;

Cea708 Caption Window Attributes.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 8

MLCea708CaptionWindow

typedef struct MLCea708CaptionWindow MLCea708CaptionWindow;

Cea708 Caption Window.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 8

MLCea708CaptionEvent

typedef struct MLCea708CaptionEvent MLCea708CaptionEvent;

Cea708 Caption Event.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 8

MLMediaCea708ParserEmitEventCallback

typedef void(* MLMediaCea708ParserEmitEventCallback) (MLHandle cc_handle, const MLCea708CaptionEvent *event, void *data);

Callback signature called when Cea708 parser emits event.

Parameters

cc_handleMLHandle is a Cea708 Parser instance for which callback was called.
eventMLCea708CaptionEvent conveys caption event to listener.
dataCustom data to be returned when callback is fired.

API Level:

  • 8

Functions Documentation

MLMediaCea708ParserCreate

MLResult MLMediaCea708ParserCreate(
MLHandle * out_handle
)

Create Cea708 parser object.

Parameters

MLHandle *out_handleA pointer to an MLHandle which will contain the handle to the Cea708 parser. If this operation fails, out_handle will be ML_INVALID_HANDLE.

Returns

MLResultMLResult_AllocFailedThe operation failed with memory allocation error.
MLResultMLResult_InvalidParamout_handle is null.
MLResultMLResult_OkInternal Cea708 parser object was created successfully.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 8

MLMediaCea708ParserParse

MLResult MLMediaCea708ParserParse(
MLHandle cc_handle,
const uint8_t * subtitle_data,
uint32_t subtitle_data_size
)

Provide Cea708 parser with subtitle raw data for parsing.

Parameters

MLHandlecc_handleA handle to a Cea708 parser.
const uint8_t *subtitle_dataSubtitle data of MLMediaPlayerSubtitleData.
uint32_tsubtitle_data_sizeSubtitle data size of MLMediaPlayerSubtitleData.

Returns

MLResultMLResult_InvalidParamthe input parameter(s) is(are) wrong.
MLResultMLResult_Okthe operation was successful.
MLResultMLMediaGenericResult_NoInitCea708 parser was not properly built or initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 8

MLMediaCea708ParserDestroy

MLResult MLMediaCea708ParserDestroy(
MLHandle cc_handle
)

Release Cea708 parser object.

Parameters

MLHandlecc_handleA handle to a Cea708 parser.

Returns

MLResultMLResult_InvalidParamcc_handle is wrong or not found.
MLResultMLResult_Okinternal Cea708 parser object was released successfully.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 8

MLMediaCea708ParserSetEmitEventCallback

MLResult MLMediaCea708ParserSetEmitEventCallback(
MLHandle cc_handle,
MLMediaCea708ParserEmitEventCallback on_emit_event_callback,
void * data
)

Set callback to get notified when a caption event has generated.

Parameters

MLHandlecc_handleA handle to a Cea708 parser.
MLMediaCea708ParserEmitEventCallbackon_emit_event_callbackFunction pointer for event callback. See MLMediaCea708ParserEmitEventCallback() callback declaration and comments for explanation on expected callback parameters. This can be 'NULL' to unset the callback.
void *dataCustom data to be returned when callback is fired.

Returns

MLResultMLResult_InvalidParamPassed cc_handle handle was not found.
MLResultMLResult_OkCallback was successfully set.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 8

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"
#include "ml_types.h"

ML_EXTERN_C_BEGIN

enum {
MLCea708CaptionWindows_Max = 8
};

enum {
MLCea708CaptionEmitCommandBuffer_MaxSize = 20,
};

typedef enum MLCea708CaptionEmitCommand {
MLCea708CaptionEmitCommand_Buffer = 1,
MLCea708CaptionEmitCommand_Control = 2,
MLCea708CaptionEmitCommand_CWX = 3,
MLCea708CaptionEmitCommand_CLW = 4,
MLCea708CaptionEmitCommand_DSW = 5,
MLCea708CaptionEmitCommand_HDW = 6,
MLCea708CaptionEmitCommand_TGW = 7,
MLCea708CaptionEmitCommand_DLW = 8,
MLCea708CaptionEmitCommand_DLY = 9,
MLCea708CaptionEmitCommand_DLC = 10,
MLCea708CaptionEmitCommand_RST = 11,
MLCea708CaptionEmitCommand_SPA = 12,
MLCea708CaptionEmitCommand_SPC = 13,
MLCea708CaptionEmitCommand_SPL = 14,
MLCea708CaptionEmitCommand_SWA = 15,
MLCea708CaptionEmitCommand_DFX = 16,
MLCea708CaptionEmitCommand_Ensure32Bits = 0x7FFFFFFF
} MLCea708CaptionEmitCommand;

typedef enum MLCea708CaptionEmitCommandControl {
MLCea708CaptionEmitCommandControl_ETX = 0x03,
MLCea708CaptionEmitCommandControl_BS = 0x08,
MLCea708CaptionEmitCommandControl_FF = 0x0c,
MLCea708CaptionEmitCommandControl_HCR = 0x0e,
MLCea708CaptionEmitCommandControl_Ensure32Bits = 0x7FFFFFFF
} MLCea708CaptionEmitCommandControl;

typedef enum MLCea708CaptionColorOpacity {
MLCea708CaptionColorOpacity_SOLID = 0,
MLCea708CaptionColorOpacity_FLASH = 1,
MLCea708CaptionColorOpacity_TRANSLUCENT = 2,
MLCea708CaptionColorOpacity_TRANSPARENT = 3,
MLCea708CaptionColorOpacity_Ensure32Bits = 0x7FFFFFFF
} MLCea708CaptionColorOpacity;

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLCea708CaptionColor {
MLCea708CaptionColorOpacity opacity;
int32_t red;
int32_t green;
int32_t blue;
} MLCea708CaptionColor;

typedef enum MLCea708CaptionPenSize {
MLCea708CaptionPenSize_SMALL = 0,
MLCea708CaptionPenSize_STANDARD = 1,
MLCea708CaptionPenSize_LARGE = 2,
MLCea708CaptionPenSize_Ensure32Bits = 0x7FFFFFFF
} MLCea708CaptionPenSize;

typedef enum MLCea708CaptionPenOffset {
MLCea708CaptionPenOffset_SUBSCRIPT = 0,
MLCea708CaptionPenOffset_NORMAL = 1,
MLCea708CaptionPenOffset_SUPERSCRIPT = 2,
MLCea708CaptionPenOffset_Ensure32Bits = 0x7FFFFFFF
} MLCea708CaptionPenOffset;

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLCea708CaptionPenAttr {
MLCea708CaptionPenSize pen_size;
MLCea708CaptionPenOffset pen_offset;
int32_t text_tag;
int32_t font_tag;
int32_t edge_type;
bool underline;
bool italic;
} MLCea708CaptionPenAttr;

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLCea708CaptionPenColor {
MLCea708CaptionColor foreground_color;
MLCea708CaptionColor background_color;
MLCea708CaptionColor edge_color;
} MLCea708CaptionPenColor;

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLCea708CaptionPenLocation {
int32_t row;
int32_t column;
} MLCea708CaptionPenLocation;

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLCea708CaptionWindowAttr {
MLCea708CaptionColor fill_color;
MLCea708CaptionColor border_color;
int32_t border_type;
bool word_wrap;
int32_t print_direction;
int32_t scroll_direction;
int32_t justify;
int32_t effect_direction;
int32_t effect_speed;
int32_t display_effect;
} MLCea708CaptionWindowAttr;

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLCea708CaptionWindow {
int32_t id;
bool visible;
bool row_lock;
bool column_lock;
int32_t priority;
bool relative_positioning;
int32_t anchor_vertical;
int32_t anchor_horizontal;
int32_t anchor_id;
int32_t row_count;
int32_t column_count;
int32_t pen_style;
int32_t window_style;
} MLCea708CaptionWindow;

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLCea708CaptionEvent {
MLCea708CaptionEmitCommand type;
const void *obj;
} MLCea708CaptionEvent;

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaCea708ParserCreate(MLHandle *out_handle);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaCea708ParserParse(MLHandle cc_handle, const uint8_t *subtitle_data, uint32_t subtitle_data_size);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaCea708ParserDestroy(MLHandle cc_handle);

typedef void(*MLMediaCea708ParserEmitEventCallback)(MLHandle cc_handle, const MLCea708CaptionEvent *event, void *data);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaCea708ParserSetEmitEventCallback(MLHandle cc_handle, MLMediaCea708ParserEmitEventCallback on_emit_event_callback, void *data);

ML_EXTERN_C_END