libclosedcaption 1.0.3
ISDB-Tb/SBTVD (Brazilian DTV) closed caption extraction from MPEG-TS
Loading...
Searching...
No Matches
caption-common.h
Go to the documentation of this file.
1
13#ifndef CAPTION_HELPER_H_
14#define CAPTION_HELPER_H_
15
16#ifndef _GNU_SOURCE
18#define _GNU_SOURCE
19#endif
20
21#include <stdio.h>
22#include <stdlib.h>
23#include <stdint.h>
24#include <stdarg.h>
25#include <stdbool.h>
26#include <string.h>
27#include <ctype.h>
28#include <assert.h>
29#include <errno.h>
30
35#define is_latin_iso8859_15(x) (((x) >= 0x20 && (x) <= 0x7e) || ((x) >= 0xa1 && (x) <= 0xfe))
36
37#ifdef ARRAY_SIZE
38# undef ARRAY_SIZE
39#endif
41#define ARRAY_SIZE(x) ((unsigned)(sizeof(x)/sizeof((x)[0])))
42
44#define PRINT_BOOL(x) (((x) == TRUE)?"TRUE":(((x) == FALSE)?"FALSE":"UNKNOWN"))
45
46#undef UNUSED
48#define UNUSED(x) x __attribute__ ((__unused__))
49
50#ifndef FALSE
52# define FALSE 0
53#endif
54
55#ifndef TRUE
57# define TRUE 1
58#endif
59
60#ifdef DEBUG_CLOSEDCAPTION
61
63#define IS_PRINTABLE(a) ((a) >= 33 && (a) <= 126)
64
65#ifndef DTV_DEBUG
70# define DTV_DEBUG(fmt, ...) \
71 helper_print("DEBUG", __FILE__, __func__, __LINE__, fmt, ##__VA_ARGS__)
72#endif
73
74#ifndef DTV_HEXDUMP
79# define DTV_HEXDUMP(buff, buffLen)\
80 helper_hexdump("DEBUG", __FILE__, __func__, __LINE__, #buff, #buffLen, (const char*)(buff), (buffLen))
81#endif
82
95void helper_hexdump (const char *platform,
96 const char *fileFull,
97 const char *func,
98 uint32_t fileLine,
99 const char *namebuff,
100 const char *namebufflen,
101 const char *buff,
102 size_t buffLen);
103
113void helper_print (const char *platform,
114 const char *fileFull,
115 const char *func,
116 uint32_t line,
117 const char *format,
118 ...) __attribute__ ((format (printf, 5, 6)));
119
120#else
121
122# ifndef DTV_DEBUG
123# define DTV_DEBUG(fmt, ...) do { } while (0)
124# endif
125
126# ifndef DTV_HEXDUMP
127# define DTV_HEXDUMP(buff, buffLen) do { } while (0)
128# endif
129
130#endif /* DEBUG_CLOSEDCAPTION */
131
132#endif /* CAPTION_HELPER_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)
void helper_print(const char *platform, const char *fileFull, const char *func, uint32_t line, const char *format,...) __attribute__((format(printf