libclosedcaption 1.0.3
ISDB-Tb/SBTVD (Brazilian DTV) closed caption extraction from MPEG-TS
Loading...
Searching...
No Matches
caption-closed-controls.h File Reference

C0, C1 and CSI control commands of the caption text. More...

#include "caption-common.h"
#include "caption-data.h"
#include "caption-closed.h"
#include "caption-management.h"
Include dependency graph for caption-closed-controls.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  CC_ControlCodes_CallbackData_t
 
struct  CaptionClosedControls_t
 
struct  csi_arg_Pn
 

Macros

#define DEBUG_CAPTION_CLOSED_CONTROLCODE
 
#define CAPTION_CTRL_SET(code, callback)   { code, callback, #code }
 
#define CTRL_C0_NULL   0x00
 
#define CTRL_C0_BELL   0x07
 
#define CTRL_CSI_FB   0x20
 
#define CTRL_CSI_IB   0x3b
 
#define CTRL_CSI_MAX_Pn_ARGS   5
 
#define CTRL_CSI_MAX_Pn_FIELDS   (5+1)
 

Typedefs

typedef uint8_t CaptionClosed_CtrlCode_t
 

Enumerations

enum  CaptionClosed_CtrlCodes_C0 {
  CTRL_C0_APB = 0x08 , CTRL_C0_APF = 0x09 , CTRL_C0_APD = 0x0a , CTRL_C0_APU = 0x0b ,
  CTRL_C0_CS = 0x0c , CTRL_C0_APR = 0x0d , CTRL_C0_LS1 = 0x0e , CTRL_C0_LS0 = 0x0f ,
  CTRL_C0_PAD_0x01 = 0x10 , CTRL_C0_PAD_0x02 = 0x11 , CTRL_C0_PAD_0x03 = 0x12 , CTRL_C0_PAD_0x04 = 0x13 ,
  CTRL_C0_PAD_0x05 = 0x14 , CTRL_C0_PAD_0x06 = 0x15 , CTRL_C0_PAPF = 0x16 , CTRL_C0_PAD_0x17 = 0x17 ,
  CTRL_C0_CAN = 0x18 , CTRL_C0_SS2 = 0x19 , CTRL_C0_PAD_0x1a = 0x1a , CTRL_C0_ESC = 0x1b ,
  CTRL_C0_APS = 0x1c , CTRL_C0_SS3 = 0x1d , CTRL_C0_RS = 0x1e , CTRL_C0_US = 0x1f
}
 
enum  CaptionClosed_CtrlCodes_C1 {
  CTRL_C1_BKF = 0x80 , CTRL_C1_RDF = 0x81 , CTRL_C1_GRF = 0x82 , CTRL_C1_YLF = 0x83 ,
  CTRL_C1_BLF = 0x84 , CTRL_C1_MGF = 0x85 , CTRL_C1_CNF = 0x86 , CTRL_C1_WHF = 0x87 ,
  CTRL_C1_SSZ = 0x88 , CTRL_C1_MSZ = 0x89 , CTRL_C1_NSZ = 0x8a , CTRL_C1_SZX = 0x8b ,
  CTRL_C1_PAD_0x8c = 0x8c , CTRL_C1_PAD_0x8d = 0x8d , CTRL_C1_PAD_0x8e = 0x8e , CTRL_C1_PAD_0x8f = 0x8f ,
  CTRL_C1_COL = 0x90 , CTRL_C1_FLC = 0x91 , CTRL_C1_CDC = 0x92 , CTRL_C1_POL = 0x93 ,
  CTRL_C1_WMM = 0x94 , CTRL_C1_MAC = 0x95 , CTRL_C1_PAD_0x96 = 0x96 , CTRL_C1_HLC = 0x97 ,
  CTRL_C1_RPC = 0x98 , CTRL_C1_SPL = 0x99 , CTRL_C1_STL = 0x9a , CTRL_C1_CSI = 0x9b ,
  CTRL_C1_PAD_0x9c = 0x9c , CTRL_C1_TIM = 0x9d , CTRL_C1_PAD_0x9e = 0x9e , CTRL_C1_PAD_0x9f = 0x9f
}
 
enum  CaptionClosed_CtrlCodes_C1_CSI {
  CTRL_C1_CSI_SWF = 0x53 , CTRL_C1_CSI_PAD_0x54 = 0x54 , CTRL_C1_CSI_PAD_0x55 = 0x55 , CTRL_C1_CSI_SDF = 0x56 ,
  CTRL_C1_CSI_SSM = 0x57 , CTRL_C1_CSI_SHS = 0x58 , CTRL_C1_CSI_SVS = 0x59 , CTRL_C1_CSI_PAD_0x5a = 0x5a ,
  CTRL_C1_CSI_PAD_0x5b = 0x5b , CTRL_C1_CSI_PAD_0x5c = 0x5c , CTRL_C1_CSI_PAD_0x5d = 0x5d , CTRL_C1_CSI_PAD_0x5e = 0x5e ,
  CTRL_C1_CSI_SDP = 0x5f , CTRL_C1_CSI_PAD_0x60 = 0x60 , CTRL_C1_CSI_PAD_0x61 = 0x61 , CTRL_C1_CSI_PAD_0x62 = 0x62 ,
  CTRL_C1_CSI_ORN = 0x63 , CTRL_C1_CSI_PAD_0x64 = 0x64 , CTRL_C1_CSI_CFS = 0x65 , CTRL_C1_CSI_PAD_0x66 = 0x66 ,
  CTRL_C1_CSI_PAD_0x67 = 0x67 , CTRL_C1_CSI_PAD_0x68 = 0x68 , CTRL_C1_CSI_PAD_0x69 = 0x69 , CTRL_C1_CSI_PAD_0x6a = 0x6a ,
  CTRL_C1_CSI_PAD_0x6b = 0x6b , CTRL_C1_CSI_PAD_0x6c = 0x6c , CTRL_C1_CSI_PAD_0x6d = 0x6d , CTRL_C1_CSI_RCS = 0x6e
}
 
enum  CC_ControlCodes_TableJump_e { CC_CTRLCODE_SET_UNKNOWN = 0x00 , CC_CTRLCODE_SET_C0 = CTRL_C0_APB , CC_CTRLCODE_SET_C1 = CTRL_C1_BKF }
 
enum  CC_Color_CMLA_t {
  SET_CMLA0_BLACK , SET_CMLA1_FULL_INTENSITY_RED , SET_CMLA2_FULL_INTENSITY_GREEN , SET_CMLA3_FULL_INTENSITY_YELLOW ,
  SET_CMLA4_FULL_INTENSITY_BLUE , SET_CMLA5_FULL_INTENSITY_MAGNETA , SET_CMLA6_FULL_INTENSITY_CYAN , SET_CMLA7_FULL_INTENSITY_WHITE ,
  SET_CMLA8_TRANSPARENT , SET_CMLA9_HALF_INTENSITY_RED , SET_CMLA10_HALF_INTENSITY_GREEN , SET_CMLA11_HALF_INTENSITY_YELLOW ,
  SET_CMLA12_HALF_INTENSITY_BLUE , SET_CMLA13_HALF_INTENSITY_MAGNETA , SET_CMLA14_HALF_INTENSITY_CYAN , SET_CMLA15_HALF_INTENSITY_WHITE ,
  SET_CMLA_t_eMax
}
 

Functions

const char * caption_closed_controls_get_name (const uint8_t code)
 
bool csi_arg_Pn_load (CC_ControlCodes_CallbackData_t *d)
 
bool caption_closed_controls_is_table (const uint8_t *byte, enum CC_ControlCodes_TableJump_e *table)
 
bool caption_closed_controls_load (enum CC_ControlCodes_TableJump_e table, const uint8_t *argv, const uint16_t argc, uint16_t *pos, CaptionClosed_t *caption)
 
C0 command callbacks

All of them get the command data and return TRUE when the command was executed. They return FALSE for commands not supported in closed caption or with invalid parameters.

bool callback_controls_c0_APB (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c0_APF (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c0_APD (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c0_APU (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c0_CS (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c0_APR (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c0_LS1 (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c0_LS0 (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c0_PAPF (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c0_CAN (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c0_SS2 (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c0_ESC (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c0_APS (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c0_SS3 (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c0_RS (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c0_US (const CC_ControlCodes_CallbackData_t *d)
 
C1 command callbacks
bool callback_controls_c1_BKF (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_RDF (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_GRF (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_YLF (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_BLF (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_MGF (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_CNF (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_WHF (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_SSZ (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_MSZ (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_NSZ (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_SZX (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_COL (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_FLC (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_CDC (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_POL (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_WMM (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_MAC (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_HLC (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_RPC (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_SPL (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_STL (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_TIM (const CC_ControlCodes_CallbackData_t *d)
 
CSI subcommand callbacks

callback_controls_c1_CSI_load() handles the CSI (0x9b): finds the final byte, reads the parameters with csi_arg_Pn_load() and calls the subcommand callback. In the subcommands, CC_ControlCodes_CallbackData_t::data points to the parameters (struct csi_arg_Pn).

bool callback_controls_c1_CSI_load (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_CSI_swf (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_CSI_ssm (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_CSI_shs (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_CSI_svs (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_CSI_orn (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_CSI_cfs (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_CSI_rcs (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_CSI_sdf (const CC_ControlCodes_CallbackData_t *d)
 
bool callback_controls_c1_CSI_sdp (const CC_ControlCodes_CallbackData_t *d)
 

Detailed Description

C0, C1 and CSI control commands of the caption text.

Author
Jorge Pereira jpere.nosp@m.iran.nosp@m.@gmai.nosp@m.l.co.nosp@m.m
Date
Thu Aug 12 13:49:21 BRT 2010

The caption text mixes characters and control commands (ARIB STD-B24, Volume 1, 7.2; ABNT NBR 15606-1; ARIB TR-B14, 6.5):

  • C0 (0x08 to 0x1f): cursor position (APR, APS...), clear screen (CS), special characters (SS3) etc.;
  • C1 (0x80 to 0x9f): colors (BKF ~ WHF, COL), character size (SSZ, MSZ, NSZ, SZX) etc.;
  • CSI (0x9b): extended sequences, in the format CSI P1 ; P2 ; ... 0x20 F, where the parameters are decimal numbers in ASCII and the final byte F tells the command (SWF, SDF, SDP...).

Each command has a callback_controls_* callback, called by caption_closed_controls_load(). It reads the parameters, updates the CaptionClosed_t and moves the read position past the parameters. When the callback returns TRUE, the controls hook is called (see caption-hooking.h).

Commands that should not be used in closed caption (only in superimpose) return FALSE, but still skip their parameters, so they are not handled as text.

Example of caption text (TV Globo):

* 00000000  0c 9b 37 20 53 9b 31 37  36 3b 39 39 20 5f 9b 36 |..7.S.176;99._.6|
* 00000010  30 38 3b 33 39 30 20 56  9b 33 36 3b 33 36 20 57 |08;390.V.36;36.W|
* 00000020  9b 32 20 58 9b 31 36 20  59 9b 38 20 6e 88 1c 4c |.2.X.16.Y.8.n..L|
* 00000030  40 87 90 50 5b 4d 41 54  45 55 53 5d 20 4f 20 43 |@..P[MATEUS].O.C|
* 00000040  41 4c 49 58 54 4f 20 56  41 49 0d 52 45 53 4f 4c |ALIXTO.VAI.RESOL|
* 00000050  56 45 52 20 4f 20 50 52  4f 42 4c 45 4d 41 20 44 |VER.O.PROBLEMA.D|
* 00000060  4f 20 43 41 52 52 4f 2c  0d 4f 20 4d 41 49 53 20 |O.CARRO,.O.MAIS.|
* 00000070  52 c1 50 49 44 4f 20 50  4f 53 53 cd 56 45 4c 2e |R.PIDO.POSS.VEL.|
*
* 0c              CS: clear screen
* 9b 37 20 53     CSI SWF(7): 960x540 horizontal format
* 9b ... 20 5f    CSI SDP(176;99): position of the display area
* 9b ... 20 56    CSI SDF(608;390): size of the display area
* 9b ... 20 57    CSI SSM(36;36): character size
* 9b 32 20 58     CSI SHS(2): horizontal spacing
* 9b 31 36 20 59  CSI SVS(16): vertical spacing
* 9b 38 20 6e     CSI RCS(8): transparent raster color
* 88              SSZ: small characters
* 1c 4c 40        APS(12, 0): cursor at row 12, column 0
* 87              WHF: white text
* 90 50           COL: black background
* 0d              APR: new line
* c1, cd          'Á' and 'Í' in ISO-8859-15
* 

Definition in file caption-closed-controls.h.

Macro Definition Documentation

◆ DEBUG_CAPTION_CLOSED_CONTROLCODE

#define DEBUG_CAPTION_CLOSED_CONTROLCODE

Includes the CaptionClosedControls_t::code_name field in the command tables, used by caption_closed_controls_get_name() in the debug messages.

Definition at line 68 of file caption-closed-controls.h.

◆ CAPTION_CTRL_SET

#define CAPTION_CTRL_SET (   code,
  callback 
)    { code, callback, #code }

Builds an entry of the command tables.

Definition at line 101 of file caption-closed-controls.h.

◆ CTRL_C0_NULL

#define CTRL_C0_NULL   0x00

NUL: ignored.

Definition at line 122 of file caption-closed-controls.h.

◆ CTRL_C0_BELL

#define CTRL_C0_BELL   0x07

BEL: ignored in closed caption.

Definition at line 123 of file caption-closed-controls.h.

◆ CTRL_CSI_FB

#define CTRL_CSI_FB   0x20

Intermediate byte (0x20) that comes before the final byte of the CSI.

Definition at line 315 of file caption-closed-controls.h.

◆ CTRL_CSI_IB

#define CTRL_CSI_IB   0x3b

CSI parameter separator (';').

Definition at line 316 of file caption-closed-controls.h.

◆ CTRL_CSI_MAX_Pn_ARGS

#define CTRL_CSI_MAX_Pn_ARGS   5

Max number of parameters read from a CSI.

Definition at line 318 of file caption-closed-controls.h.

◆ CTRL_CSI_MAX_Pn_FIELDS

#define CTRL_CSI_MAX_Pn_FIELDS   (5+1)

Max digits of a parameter, plus the '\0' (up to "65535").

Definition at line 319 of file caption-closed-controls.h.

Typedef Documentation

◆ CaptionClosed_CtrlCode_t

typedef uint8_t CaptionClosed_CtrlCode_t

Code of a control command (C0, C1 or CSI).

Definition at line 71 of file caption-closed-controls.h.

Enumeration Type Documentation

◆ CaptionClosed_CtrlCodes_C0

C0 commands (ARIB TR-B14, Table 3.11; ARIB STD-B24, Table 7-14).

Unused values are filled with PAD, so the code minus 0x08 is the direct index into the callbacks table.

Enumerator
CTRL_C0_APB 

Active Position Backward: moves the cursor back.

CTRL_C0_APF 

Active Position Forward: moves the cursor forward.

CTRL_C0_APD 

Active Position Down: moves the cursor down.

CTRL_C0_APU 

Active Position Up: moves the cursor up.

CTRL_C0_CS 

Clear Screen: clears the screen.

CTRL_C0_APR 

Active Position Return: start of the next line.

CTRL_C0_LS1 

Locking Shift 1.

CTRL_C0_LS0 

Locking Shift 0.

CTRL_C0_PAD_0x01 

Unused (0x10).

CTRL_C0_PAD_0x02 

Unused (0x11).

CTRL_C0_PAD_0x03 

Unused (0x12).

CTRL_C0_PAD_0x04 

Unused (0x13).

CTRL_C0_PAD_0x05 

Unused (0x14).

CTRL_C0_PAD_0x06 

Unused (0x15).

CTRL_C0_PAPF 

Parameterized Active Position Forward: moves P1 positions forward.

CTRL_C0_PAD_0x17 

Unused.

CTRL_C0_CAN 

Cancel.

CTRL_C0_SS2 

Single Shift 2: the next character comes from the G2 set.

CTRL_C0_PAD_0x1a 

Unused.

CTRL_C0_ESC 

Escape: designation of character sets (ISO/IEC 2022).

CTRL_C0_APS 

Active Position Set: puts the cursor at P1 (row) and P2 (column).

CTRL_C0_SS3 

Single Shift 3: the next character comes from the G3 set (e.g. ♪).

CTRL_C0_RS 

Record Separator.

CTRL_C0_US 

Unit Separator.

Definition at line 121 of file caption-closed-controls.h.

◆ CaptionClosed_CtrlCodes_C1

C1 commands (ARIB TR-B14, Table 3.11; ARIB STD-B24, Table 7-15).

Unused values are filled with PAD, so the code minus 0x80 is the direct index into the callbacks table.

Enumerator
CTRL_C1_BKF 

Black Foreground: black text.

CTRL_C1_RDF 

Red Foreground: red text.

CTRL_C1_GRF 

Green Foreground: green text.

CTRL_C1_YLF 

Yellow Foreground: yellow text.

CTRL_C1_BLF 

Blue Foreground: blue text.

CTRL_C1_MGF 

Magenta Foreground: magenta text.

CTRL_C1_CNF 

Cyan Foreground: cyan text.

CTRL_C1_WHF 

White Foreground: white text.

CTRL_C1_SSZ 

Small Size: small characters.

CTRL_C1_MSZ 

Middle Size: medium characters.

CTRL_C1_NSZ 

Normal Size: normal characters.

CTRL_C1_SZX 

Character Size Controls: size given by P1.

CTRL_C1_PAD_0x8c 

Unused.

CTRL_C1_PAD_0x8d 

Unused.

CTRL_C1_PAD_0x8e 

Unused.

CTRL_C1_PAD_0x8f 

Unused.

CTRL_C1_COL 

Colour Controls: text/background color (P1, or 0x20 P2 for the palette).

CTRL_C1_FLC 

Flashing Control: blinking.

CTRL_C1_CDC 

Conceal Display Controls.

CTRL_C1_POL 

Pattern Polarity Controls.

CTRL_C1_WMM 

Writing Mode Modification.

CTRL_C1_MAC 

Macro Command.

CTRL_C1_PAD_0x96 

Unused.

CTRL_C1_HLC 

Highlighting Character Block: outline.

CTRL_C1_RPC 

Repeat Character: repeats the next character.

CTRL_C1_SPL 

Stop Lining: end of underline.

CTRL_C1_STL 

Start Lining: start of underline.

CTRL_C1_CSI 

Control Sequence Introducer: extended sequence, see CaptionClosed_CtrlCodes_C1_CSI.

CTRL_C1_PAD_0x9c 

Unused.

CTRL_C1_TIM 

Time Controls: wait/timing.

CTRL_C1_PAD_0x9e 

Unused.

CTRL_C1_PAD_0x9f 

Unused.

Definition at line 184 of file caption-closed-controls.h.

◆ CaptionClosed_CtrlCodes_C1_CSI

CSI subcommands: the final byte F of the sequence CSI P1 ; P2 ; ... 0x20 F (ARIB STD-B24, Table 7-17).

Unused values are filled with PAD, so the code minus 0x53 is the direct index into the callbacks table.

Enumerator
CTRL_C1_CSI_SWF 

Set Writing Format: display format.

CTRL_C1_CSI_PAD_0x54 

Unused.

CTRL_C1_CSI_PAD_0x55 

Unused.

CTRL_C1_CSI_SDF 

Set Display Format: size of the display area.

CTRL_C1_CSI_SSM 

Character Composition Dot Designation: character size.

CTRL_C1_CSI_SHS 

Set Horizontal Spacing: horizontal spacing.

CTRL_C1_CSI_SVS 

Set Vertical Spacing: vertical spacing.

CTRL_C1_CSI_PAD_0x5a 

Unused.

CTRL_C1_CSI_PAD_0x5b 

Unused.

CTRL_C1_CSI_PAD_0x5c 

Unused.

CTRL_C1_CSI_PAD_0x5d 

Unused.

CTRL_C1_CSI_PAD_0x5e 

Unused.

CTRL_C1_CSI_SDP 

Set Display Position: position of the display area.

CTRL_C1_CSI_PAD_0x60 

Unused.

CTRL_C1_CSI_PAD_0x61 

Unused.

CTRL_C1_CSI_PAD_0x62 

Unused.

CTRL_C1_CSI_ORN 

Ornament Control: outline/shadow of the characters.

CTRL_C1_CSI_PAD_0x64 

Unused.

CTRL_C1_CSI_CFS 

Character Font Set: font.

CTRL_C1_CSI_PAD_0x66 

Unused.

CTRL_C1_CSI_PAD_0x67 

Unused.

CTRL_C1_CSI_PAD_0x68 

Unused.

CTRL_C1_CSI_PAD_0x69 

Unused.

CTRL_C1_CSI_PAD_0x6a 

Unused.

CTRL_C1_CSI_PAD_0x6b 

Unused.

CTRL_C1_CSI_PAD_0x6c 

Unused.

CTRL_C1_CSI_PAD_0x6d 

Unused.

CTRL_C1_CSI_RCS 

Raster Colour Command: raster color.

Definition at line 262 of file caption-closed-controls.h.

◆ CC_ControlCodes_TableJump_e

Start of each command table: the code minus this value is the index in the callbacks table.

Enumerator
CC_CTRLCODE_SET_UNKNOWN 

Not a command.

CC_CTRLCODE_SET_C0 

C0 table (0x08 to 0x1f).

CC_CTRLCODE_SET_C1 

C1 table (0x80 to 0x9f).

Definition at line 346 of file caption-closed-controls.h.

◆ CC_Color_CMLA_t

Colors of the CMLA palette (Colour Map Lower Address), used by the color commands (BKF ~ WHF and COL).

Enumerator
SET_CMLA0_BLACK 

Black.

SET_CMLA1_FULL_INTENSITY_RED 

Red.

SET_CMLA2_FULL_INTENSITY_GREEN 

Green.

SET_CMLA3_FULL_INTENSITY_YELLOW 

Yellow.

SET_CMLA4_FULL_INTENSITY_BLUE 

Blue.

SET_CMLA5_FULL_INTENSITY_MAGNETA 

Magenta.

SET_CMLA6_FULL_INTENSITY_CYAN 

Cyan.

SET_CMLA7_FULL_INTENSITY_WHITE 

White.

SET_CMLA8_TRANSPARENT 

Transparent.

SET_CMLA9_HALF_INTENSITY_RED 

Red, half intensity.

SET_CMLA10_HALF_INTENSITY_GREEN 

Green, half intensity.

SET_CMLA11_HALF_INTENSITY_YELLOW 

Yellow, half intensity.

SET_CMLA12_HALF_INTENSITY_BLUE 

Blue, half intensity.

SET_CMLA13_HALF_INTENSITY_MAGNETA 

Magenta, half intensity.

SET_CMLA14_HALF_INTENSITY_CYAN 

Cyan, half intensity.

SET_CMLA15_HALF_INTENSITY_WHITE 

White, half intensity.

SET_CMLA_t_eMax 

Number of colors.

Definition at line 386 of file caption-closed-controls.h.

Function Documentation

◆ caption_closed_controls_get_name()

const char * caption_closed_controls_get_name ( const uint8_t  code)

Name of a command, for debug messages.

Parameters
codeC0, C1 or CSI subcommand code.
Returns
The name (e.g. "CTRL_C0_APS"), or "UNKNOWN".

◆ callback_controls_c0_APB()

bool callback_controls_c0_APB ( const CC_ControlCodes_CallbackData_t *  d)

APB: not supported in closed caption.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c0_APF()

bool callback_controls_c0_APF ( const CC_ControlCodes_CallbackData_t *  d)

APF: accepted, no effect on the state.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c0_APD()

bool callback_controls_c0_APD ( const CC_ControlCodes_CallbackData_t *  d)

APD: not supported in closed caption.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c0_APU()

bool callback_controls_c0_APU ( const CC_ControlCodes_CallbackData_t *  d)

APU: not supported in closed caption.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c0_CS()

bool callback_controls_c0_CS ( const CC_ControlCodes_CallbackData_t *  d)

CS: sets CaptionClosed_t::need_clear.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c0_APR()

bool callback_controls_c0_APR ( const CC_ControlCodes_CallbackData_t *  d)

APR: accepted; the controls hook gets the line break.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c0_LS1()

bool callback_controls_c0_LS1 ( const CC_ControlCodes_CallbackData_t *  d)

LS1: not supported in closed caption.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c0_LS0()

bool callback_controls_c0_LS0 ( const CC_ControlCodes_CallbackData_t *  d)

LS0: not supported in closed caption.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c0_PAPF()

bool callback_controls_c0_PAPF ( const CC_ControlCodes_CallbackData_t *  d)

PAPF: not supported; skips 1 parameter.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c0_CAN()

bool callback_controls_c0_CAN ( const CC_ControlCodes_CallbackData_t *  d)

CAN: not supported in closed caption.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c0_SS2()

bool callback_controls_c0_SS2 ( const CC_ControlCodes_CallbackData_t *  d)

SS2: not supported; skips 1 parameter.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c0_ESC()

bool callback_controls_c0_ESC ( const CC_ControlCodes_CallbackData_t *  d)

ESC: not supported; skips the whole sequence.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c0_APS()

bool callback_controls_c0_APS ( const CC_ControlCodes_CallbackData_t *  d)

APS: updates CaptionClosed_t::APS (2 parameters).

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c0_SS3()

bool callback_controls_c0_SS3 ( const CC_ControlCodes_CallbackData_t *  d)

SS3: hands the G3 character in UTF-8 to the text hook.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c0_RS()

bool callback_controls_c0_RS ( const CC_ControlCodes_CallbackData_t *  d)

RS: not supported in closed caption.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c0_US()

bool callback_controls_c0_US ( const CC_ControlCodes_CallbackData_t *  d)

US: accepted, no effect on the state.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_BKF()

bool callback_controls_c1_BKF ( const CC_ControlCodes_CallbackData_t *  d)

BKF: black text.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_RDF()

bool callback_controls_c1_RDF ( const CC_ControlCodes_CallbackData_t *  d)

RDF: red text.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_GRF()

bool callback_controls_c1_GRF ( const CC_ControlCodes_CallbackData_t *  d)

GRF: green text.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_YLF()

bool callback_controls_c1_YLF ( const CC_ControlCodes_CallbackData_t *  d)

YLF: yellow text.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_BLF()

bool callback_controls_c1_BLF ( const CC_ControlCodes_CallbackData_t *  d)

BLF: blue text.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_MGF()

bool callback_controls_c1_MGF ( const CC_ControlCodes_CallbackData_t *  d)

MGF: magenta text.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_CNF()

bool callback_controls_c1_CNF ( const CC_ControlCodes_CallbackData_t *  d)

CNF: cyan text.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_WHF()

bool callback_controls_c1_WHF ( const CC_ControlCodes_CallbackData_t *  d)

WHF: white text.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_SSZ()

bool callback_controls_c1_SSZ ( const CC_ControlCodes_CallbackData_t *  d)

SSZ: small characters.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_MSZ()

bool callback_controls_c1_MSZ ( const CC_ControlCodes_CallbackData_t *  d)

MSZ: medium characters.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_NSZ()

bool callback_controls_c1_NSZ ( const CC_ControlCodes_CallbackData_t *  d)

NSZ: normal characters.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_SZX()

bool callback_controls_c1_SZX ( const CC_ControlCodes_CallbackData_t *  d)

SZX: stores P1 in CaptionClosed_t::char_size_custom.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_COL()

bool callback_controls_c1_COL ( const CC_ControlCodes_CallbackData_t *  d)

COL: text, background or half intensity color.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_FLC()

bool callback_controls_c1_FLC ( const CC_ControlCodes_CallbackData_t *  d)

FLC: not supported; skips 1 parameter.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_CDC()

bool callback_controls_c1_CDC ( const CC_ControlCodes_CallbackData_t *  d)

CDC: not supported; skips 1 or 2 parameters.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_POL()

bool callback_controls_c1_POL ( const CC_ControlCodes_CallbackData_t *  d)

POL: not supported; skips 1 parameter.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_WMM()

bool callback_controls_c1_WMM ( const CC_ControlCodes_CallbackData_t *  d)

WMM: not supported; skips 1 parameter.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_MAC()

bool callback_controls_c1_MAC ( const CC_ControlCodes_CallbackData_t *  d)

MAC: not supported; skips 1 parameter.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_HLC()

bool callback_controls_c1_HLC ( const CC_ControlCodes_CallbackData_t *  d)

HLC: not supported; skips 1 parameter.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_RPC()

bool callback_controls_c1_RPC ( const CC_ControlCodes_CallbackData_t *  d)

RPC: not supported; skips 1 parameter.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_SPL()

bool callback_controls_c1_SPL ( const CC_ControlCodes_CallbackData_t *  d)

SPL: not supported in closed caption.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_STL()

bool callback_controls_c1_STL ( const CC_ControlCodes_CallbackData_t *  d)

STL: not supported in closed caption.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_TIM()

bool callback_controls_c1_TIM ( const CC_ControlCodes_CallbackData_t *  d)

TIME: not supported; skips 2 parameters.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_CSI_load()

bool callback_controls_c1_CSI_load ( const CC_ControlCodes_CallbackData_t *  d)

CSI: reads the sequence and dispatches the subcommand.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_CSI_swf()

bool callback_controls_c1_CSI_swf ( const CC_ControlCodes_CallbackData_t *  d)

SWF: format, characters per line and lines.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_CSI_ssm()

bool callback_controls_c1_CSI_ssm ( const CC_ControlCodes_CallbackData_t *  d)

SSM: character size (P1 x P2).

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_CSI_shs()

bool callback_controls_c1_CSI_shs ( const CC_ControlCodes_CallbackData_t *  d)

SHS: horizontal spacing (P1).

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_CSI_svs()

bool callback_controls_c1_CSI_svs ( const CC_ControlCodes_CallbackData_t *  d)

SVS: vertical spacing (P1).

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_CSI_orn()

bool callback_controls_c1_CSI_orn ( const CC_ControlCodes_CallbackData_t *  d)

ORN: not implemented.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_CSI_cfs()

bool callback_controls_c1_CSI_cfs ( const CC_ControlCodes_CallbackData_t *  d)

CFS: not implemented.

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_CSI_rcs()

bool callback_controls_c1_CSI_rcs ( const CC_ControlCodes_CallbackData_t *  d)

RCS: raster color (P1, from 0 to 15).

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_CSI_sdf()

bool callback_controls_c1_CSI_sdf ( const CC_ControlCodes_CallbackData_t *  d)

SDF: size of the display area (P1 x P2).

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ callback_controls_c1_CSI_sdp()

bool callback_controls_c1_CSI_sdp ( const CC_ControlCodes_CallbackData_t *  d)

SDP: position of the display area (P1, P2).

Parameters
dCommand data (see CC_ControlCodes_CallbackData_t).
Returns
TRUE if the command was executed.

◆ csi_arg_Pn_load()

bool csi_arg_Pn_load ( CC_ControlCodes_CallbackData_t *  d)

Reads the decimal parameters of a CSI sequence, separated by ';'.

Parameters
dd->argv points to the first parameter, d->argc is the number of parameter bytes and d->data points to the csi_arg_Pn struct that receives the values.
Returns
TRUE if at least one parameter was read.

◆ caption_closed_controls_is_table()

bool caption_closed_controls_is_table ( const uint8_t *  byte,
enum CC_ControlCodes_TableJump_e *  table 
)

Checks if a byte is a C0 or C1 command.

Parameters
byteCaption text byte.
tableReceives the command table, or CC_CTRLCODE_SET_UNKNOWN.
Returns
TRUE if the byte is a command.

◆ caption_closed_controls_load()

bool caption_closed_controls_load ( enum CC_ControlCodes_TableJump_e  table,
const uint8_t *  argv,
const uint16_t  argc,
uint16_t *  pos,
CaptionClosed_t *  caption 
)

Runs the C0/C1 command at argv[*pos].

Calls the command callback, which moves pos past the parameters, and, if it returns TRUE, calls the controls hook.

Parameters
tableCommand table, got from caption_closed_controls_is_table().
argvCaption text buffer.
argcNumber of bytes available from pos.
posPosition of the command in argv; on return, it points to the last byte consumed by the command.
captionCaption state.
Returns
TRUE if the command was executed.