static void cc_handler (vbi_event * ev, void * user_data) { vbi_page page; vbi_bool success; int row; user_data = user_data; if (pgno != -1 && ev->ev.caption.pgno != pgno) return; /* Fetching & rendering in the handler is a bad idea, but this is only a test */ success = vbi_fetch_cc_page (vbi, &page, ev->ev.caption.pgno, TRUE); assert (success); #if 1 /* optional */ if (abs (page.dirty.roll) > page.rows) { clear (&page); } else if (page.dirty.roll == -1) { roll_up (&page, page.dirty.y0, page.dirty.y1); } else { #endif for (row = page.dirty.y0; row <= page.dirty.y1; ++row) render (&page, row); } vbi_unref_page (&page); }
static void reset (void) { vbi_page page; vbi_bool success; int row; success = vbi_fetch_cc_page (vbi, &page, pgno, TRUE); assert (success); for (row = 0; row <= page.rows; ++row) render (&page, row); vbi_unref_page (&page); }
void VBIDecoder::eventHandler(vbi_event* event) { vbi_page page; switch (event->type) { case VBI_EVENT_CLOSE: fprintf(fplog, "vbi_event: type=CLOSE\n"); break; case VBI_EVENT_TTX_PAGE: // UNTESTED! fprintf(fplog, "vbi_event: type=TTX_PAGE pgno=%d subno=%d\n", event->ev.ttx_page.pgno, event->ev.ttx_page.subno); if (event->ev.ttx_page.pgno != pageno) { break; } if (!vbi_fetch_vt_page(decoder, &page, event->ev.ttx_page.pgno, event->ev.ttx_page.subno, VBI_WST_LEVEL_3p5, 25, TRUE)) break; if (checkPageSize) setTeletext(&page); checkPage(&page); vbi_unref_page(&page); break; case VBI_EVENT_CAPTION: if (event->ev.caption.pgno != pageno) { if (verbose) fprintf(fplog, "vbi_event: type=CAPTION pgno=%d curr=%.4f ignored\n", event->ev.caption.pgno, (double)currTimestamp); break; } if (!vbi_fetch_cc_page(decoder, &page, event->ev.caption.pgno, TRUE)) break; if (verbose) { fprintf(fplog, "vbi_event: type=CAPTION pgno=%d curr=%.4f dirty: y=%d,%d roll=%d\n", event->ev.caption.pgno, (double)currTimestamp, page.dirty.y0, page.dirty.y1, page.dirty.roll); fflush(fplog); } if (checkPageSize) setCaption(&page); checkPage(&page); vbi_unref_page(&page); break; case VBI_EVENT_NETWORK: fprintf(fplog, "vbi_event: type=NETWORK\n"); break; case VBI_EVENT_TRIGGER: fprintf(fplog, "vbi_event: type=TRIGGER\n"); break; case VBI_EVENT_ASPECT: fprintf(fplog, "vbi_event: type=ASPECT\n"); break; case VBI_EVENT_PROG_INFO: fprintf(fplog, "vbi_event: type=PROG_INFO\n"); break; case VBI_EVENT_NETWORK_ID: fprintf(fplog, "vbi_event: type=NETWORK_ID\n"); break; default: fprintf(fplog, "vbi_event: type=%#x\n", event->type); break; } }