Cache

## Topics

| Search
| Search the Teletext page cache.

## Functions

void | vbi_unref_page (vbi_page *pg)
int | vbi_is_cached (vbi_decoder *, int pgno, int subno)
int | vbi_cache_hi_subno (vbi_decoder *vbi, int pgno)
vbi_bool | vbi_fetch_cc_page (vbi_decoder *vbi, vbi_page *pg, vbi_pgno pgno, vbi_bool reset)

## Detailed Description

## Function Documentation

## vbi_unref_page()

void vbi_unref_page | ( | vbi_page * | pg | ) |

extern

Parameters

  pg | Previously fetched vbi_page.

A vbi_page fetched from cache with vbi_fetch_vt_page() or vbi_fetch_cc_page() may reference other resource in cache which are locked after fetching. When done processing the page, you must call this function to unlock all the resources associated with this vbi_page.

## vbi_is_cached()

int vbi_is_cached | ( | vbi_decoder * | vbi,
|  | int | pgno,
|  | int | subno )

extern

Parameters

  vbi |
  pgno |
  subno |

Deprecated
  At the moment pages can only be added to the cache but not removed unless the decoder is reset. That will change, making the result volatile in a multithreaded environment.

Returns
  `TRUE` if the given page is cached.

## vbi_cache_hi_subno()

int vbi_cache_hi_subno | ( | vbi_decoder * | vbi,
|  | int | pgno )

extern

Parameters

  vbi |
  pgno |

Deprecated
  Rationale same as vbi_is_cached().

Returns
  Highest cached subpage of this page.

## vbi_fetch_cc_page()

vbi_bool vbi_fetch_cc_page | ( | vbi_decoder * | vbi,
|  | vbi_page * | pg,
|  | vbi_pgno | pgno,
|  | vbi_bool | reset )

extern

Parameters

  vbi | Initialized vbi decoding context.
  pg | Place to store the formatted page.
  pgno | Page number 1 ... 8 of the page to fetch, see vbi_pgno.
  reset | `TRUE` resets the vbi_page dirty fields in cache after fetching. Pass `FALSE` only if you plan to call this function again to update other displays.

Fetches a Closed Caption page designated by pgno from the cache, formats and stores it in pg. CC pages are transmitted basically in two modes: at once and character by character ("roll-up" mode). Either way you get a snapshot of the page as it should appear on screen at present. With vbi_event_handler_add() you can request a `VBI_EVENT_CAPTION` event to be notified about pending changes (in case of "roll-up" mode that is with each new word received) and the vbi_page->dirty fields will mark the lines actually in need of updates, to speed up rendering.

Although safe to do, this function is not supposed to be called from an event handler, since rendering may block decoding for extended periods of time.

Returns
  `FALSE` if some error occured.

References vbi_page::dirty.