|
| vbi_export_info * | vbi_export_info_enum (int index) |
| vbi_export_info * | vbi_export_info_keyword (const char *keyword) |
| vbi_export_info * | vbi_export_info_export (vbi_export *) |
| vbi_export * | vbi_export_new (const char *keyword, char **errstr) |
| void | vbi_export_delete (vbi_export *) |
| vbi_option_info * | vbi_export_option_info_enum (vbi_export *, int index) |
| vbi_option_info * | vbi_export_option_info_keyword (vbi_export *, const char *keyword) |
| vbi_bool | vbi_export_option_set (vbi_export *, const char *keyword,...) |
| vbi_bool | vbi_export_option_get (vbi_export *, const char *keyword, vbi_option_value *value) |
| vbi_bool | vbi_export_option_menu_set (vbi_export *, const char *keyword, int entry) |
| vbi_bool | vbi_export_option_menu_get (vbi_export *, const char *keyword, int *entry) |
| ssize_t | vbi_export_mem (vbi_export *e, void *buffer, size_t buffer_size, const vbi_page *pg) _vbi_nonnull((1)) |
| void * | vbi_export_alloc (vbi_export *e, void **buffer, size_t *buffer_size, const vbi_page *pg) _vbi_nonnull((1)) |
| vbi_bool | vbi_export_stdio (vbi_export *, FILE *fp, vbi_page *pg) |
| vbi_bool | vbi_export_file (vbi_export *, const char *name, vbi_page *pg) |
| char * | vbi_export_errstr (vbi_export *) |
Once libzvbi received, decoded and formatted a Teletext or Closed Caption page you will want to render it on screen, print it as text or store it in various formats.
Fortunately you don't have to do it all by yourself. libzvbi provides export modules converting a vbi_page into the desired format or rendering directly into memory.
A minimalistic export example:
static void
{
char *errstr;
fprintf (stderr, "Cannot export as HTML: %s\n", errstr);
free (errstr);
return;
}
}
vbi_bool vbi_export_file(vbi_export *e, const char *name, vbi_page *pg)
Definition export.c:1824
vbi_export * vbi_export_new(const char *keyword, char **errstr)
Definition export.c:539
void vbi_export_delete(vbi_export *export)
Definition export.c:608
char * vbi_export_errstr(vbi_export *export)
Definition export.c:2083
Formatted Teletext or Closed Caption page.
Definition format.h:265
| typedef struct vbi_export_info vbi_export_info |
Information about an export module.
Although export modules can be accessed by a static keyword (see vbi_export_new()) they are by definition opaque. The client can list export modules for the user and manipulate them without knowing about their availability or purpose. To do so, information about the module is necessary, given in this structure.
You can obtain this information with vbi_export_info_enum().
| vbi_bool vbi_export_option_set |
( |
vbi_export * | export, |
|
|
const char * | keyword, |
|
|
| ... ) |
|
extern |
- Parameters
-
| export | Pointer to a initialized vbi_export object. |
| keyword | Keyword identifying the option, as in vbi_option_info. |
| ... | New value to set. |
Sets the value of the named option. Make sure the value is casted to the correct type (int, double, char *).
Typical usage of vbi_export_option_set():
vbi_bool vbi_export_option_set(vbi_export *export, const char *keyword,...)
Definition export.c:774
Mind that options of type VBI_OPTION_MENU must be set by menu entry number (int), all other options by value. If necessary it will be replaced by the closest value possible. Use function vbi_export_option_menu_set() to set options with menu by menu entry.
- Returns
TRUE on success, otherwise the option is not changed.
References vbi_export_strdup().
Referenced by vbi_export_option_menu_set().
| ssize_t vbi_export_mem |
( |
vbi_export * | e, |
|
|
void * | buffer, |
|
|
size_t | buffer_size, |
|
|
const vbi_page * | pg ) |
|
extern |
- Parameters
-
| e | Initialized vbi_export object. |
| buffer | Output buffer. |
| buffer_size | Size of the output buffer in bytes. |
| pg | Page to be exported. |
This function writes the pg contents, converted to the format selected with vbi_export_new(), into the buffer.
You can call this function repeatedly, it does not change the state of the vbi_export or vbi_page structure.
- Returns
- On success the function returns the actual number of bytes stored in the buffer. If buffer_size is too small it returns the required size and the buffer contents are undefined. On other errors it returns -1 and the buffer contents are undefined.
- Since
- 0.2.26
References vbi_export::_class, vbi_export::_write, vbi_export::buffer, vbi_export::capacity, vbi_export::data, vbi_export::offset, vbi_export::target, and vbi_export::write_error.
| void * vbi_export_alloc |
( |
vbi_export * | e, |
|
|
void ** | buffer, |
|
|
size_t * | buffer_size, |
|
|
const vbi_page * | pg ) |
|
extern |
- Parameters
-
| e | Initialized vbi_export object. |
| buffer | The address of the output buffer will be stored here. buffer can be NULL. |
| buffer_size | The amount of data stored in the output buffer, in bytes, will be stored here. buffer_size can be NULL. |
| pg | Page to be exported. |
This function writes the pg contents, converted to the format selected with vbi_export_new(), into a newly allocated buffer. You must free() this buffer when it is no longer needed.
You can call this function repeatedly, it does not change the state of the vbi_export or vbi_page structure.
- Returns
- On success the function returns the address of the allocated buffer. On failure it returns
NULL, and buffer and buffer_size remain unmodified.
- Since
- 0.2.26
References vbi_export::_class, vbi_export::_write, vbi_export::buffer, vbi_export::capacity, vbi_export::data, vbi_export::offset, vbi_export::target, and vbi_export::write_error.
- Parameters
-
| e | Initialized vbi_export object. |
| fp | Buffered i/o stream to write to. |
| pg | Page to be exported. |
This function writes the pg contents, converted to the format selected with the vbi_export_new() function, into the stream fp. The caller is responsible for opening and closing the stream. Don't forget to check for i/o errors after closing. Note this function may write incomplete files when an error occurs.
You can call this function repeatedly, it does not change the state of the vbi_export or vbi_page structure.
- Returns
FALSE on failure, TRUE on success.
References vbi_export::_class, vbi_export::_handle, vbi_export::_write, vbi_export::buffer, vbi_export::data, vbi_export::target, and vbi_export::write_error.
- Parameters
-
| e | Initialized vbi_export object. |
| name | File to be created. |
| pg | Page to be exported. |
Writes the pg contents, converted to the format selected with vbi_export_new(), into a new file with the given name. When an error occurs after the file was opened, the function deletes the file.
You can call this function repeatedly, it does not change the state of the vbi_export or vbi_page structure.
- Returns
FALSE on failure, TRUE on success.
References vbi_export::_class, vbi_export::_handle, vbi_export::_write, vbi_export::buffer, vbi_export::data, vbi_export::name, vbi_export::target, vbi_export_error_printf(), vbi_export_write_error(), and vbi_export::write_error.