MythTV  master
Macros | Typedefs | Enumerations | Functions | Variables
cc708decoder.cpp File Reference
#include <cstdio>
#include <cstdlib>
#include "mythlogging.h"
#include "captions/cc708reader.h"
#include "captions/cc708decoder.h"
Include dependency graph for cc708decoder.cpp:

Go to the source code of this file.

Macros

#define LOC   QString("CC708: ")
 
#define DEBUG_CAPTIONS   0
 
#define DEBUG_CC_SERVICE   0
 
#define DEBUG_CC_SERVICE_2   0
 
#define DEBUG_CC_RAWPACKET   0
 
#define DEBUG_CC_VALIDPACKET   0
 
#define DEBUG_CC_DECODE   0
 
#define DEBUG_CC_PARSE   0
 
#define SEND_STR
 

Typedefs

using cc_table = std::array< const uint16_t, 0x60 >
 

Enumerations

enum  kCCTypes { NTSC_CC_f1 = 0, NTSC_CC_f2 = 1, DTVCC_PACKET_DATA = 2, DTVCC_PACKET_START = 3 }
 
enum  C0 {
  NUL = 0x00, ETX = 0x03, BS = 0x08, FF = 0x0C,
  CR = 0x0D, HCR = 0x0E, EXT1 = 0x10, P16 = 0x18
}
 
enum  C1 {
  CW0 =0x80, CW1, CW2, CW3,
  CW4, CW5, CW6, CW7,
  CLW, DSW, HDW, TGW,
  DLW, DLY, DLC, RST,
  SPA =0x90, SPC, SPL, SWA =0x97,
  DF0, DF1, DF2, DF3,
  DF4, DF5, DF6, DF7
}
 

Functions

static void parse_cc_packet (CC708Reader *cb_cbs, CaptionPacket *pkt, time_t last_seen[64])
 
static void append_character (CC708Reader *cc, uint service_num, short ch)
 
static void parse_cc_service_stream (CC708Reader *cc, uint service_num)
 
static int handle_cc_c0_ext1_p16 (CC708Reader *cc, uint service_num, int i)
 
static int handle_cc_c1 (CC708Reader *cc, uint service_num, int i)
 
static int handle_cc_c2 (CC708Reader *cc, uint service_num, int i)
 
static int handle_cc_c3 (CC708Reader *cc, uint service_num, int i)
 
static bool rightsize_buf (CC708Reader *cc, uint service_num, uint block_size)
 
static void append_cc (CC708Reader *cc, uint service_num, const unsigned char *blk_buf, int block_size)
 

Variables

const std::array< const std::string, 4 > cc_types
 
const cc_table CCtableG0
 
const cc_table CCtableG1
 
const cc_table CCtableG2
 
const cc_table CCtableG3
 

Macro Definition Documentation

◆ LOC

#define LOC   QString("CC708: ")

Definition at line 12 of file cc708decoder.cpp.

◆ DEBUG_CAPTIONS

#define DEBUG_CAPTIONS   0

Definition at line 14 of file cc708decoder.cpp.

◆ DEBUG_CC_SERVICE

#define DEBUG_CC_SERVICE   0

Definition at line 15 of file cc708decoder.cpp.

◆ DEBUG_CC_SERVICE_2

#define DEBUG_CC_SERVICE_2   0

Definition at line 16 of file cc708decoder.cpp.

◆ DEBUG_CC_RAWPACKET

#define DEBUG_CC_RAWPACKET   0

Definition at line 17 of file cc708decoder.cpp.

◆ DEBUG_CC_VALIDPACKET

#define DEBUG_CC_VALIDPACKET   0

Definition at line 18 of file cc708decoder.cpp.

◆ DEBUG_CC_DECODE

#define DEBUG_CC_DECODE   0

Definition at line 19 of file cc708decoder.cpp.

◆ DEBUG_CC_PARSE

#define DEBUG_CC_PARSE   0

Definition at line 20 of file cc708decoder.cpp.

◆ SEND_STR

#define SEND_STR
Value:
do { \
if (cc->m_tempStrSize[service_num]) \
{ \
cc->TextWrite(service_num, \
cc->m_tempStr[service_num], \
cc->m_tempStrSize[service_num]); \
cc->m_tempStrSize[service_num] = 0; \
} \
} while (false)

Definition at line 120 of file cc708decoder.cpp.

Typedef Documentation

◆ cc_table

using cc_table = std::array<const uint16_t, 0x60>

Definition at line 106 of file cc708decoder.cpp.

Enumeration Type Documentation

◆ kCCTypes

enum kCCTypes
Enumerator
NTSC_CC_f1 
NTSC_CC_f2 
DTVCC_PACKET_DATA 
DTVCC_PACKET_START 

Definition at line 21 of file cc708decoder.cpp.

◆ C0

enum C0
Enumerator
NUL 
ETX 
BS 
FF 
CR 
HCR 
EXT1 
P16 

Definition at line 86 of file cc708decoder.cpp.

◆ C1

enum C1
Enumerator
CW0 
CW1 
CW2 
CW3 
CW4 
CW5 
CW6 
CW7 
CLW 
DSW 
HDW 
TGW 
DLW 
DLY 
DLC 
RST 
SPA 
SPC 
SPL 
SWA 
DF0 
DF1 
DF2 
DF3 
DF4 
DF5 
DF6 
DF7 

Definition at line 98 of file cc708decoder.cpp.

Function Documentation

◆ parse_cc_packet()

static void parse_cc_packet ( CC708Reader cb_cbs,
CaptionPacket pkt,
time_t  last_seen[64] 
)
static

Definition at line 622 of file cc708decoder.cpp.

Referenced by CC708Decoder::decode_cc_data(), and CC708Decoder::decode_cc_null().

◆ append_character()

static void append_character ( CC708Reader cc,
uint  service_num,
short  ch 
)
static

Definition at line 707 of file cc708decoder.cpp.

Referenced by handle_cc_c0_ext1_p16(), and parse_cc_service_stream().

◆ parse_cc_service_stream()

static void parse_cc_service_stream ( CC708Reader cc,
uint  service_num 
)
static

Definition at line 130 of file cc708decoder.cpp.

Referenced by append_cc().

◆ handle_cc_c0_ext1_p16()

static int handle_cc_c0_ext1_p16 ( CC708Reader cc,
uint  service_num,
int  i 
)
static

Definition at line 306 of file cc708decoder.cpp.

Referenced by parse_cc_service_stream().

◆ handle_cc_c1()

static int handle_cc_c1 ( CC708Reader cc,
uint  service_num,
int  i 
)
static

Definition at line 370 of file cc708decoder.cpp.

Referenced by parse_cc_service_stream().

◆ handle_cc_c2()

static int handle_cc_c2 ( CC708Reader cc,
uint  service_num,
int  i 
)
static

Definition at line 506 of file cc708decoder.cpp.

Referenced by handle_cc_c0_ext1_p16().

◆ handle_cc_c3()

static int handle_cc_c3 ( CC708Reader cc,
uint  service_num,
int  i 
)
static

Definition at line 533 of file cc708decoder.cpp.

Referenced by handle_cc_c0_ext1_p16().

◆ rightsize_buf()

static bool rightsize_buf ( CC708Reader cc,
uint  service_num,
uint  block_size 
)
static

Definition at line 561 of file cc708decoder.cpp.

Referenced by append_cc().

◆ append_cc()

static void append_cc ( CC708Reader cc,
uint  service_num,
const unsigned char *  blk_buf,
int  block_size 
)
static

Definition at line 597 of file cc708decoder.cpp.

Referenced by parse_cc_packet().

Variable Documentation

◆ cc_types

const std::array<const std::string, 4> cc_types
Initial value:
=
{
"NTSC line 21 field 1 closed captions"
"NTSC line 21 field 2 closed captions"
"DTVCC Channel Packet Data"
"DTVCC Channel Packet Start"
}

Definition at line 29 of file cc708decoder.cpp.

◆ CCtableG0

const cc_table CCtableG0
Initial value:
=
{
' ', '!','\"', '#', '$', '%', '&', '\'',
'(', ')', '*', '+', ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', ':', ';', '<', '=', '>', '?',
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', '[', '\\',']', '^', '_',
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
'x', 'y', 'z', '{', '|', '}', '~', 0x266a,
}

Definition at line 733 of file cc708decoder.cpp.

Referenced by parse_cc_service_stream().

◆ CCtableG1

const cc_table CCtableG1

Definition at line 753 of file cc708decoder.cpp.

Referenced by parse_cc_service_stream().

◆ CCtableG2

const cc_table CCtableG2

Definition at line 788 of file cc708decoder.cpp.

Referenced by handle_cc_c0_ext1_p16().

◆ CCtableG3

const cc_table CCtableG3
Initial value:
=
{
'#',
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
}

Definition at line 837 of file cc708decoder.cpp.

Referenced by handle_cc_c0_ext1_p16().

cc
Definition: cc.h:10