libclosedcaption 1.0.3
ISDB-Tb/SBTVD (Brazilian DTV) closed caption extraction from MPEG-TS
Loading...
Searching...
No Matches
caption.h
Go to the documentation of this file.
1
31#ifndef CAPTION_H_
32#define CAPTION_H_
33
34#include "caption-version.h"
35#include "caption-common.h"
36
37#include "packet-pes.h"
38#include "caption-data.h"
39#include "caption-management.h"
40#include "caption-hooking.h"
41
42#include "caption-closed.h"
44#include "caption-superimpose.h"
51
52#include "caption-screen.h"
53#include "ts-reader.h"
54#include "ts-demux.h"
55
56#ifndef DEBUG_CLOSEDCAPTION
57# define Dump_CaptionClosed_t(cc)
58# define Dump_CaptionManagement_t(m)
59#else
64# define Dump_CaptionClosed_t(cc) __Dump_CaptionClosed_t(__FILE__, __LINE__, __func__, cc)
69# define Dump_CaptionManagement_t(m) __Dump_CaptionManagement_t(__FILE__, __LINE__, __func__, m)
70
72static inline const char *
73__Dump_basename (const char *path)
74{
75 const char *file = strrchr (path, '/');
76
77 return (file != NULL) ? (file + 1) : path;
78}
79
80static inline void
81__Dump_CaptionManagement_t (const char *file,
82 uint32_t line,
83 const char *func,
84 const CaptionManagement_t *m)
85{
86#define get_data(x) ((m->statement.unit_size > (x)) ? m->statement.unit_data[x] : 0x00)
87 const uint8_t *l = (const uint8_t *)&m->ISO_639_lang_code[0];
88 uint32_t iso_639_lang = (l[0] << 16 | l[1] << 8 | l[2]);
89
90 printf ("<Dump_CaptionManagement_t() from %s:%u in %s()>\n"
91 " struct CaptionManagement_t {\n"
92 " TMD = %d,\n"
93 " TMD_otm = %#llx,\n"
94 " reserved = %d (0x%02x),\n"
95 " num_lang = %d (0x%02x),\n"
96 " DMF = 0x%02x,\n"
97 " DC = 0x%02x,\n"
98 " ISO_639_lang_code = '%s' (0x%06x),\n"
99 " format = 0x%x,\n"
100 " TCS = 0x%02x,\n"
101 " rollup_mode = 0x%02x\n"
102 " struct statement {\n"
103 " unit_sep = %d (0x%02x)\n"
104 " unit_param = %d (0x%02x)\n"
105 " unit_size = %u (0x%06x),\n"
106 " unit_data = { [0]='0x%02x', [1]='0x%02x', [2]='0x%02x', [3]='0x%02x', ... },\n"
107 " };\n"
108 " };\n"
109 "<Dump_CaptionManagement_t>\n",
110 __Dump_basename (file), line, func,
111 m->TMD, (unsigned long long)m->TMD_otm, m->reserved, m->reserved, m->num_lang, m->num_lang, m->DMF,
112 m->DC, m->ISO_639_lang_code, iso_639_lang, m->format, m->TCS, m->rollup_mode,
113 m->statement.unit_sep, m->statement.unit_sep,
114 m->statement.unit_param, m->statement.unit_param,
115 m->statement.unit_size, m->statement.unit_size,
116 get_data(0), get_data(1), get_data(2), get_data(3)
117 );
118#undef get_data
119}
120
121static inline void
122__Dump_CaptionClosed_t (const char *file,
123 uint32_t line,
124 const char *func,
125 const CaptionClosed_t *cc)
126{
127 printf ("<Dump_CaptionClosed_t() from %s:%u in %s()>\n"
128 " struct CaptionClosed_t {\n"
129 " CLS { need_clear = %s },\n"
130 " SWF {\n"
131 " format = %d (0x%02x)\n"
132 " char_size = %d (0x%02x)\n"
133 " char_number_in_oneline = %d (0x%02x)\n"
134 " char_line_number = %d (0x%02x)\n"
135 " };\n"
136 " struct SDF { width='%d' (0x%04x), height='%d' (0x%04x) };\n"
137 " struct SDP { width='%d' (0x%04x), height='%d' (0x%04x) };\n"
138 " struct SSM { width='%d' (0x%04x), height='%d' (0x%04x) };\n"
139 " struct APS { first='%d' (0x%02x), second='%d' (0x%02x) };\n"
140 " CC_Rcs_t RCS = %d,\n"
141 " SHS = %d (0x%02x),\n"
142 " SVS = %d (0x%02x),\n"
143 " CC_Color_t::foreground = { r=0x%02x, g=0x%02x, b=0x%02x, a=0x%02x },\n"
144 " CC_Color_t::background = { r=0x%02x, g=0x%02x, b=0x%02x, a=0x%02x },\n"
145 " CC_Color_t::half_background = { r=0x%02x, g=0x%02x, b=0x%02x, a=0x%02x },\n"
146 " CC_Color_t::half_foreground = { r=0x%02x, g=0x%02x, b=0x%02x, a=0x%02x },\n"
147 " };\n",
148 __Dump_basename (file), line, func,
149 cc->need_clear ? "TRUE" : "FALSE",
150 cc->format, cc->format,
151 cc->char_size, cc->char_size,
152 cc->char_number_in_oneline, cc->char_number_in_oneline,
153 cc->char_line_number, cc->char_line_number,
154 cc->SDF.width, cc->SDF.width, cc->SDF.height, cc->SDF.height,
155 cc->SDP.width, cc->SDP.width, cc->SDP.height, cc->SDP.height,
156 cc->SSM.width, cc->SSM.width, cc->SSM.height, cc->SSM.height,
157 cc->APS.first, cc->APS.first, cc->APS.second, cc->APS.second,
158 cc->RCS, cc->SHS, cc->SHS, cc->SVS, cc->SVS,
159 cc->foreground.r, cc->foreground.g, cc->foreground.b, cc->foreground.a,
160 cc->background.r, cc->background.g, cc->background.b, cc->background.a,
161 cc->half_background.r, cc->half_background.g, cc->half_background.b, cc->half_background.a,
162 cc->half_foreground.r, cc->half_foreground.g, cc->half_foreground.b, cc->half_foreground.a);
163
164 if (cc->pts != NULL)
165 {
166 printf (" struct pts {\n"
167 " h=%d, m=%d, s=%d, u=%d, ts=%u // [90 kHz-Timestamp: %d:%02d:%02d.%04d]\n"
168 " };\n", cc->pts->h, cc->pts->m, cc->pts->s, cc->pts->u, cc->pts->ts, cc->pts->h,
169 cc->pts->m, cc->pts->s, cc->pts->u);
170 }
171 else
172 {
173 printf (" struct pts {\n indisponível\n };\n");
174 }
175
176 printf ("</Dump_CaptionClosed_t()>\n");
177}
179#endif /* DEBUG_CLOSEDCAPTION */
180
181#endif /* CAPTION_H_ */
C0, C1 and CSI control commands of the caption text.
Interpreting the caption (closed caption) text and its state: colors, character size,...
Standard headers and helper macros used all over the library.
Reading the caption data_group (ARIB STD-B24, Volume 3, 9.2).
Registering the callbacks (hooks) that get the text and the caption commands while caption_closed_run...
Reading the "caption management data" and the "caption statement data" (ARIB STD-B24,...
Turns the caption PES packets into lines of text.
1-byte DRCS (characters drawn by the broadcaster) data unit.
2-byte DRCS (characters drawn by the broadcaster) data unit.
Bitmap data unit (a PNG image with position and flashing colors).
Color map data unit. Not implemented.
Geometric graphics data unit, split into commands.
Synthesized sound data unit.
Superimpose captions.
Library version (semver, same as the VERSION file).
Reading the header of a caption PES packet.
const PES_pts_t * pts
uint32_t ts
Definition packet-pes.h:44
uint8_t s
Definition packet-pes.h:42
uint8_t h
Definition packet-pes.h:40
uint8_t m
Definition packet-pes.h:41
uint16_t u
Definition packet-pes.h:43
MPEG-TS demuxer: PAT/PMT tables, per PID stats and reassembly of the PES packets of one PID.
Reading MPEG-TS files, packet by packet.