|
libclosedcaption 1.0.3
ISDB-Tb/SBTVD (Brazilian DTV) closed caption extraction from MPEG-TS
|
Standard headers and helper macros used all over the library. More...
#include <stdio.h>#include <stdlib.h>#include <stdint.h>#include <stdarg.h>#include <stdbool.h>#include <string.h>#include <ctype.h>#include <assert.h>#include <errno.h>

Go to the source code of this file.
Macros | |
| #define | _GNU_SOURCE |
| #define | is_latin_iso8859_15(x) (((x) >= 0x20 && (x) <= 0x7e) || ((x) >= 0xa1 && (x) <= 0xfe)) |
| #define | ARRAY_SIZE(x) ((unsigned)(sizeof(x)/sizeof((x)[0]))) |
| #define | PRINT_BOOL(x) (((x) == TRUE)?"TRUE":(((x) == FALSE)?"FALSE":"UNKNOWN")) |
| #define | UNUSED(x) x __attribute__ ((__unused__)) |
| #define | FALSE 0 |
| #define | TRUE 1 |
| #define | IS_PRINTABLE(a) ((a) >= 33 && (a) <= 126) |
| #define | DTV_DEBUG(fmt, ...) helper_print("DEBUG", __FILE__, __func__, __LINE__, fmt, ##__VA_ARGS__) |
| #define | DTV_HEXDUMP(buff, buffLen) helper_hexdump("DEBUG", __FILE__, __func__, __LINE__, #buff, #buffLen, (const char*)(buff), (buffLen)) |
Functions | |
| void | helper_hexdump (const char *platform, const char *fileFull, const char *func, uint32_t fileLine, const char *namebuff, const char *namebufflen, const char *buff, size_t buffLen) |
| void | helper_print (const char *platform, const char *fileFull, const char *func, uint32_t line, const char *format,...) __attribute__((format(printf |
Standard headers and helper macros used all over the library.
Debugging
Building with -DDEBUG_CLOSEDCAPTION, the macros DTV_DEBUG and DTV_HEXDUMP start printing messages and hex dumps to stdout. Without that flag they generate no code.
Definition in file caption-common.h.
| #define _GNU_SOURCE |
Enables the libc GNU extensions (e.g. POSIX/GNU function declarations).
Definition at line 18 of file caption-common.h.
| #define is_latin_iso8859_15 | ( | x | ) | (((x) >= 0x20 && (x) <= 0x7e) || ((x) >= 0xa1 && (x) <= 0xfe)) |
Checks if x is a printable ISO-8859-15 character, that is, if it is in the GL (0x20 to 0x7e) or GR (0xa1 to 0xfe) ranges of the character table.
Definition at line 35 of file caption-common.h.
| #define ARRAY_SIZE | ( | x | ) | ((unsigned)(sizeof(x)/sizeof((x)[0]))) |
Number of elements of a static array.
Definition at line 41 of file caption-common.h.
Turns a boolean into text, for debug messages.
Definition at line 44 of file caption-common.h.
| #define UNUSED | ( | x | ) | x __attribute__ ((__unused__)) |
Marks a parameter as unused, to avoid the compiler warning.
Definition at line 48 of file caption-common.h.
| #define FALSE 0 |
False. Kept for compatibility; same as false.
Definition at line 52 of file caption-common.h.
| #define TRUE 1 |
True. Kept for compatibility; same as true.
Definition at line 57 of file caption-common.h.
| #define IS_PRINTABLE | ( | a | ) | ((a) >= 33 && (a) <= 126) |
Visible ASCII character (no space), used in the hex dump.
Definition at line 63 of file caption-common.h.
| #define DTV_DEBUG | ( | fmt, | |
| ... | |||
| ) | helper_print("DEBUG", __FILE__, __func__, __LINE__, fmt, ##__VA_ARGS__) |
Prints a debug message, printf() style, with the file, line and function it came from. Only exists with -DDEBUG_CLOSEDCAPTION.
Definition at line 70 of file caption-common.h.
| #define DTV_HEXDUMP | ( | buff, | |
| buffLen | |||
| ) | helper_hexdump("DEBUG", __FILE__, __func__, __LINE__, #buff, #buffLen, (const char*)(buff), (buffLen)) |
Prints the hex dump of a buffer. Only exists with -DDEBUG_CLOSEDCAPTION.
Definition at line 79 of file caption-common.h.
| void helper_hexdump | ( | const char * | platform, |
| const char * | fileFull, | ||
| const char * | func, | ||
| uint32_t | fileLine, | ||
| const char * | namebuff, | ||
| const char * | namebufflen, | ||
| const char * | buff, | ||
| size_t | buffLen | ||
| ) |
Prints the hex dump of a buffer. Use the DTV_HEXDUMP macro.
| platform | Message prefix (not used). |
| fileFull | Source file (__FILE__). |
| func | Source function (__func__). |
| fileLine | Source line (__LINE__). |
| namebuff | Name of the buffer variable. |
| namebufflen | Name of the size variable. |
| buff | Buffer. |
| buffLen | Buffer size; above 8192 bytes the content is not printed. |
| void helper_print | ( | const char * | platform, |
| const char * | fileFull, | ||
| const char * | func, | ||
| uint32_t | line, | ||
| const char * | format, | ||
| ... | |||
| ) |
Prints a debug message. Use the DTV_DEBUG macro.
| platform | Message prefix (not used). |
| fileFull | Source file (__FILE__). |
| func | Source function (__func__). |
| line | Source line (__LINE__). |
| format | Format, like printf(). |