|
@@ -403,57 +403,3 @@ size_t caption_frame_to_text(caption_frame_t* frame, utf8_char_t* data)
|
|
|
|
|
|
return size;
|
|
|
}
|
|
|
-////////////////////////////////////////////////////////////////////////////////
|
|
|
-size_t caption_frame_dump_buffer(caption_frame_t* frame, utf8_char_t* buf)
|
|
|
-{
|
|
|
- int r, c;
|
|
|
- size_t bytes, total = 0;
|
|
|
- bytes = sprintf(buf, " timestamp: %f\n row: %02d col: %02d roll-up: %d\n",
|
|
|
- frame->timestamp, frame->state.row, frame->state.col, caption_frame_rollup(frame));
|
|
|
- total += bytes, buf += bytes;
|
|
|
- bytes = sprintf(buf, " 00000000001111111111222222222233\t 00000000001111111111222222222233\n"
|
|
|
- " 01234567890123456789012345678901\t 01234567890123456789012345678901\n"
|
|
|
- " %s--------------------------------%s\t %s--------------------------------%s\n",
|
|
|
- EIA608_CHAR_BOX_DRAWINGS_LIGHT_DOWN_AND_RIGHT, EIA608_CHAR_BOX_DRAWINGS_LIGHT_DOWN_AND_LEFT,
|
|
|
- EIA608_CHAR_BOX_DRAWINGS_LIGHT_DOWN_AND_RIGHT, EIA608_CHAR_BOX_DRAWINGS_LIGHT_DOWN_AND_LEFT);
|
|
|
- total += bytes;
|
|
|
- buf += bytes;
|
|
|
-
|
|
|
- for (r = 0; r < SCREEN_ROWS; ++r) {
|
|
|
- bytes = sprintf(buf, "%02d%s", r, EIA608_CHAR_VERTICAL_LINE);
|
|
|
- total += bytes, buf += bytes;
|
|
|
-
|
|
|
- // front buffer
|
|
|
- for (c = 0; c < SCREEN_COLS; ++c) {
|
|
|
- caption_frame_cell_t* cell = frame_buffer_cell(&frame->front, r, c);
|
|
|
- bytes = utf8_char_copy(buf, (!cell || 0 == cell->data[0]) ? EIA608_CHAR_SPACE : &cell->data[0]);
|
|
|
- total += bytes, buf += bytes;
|
|
|
- }
|
|
|
-
|
|
|
- bytes = sprintf(buf, "%s\t%02d%s", EIA608_CHAR_VERTICAL_LINE, r, EIA608_CHAR_VERTICAL_LINE);
|
|
|
- total += bytes, buf += bytes;
|
|
|
-
|
|
|
- // back buffer
|
|
|
- for (c = 0; c < SCREEN_COLS; ++c) {
|
|
|
- caption_frame_cell_t* cell = frame_buffer_cell(&frame->back, r, c);
|
|
|
- bytes = utf8_char_copy(buf, (!cell || 0 == cell->data[0]) ? EIA608_CHAR_SPACE : &cell->data[0]);
|
|
|
- total += bytes, buf += bytes;
|
|
|
- }
|
|
|
-
|
|
|
- bytes = sprintf(buf, "%s\n", EIA608_CHAR_VERTICAL_LINE);
|
|
|
- total += bytes, buf += bytes;
|
|
|
- }
|
|
|
-
|
|
|
- bytes = sprintf(buf, " %s--------------------------------%s\t %s--------------------------------%s\n",
|
|
|
- EIA608_CHAR_BOX_DRAWINGS_LIGHT_UP_AND_RIGHT, EIA608_CHAR_BOX_DRAWINGS_LIGHT_UP_AND_LEFT,
|
|
|
- EIA608_CHAR_BOX_DRAWINGS_LIGHT_UP_AND_RIGHT, EIA608_CHAR_BOX_DRAWINGS_LIGHT_UP_AND_LEFT);
|
|
|
- total += bytes, buf += bytes;
|
|
|
- return total;
|
|
|
-}
|
|
|
-
|
|
|
-void caption_frame_dump(caption_frame_t* frame)
|
|
|
-{
|
|
|
- utf8_char_t buff[CAPTION_FRAME_DUMP_BUF_SIZE];
|
|
|
- caption_frame_dump_buffer(frame, buff);
|
|
|
- fprintf(stderr, "%s\n", buff);
|
|
|
-}
|