From e048c65cdbc034f3dd631752ac51165927976b12 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Sat, 14 Jan 2017 19:30:03 +0300 Subject: [PATCH] [CEA-708] Added BS command --- src/lib_ccx/ccx_decoders_708.c | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/lib_ccx/ccx_decoders_708.c b/src/lib_ccx/ccx_decoders_708.c index e78576fc..278be874 100644 --- a/src/lib_ccx/ccx_decoders_708.c +++ b/src/lib_ccx/ccx_decoders_708.c @@ -554,6 +554,44 @@ void _dtvcc_process_etx(ccx_dtvcc_service_decoder *decoder) //it can help decoders with screen output, but could it help us? } +void _dtvcc_process_bs(ccx_dtvcc_service_decoder *decoder) +{ + if (decoder->current_window == -1) + { + ccx_common_logging.log_ftn("[CEA-708] _dtvcc_process_bs: Window has to be defined first\n"); + return; + } + + //it looks strange, but in some videos (rarely) we have a backspace command + //we just print one character over another + int cw = decoder->current_window; + ccx_dtvcc_window *window = &decoder->windows[cw]; + + switch (window->attribs.print_direction) + { + case CCX_DTVCC_WINDOW_PD_RIGHT_LEFT: + if (window->pen_column + 1 < window->col_count) + window->pen_column++; + break; + case CCX_DTVCC_WINDOW_PD_LEFT_RIGHT: + if (decoder->windows->pen_column > 0) + window->pen_column--; + break; + case CCX_DTVCC_WINDOW_PD_BOTTOM_TOP: + if (window->pen_row + 1 < window->row_count) + window->pen_row++; + break; + case CCX_DTVCC_WINDOW_PD_TOP_BOTTOM: + if (window->pen_row > 0) + window->pen_row--; + break; + default: + ccx_common_logging.log_ftn("[CEA-708] _dtvcc_process_character: unhandled branch (%02d)\n", + window->attribs.print_direction); + break; + } +} + void _dtvcc_window_rollup(ccx_dtvcc_service_decoder *decoder, ccx_dtvcc_window *window) { for (int i = 0; i < window->row_count - 1; i++) @@ -1295,6 +1333,9 @@ int _dtvcc_handle_C0(ccx_dtvcc_ctx *dtvcc, case CCX_DTVCC_C0_ETX: _dtvcc_process_etx(decoder); break; + case CCX_DTVCC_C0_BS: + _dtvcc_process_bs(decoder); + break; default: ccx_common_logging.log_ftn("[CEA-708] _dtvcc_handle_C0: unhandled branch\n"); break;