Refactored CEA-708 symbol struct

This commit is contained in:
Evgeny 2017-01-13 15:46:41 +03:00
parent 3b2545cf82
commit bff384e677
2 changed files with 6 additions and 9 deletions

View File

@ -1246,7 +1246,7 @@ int _dtvcc_handle_G0(ccx_dtvcc_service_decoder *decoder, unsigned char *data, in
ccx_common_logging.debug_ftn(CCX_DMT_708, "[CEA-708] G0: [%02X] (%c)\n", c, c);
ccx_dtvcc_symbol sym;
if (c == 0x7F) { // musical note replaces the Delete command code in ASCII
sym.sym = CCX_DTVCC_MUSICAL_NOTE_CHAR;
CCX_DTVCC_SYM_SET(sym, CCX_DTVCC_MUSICAL_NOTE_CHAR);
} else {
unsigned char uc = dtvcc_get_internal_from_G0(c);
CCX_DTVCC_SYM_SET(sym, uc);

View File

@ -250,17 +250,14 @@ typedef struct ccx_dtvcc_window_attribs
typedef struct ccx_dtvcc_symbol
{
unsigned short sym; //symbol itself, at least 16 bit
unsigned char len; //length. could be 1 or 2
unsigned char init; //initialized or not. could be 0 or 1
} ccx_dtvcc_symbol;
#define CCX_DTVCC_SYM_SET(x, c) {x.len = 1; x.sym = c;}
#define CCX_DTVCC_SYM_SET_16(x, c1, c2) {x.len = 2; x.sym = (c1 << 8) | c2;}
#define CCX_DTVCC_SYM_IS_16(x) (x.len == 2)
#define CCX_DTVCC_SYM_SET(x, c) {x.init = 1; x.sym = c;}
#define CCX_DTVCC_SYM_SET_16(x, c1, c2) {x.init = 1; x.sym = (c1 << 8) | c2;}
#define CCX_DTVCC_SYM(x) ((unsigned char)(x.sym))
#define CCX_DTVCC_SYM_16_FIRST(x) ((unsigned char)(x.sym >> 8))
#define CCX_DTVCC_SYM_16_SECOND(x) ((unsigned char)(x.sym & 0xff))
#define CCX_DTVCC_SYM_IS_EMPTY(x) (x.len == 0)
#define CCX_DTVCC_SYM_IS_SET(x) (x.len > 0)
#define CCX_DTVCC_SYM_IS_EMPTY(x) (x.init == 0)
#define CCX_DTVCC_SYM_IS_SET(x) (x.init == 1)
typedef struct ccx_dtvcc_window
{