[CEA-708] Added BS command

This commit is contained in:
Evgeny 2017-01-14 19:30:03 +03:00
parent 41cd5f00bc
commit e048c65cdb

View File

@ -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;