FFmpeg
libaribb24.c
Go to the documentation of this file.
1 /*
2  * ARIB STD-B24 caption decoder using the libaribb24 library
3  * Copyright (c) 2019 Jan Ekström
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "avcodec.h"
23 #include "libavcodec/ass.h"
24 #include "codec_internal.h"
25 #include "libavutil/log.h"
26 #include "libavutil/opt.h"
27 
28 #include <aribb24/aribb24.h>
29 #include <aribb24/parser.h>
30 #include <aribb24/decoder.h>
31 
32 typedef struct Libaribb24Context {
33  AVClass *class;
34 
35  arib_instance_t *lib_instance;
36  arib_parser_t *parser;
37  arib_decoder_t *decoder;
38 
40 
42  unsigned int aribb24_skip_ruby;
43 
46 
47 static unsigned int get_profile_font_size(AVCodecContext *avctx)
48 {
49  Libaribb24Context *b24 = avctx->priv_data;
50  int profile = avctx->profile;
51 
53  profile = b24->default_profile;
54 
55  switch (profile) {
57  return 36;
59  return 18;
60  default:
61  return 0;
62  }
63 }
64 
65 static void libaribb24_log(void *p, const char *msg)
66 {
67  av_log((AVCodecContext *)p, AV_LOG_INFO, "%s\n", msg);
68 }
69 
71 {
72  Libaribb24Context *b24 = avctx->priv_data;
73  unsigned int plane_width = 0;
74  unsigned int plane_height = 0;
75  unsigned int font_size = 0;
76  int profile = avctx->profile;
77 
79  profile = b24->default_profile;
80 
81  switch (profile) {
83  plane_width = 960;
84  plane_height = 540;
85  break;
87  plane_width = 320;
88  plane_height = 180;
89  break;
90  default:
91  av_log(avctx, AV_LOG_ERROR, "Unknown or unsupported profile set!\n");
92  return AVERROR(EINVAL);
93  }
94 
95  font_size = get_profile_font_size(avctx);
96 
98  "[Script Info]\r\n"
99  "; Script generated by FFmpeg/Lavc%s\r\n"
100  "ScriptType: v4.00+\r\n"
101  "PlayResX: %d\r\n"
102  "PlayResY: %d\r\n"
103  "\r\n"
104  "[V4+ Styles]\r\n"
105 
106  /* ASSv4 header */
107  "Format: Name, "
108  "Fontname, Fontsize, "
109  "PrimaryColour, SecondaryColour, OutlineColour, BackColour, "
110  "Bold, Italic, Underline, StrikeOut, "
111  "ScaleX, ScaleY, "
112  "Spacing, Angle, "
113  "BorderStyle, Outline, Shadow, "
114  "Alignment, MarginL, MarginR, MarginV, "
115  "Encoding\r\n"
116 
117  "Style: "
118  "Default," /* Name */
119  "%s,%d," /* Font{name,size} */
120  "&H%x,&H%x,&H%x,&H%x," /* {Primary,Secondary,Outline,Back}Colour */
121  "%d,%d,%d,0," /* Bold, Italic, Underline, StrikeOut */
122  "100,100," /* Scale{X,Y} */
123  "0,0," /* Spacing, Angle */
124  "%d,1,0," /* BorderStyle, Outline, Shadow */
125  "%d,10,10,10," /* Alignment, Margin[LRV] */
126  "0\r\n" /* Encoding */
127 
128  "\r\n"
129  "[Events]\r\n"
130  "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\r\n",
132  plane_width, plane_height,
137 
138  if (!avctx->subtitle_header)
139  return AVERROR(ENOMEM);
140 
141  avctx->subtitle_header_size = strlen(avctx->subtitle_header);
142 
143  return 0;
144 }
145 
146 static int libaribb24_init(AVCodecContext *avctx)
147 {
148  Libaribb24Context *b24 = avctx->priv_data;
149  void(* arib_dec_init)(arib_decoder_t* decoder) = NULL;
150  int ret_code = AVERROR_EXTERNAL;
151  int profile = avctx->profile;
152 
153  if (!(b24->lib_instance = arib_instance_new(avctx))) {
154  av_log(avctx, AV_LOG_ERROR, "Failed to initialize libaribb24!\n");
155  goto init_fail;
156  }
157 
158  if (b24->aribb24_base_path) {
159  av_log(avctx, AV_LOG_INFO, "Setting the libaribb24 base path to '%s'\n",
160  b24->aribb24_base_path);
161  arib_set_base_path(b24->lib_instance, b24->aribb24_base_path);
162  }
163 
164  arib_register_messages_callback(b24->lib_instance, libaribb24_log);
165 
166  if (!(b24->parser = arib_get_parser(b24->lib_instance))) {
167  av_log(avctx, AV_LOG_ERROR, "Failed to initialize libaribb24 PES parser!\n");
168  goto init_fail;
169  }
170  if (!(b24->decoder = arib_get_decoder(b24->lib_instance))) {
171  av_log(avctx, AV_LOG_ERROR, "Failed to initialize libaribb24 decoder!\n");
172  goto init_fail;
173  }
174 
176  profile = b24->default_profile;
177 
178  switch (profile) {
180  arib_dec_init = arib_initialize_decoder_a_profile;
181  break;
183  arib_dec_init = arib_initialize_decoder_c_profile;
184  break;
185  default:
186  av_log(avctx, AV_LOG_ERROR, "Unknown or unsupported profile set!\n");
187  ret_code = AVERROR(EINVAL);
188  goto init_fail;
189  }
190 
191  arib_dec_init(b24->decoder);
192 
193  if (libaribb24_generate_ass_header(avctx) < 0) {
194  ret_code = AVERROR(ENOMEM);
195  goto init_fail;
196  }
197 
198  return 0;
199 
200 init_fail:
201  if (b24->decoder)
202  arib_finalize_decoder(b24->decoder);
203 
204  if (b24->lib_instance)
205  arib_instance_destroy(b24->lib_instance);
206 
207  return ret_code;
208 }
209 
211 {
212  Libaribb24Context *b24 = avctx->priv_data;
213 
214  if (b24->decoder)
215  arib_finalize_decoder(b24->decoder);
216 
217  if (b24->lib_instance)
218  arib_instance_destroy(b24->lib_instance);
219 
220  return 0;
221 }
222 
223 #define RGB_TO_BGR(c) (((c) & 0xff) << 16 | ((c) & 0xff00) | (((c) >> 16) & 0xff))
224 
226 {
227  Libaribb24Context *b24 = avctx->priv_data;
228  const arib_buf_region_t *region = arib_decoder_get_regions(b24->decoder);
229  unsigned int profile_font_size = get_profile_font_size(avctx);
230  AVBPrint buf = { 0 };
231  int ret = 0;
232 
234 
235  while (region) {
236  ptrdiff_t region_length = region->p_end - region->p_start;
237  unsigned int ruby_region =
238  region->i_fontheight == (profile_font_size / 2);
239 
240  // ASS requires us to make the colors BGR, so we convert here
241  int foreground_bgr_color = RGB_TO_BGR(region->i_foreground_color);
242  int background_bgr_color = RGB_TO_BGR(region->i_background_color);
243 
244  if (region_length < 0) {
245  av_log(avctx, AV_LOG_ERROR, "Invalid negative region length!\n");
247  break;
248  }
249 
250  if (region_length == 0 || (ruby_region && b24->aribb24_skip_ruby)) {
251  goto next_region;
252  }
253 
254  // color and alpha
255  if (foreground_bgr_color != ASS_DEFAULT_COLOR)
256  av_bprintf(&buf, "{\\1c&H%06x&}", foreground_bgr_color);
257 
258  if (region->i_foreground_alpha != 0)
259  av_bprintf(&buf, "{\\1a&H%02x&}", region->i_foreground_alpha);
260 
261  if (background_bgr_color != ASS_DEFAULT_BACK_COLOR)
262  av_bprintf(&buf, "{\\3c&H%06x&}", background_bgr_color);
263 
264  if (region->i_background_alpha != 0)
265  av_bprintf(&buf, "{\\3a&H%02x&}", region->i_background_alpha);
266 
267  // font size
268  if (region->i_fontwidth != profile_font_size ||
269  region->i_fontheight != profile_font_size) {
270  av_bprintf(&buf, "{\\fscx%"PRId64"\\fscy%"PRId64"}",
271  av_rescale(region->i_fontwidth, 100,
272  profile_font_size),
273  av_rescale(region->i_fontheight, 100,
274  profile_font_size));
275  }
276 
277  // TODO: positioning
278 
279  av_bprint_append_data(&buf, region->p_start, region_length);
280 
281  av_bprintf(&buf, "{\\r}");
282 
283 next_region:
284  region = region->p_next;
285  }
286 
287  if (!av_bprint_is_complete(&buf))
288  ret = AVERROR(ENOMEM);
289 
290  if (ret == 0) {
291  av_log(avctx, AV_LOG_DEBUG, "Styled ASS line: %s\n",
292  buf.str);
293 
294  sub->format = 1; /* text */
295  ret = ff_ass_add_rect(sub, buf.str, b24->read_order++,
296  0, NULL, NULL);
297  }
298 
299  av_bprint_finalize(&buf, NULL);
300 
301  return ret;
302 }
303 
305  int *got_sub_ptr, const AVPacket *pkt)
306 {
307  Libaribb24Context *b24 = avctx->priv_data;
308  size_t parsed_data_size = 0;
309  size_t decoded_subtitle_size = 0;
310  const unsigned char *parsed_data = NULL;
311  char *decoded_subtitle = NULL;
312  time_t subtitle_duration = 0;
313  int ret = 0;
314 
315  if (pkt->size <= 0)
316  return pkt->size;
317 
318  arib_parse_pes(b24->parser, pkt->data, pkt->size);
319 
320  parsed_data = arib_parser_get_data(b24->parser,
321  &parsed_data_size);
322  if (!parsed_data || !parsed_data_size) {
323  av_log(avctx, AV_LOG_DEBUG, "No decode'able data was received from "
324  "packet (dts: %"PRId64", pts: %"PRId64").\n",
325  pkt->dts, pkt->pts);
326  return pkt->size;
327  }
328 
329  decoded_subtitle_size = parsed_data_size * 4;
330  if (!(decoded_subtitle = av_mallocz(decoded_subtitle_size + 1))) {
331  av_log(avctx, AV_LOG_ERROR,
332  "Failed to allocate buffer for decoded subtitle!\n");
333  return AVERROR(ENOMEM);
334  }
335 
336  decoded_subtitle_size = arib_decode_buffer(b24->decoder,
337  parsed_data,
338  parsed_data_size,
339  decoded_subtitle,
340  decoded_subtitle_size);
341 
342  subtitle_duration = arib_decoder_get_time(b24->decoder);
343 
344  if (avctx->pkt_timebase.num && pkt->pts != AV_NOPTS_VALUE)
345  sub->pts = av_rescale_q(pkt->pts,
346  avctx->pkt_timebase, AV_TIME_BASE_Q);
347 
348  sub->end_display_time = subtitle_duration ?
349  av_rescale_q(subtitle_duration,
351  (AVRational){1, 1000}) :
352  UINT32_MAX;
353 
354  av_log(avctx, AV_LOG_DEBUG,
355  "Result: '%s' (size: %zu, pkt_pts: %"PRId64", sub_pts: %"PRId64" "
356  "duration: %"PRIu32", pkt_timebase: %d/%d, time_base: %d/%d')\n",
357  decoded_subtitle ? decoded_subtitle : "<no subtitle>",
358  decoded_subtitle_size,
359  pkt->pts, sub->pts,
360  sub->end_display_time,
361  avctx->pkt_timebase.num, avctx->pkt_timebase.den,
362  avctx->time_base.num, avctx->time_base.den);
363 
364  if (decoded_subtitle)
365  ret = libaribb24_handle_regions(avctx, sub);
366 
367  *got_sub_ptr = sub->num_rects > 0;
368 
369  av_free(decoded_subtitle);
370 
371  // flush the region buffers, otherwise the linked list keeps getting
372  // longer and longer...
373  arib_finalize_decoder(b24->decoder);
374 
375  return ret < 0 ? ret : pkt->size;
376 }
377 
378 static void libaribb24_flush(AVCodecContext *avctx)
379 {
380  Libaribb24Context *b24 = avctx->priv_data;
381  if (!(avctx->flags2 & AV_CODEC_FLAG2_RO_FLUSH_NOOP))
382  b24->read_order = 0;
383 }
384 
385 #define OFFSET(x) offsetof(Libaribb24Context, x)
386 #define SD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM
387 static const AVOption options[] = {
388  { "aribb24-base-path", "set the base path for the libaribb24 library",
389  OFFSET(aribb24_base_path), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, SD },
390  { "aribb24-skip-ruby-text", "skip ruby text blocks during decoding",
391  OFFSET(aribb24_skip_ruby), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD },
392  { "default_profile", "default profile to use if not specified in the stream parameters",
393  OFFSET(default_profile), AV_OPT_TYPE_INT, { .i64 = FF_PROFILE_UNKNOWN }, FF_PROFILE_UNKNOWN, FF_PROFILE_ARIB_PROFILE_C, SD, "profile" },
394  {"a", "Profile A", 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_ARIB_PROFILE_A}, INT_MIN, INT_MAX, SD, "profile"},
395  {"c", "Profile C", 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_ARIB_PROFILE_C}, INT_MIN, INT_MAX, SD, "profile"},
396  { NULL }
397 };
398 
399 static const AVClass aribb24_class = {
400  .class_name = "libaribb24 decoder",
401  .item_name = av_default_item_name,
402  .option = options,
403  .version = LIBAVUTIL_VERSION_INT,
404 };
405 
407  .p.name = "libaribb24",
408  CODEC_LONG_NAME("libaribb24 ARIB STD-B24 caption decoder"),
409  .p.type = AVMEDIA_TYPE_SUBTITLE,
410  .p.id = AV_CODEC_ID_ARIB_CAPTION,
411  .p.priv_class = &aribb24_class,
412  .p.wrapper_name = "libaribb24",
413  .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
414  .priv_data_size = sizeof(Libaribb24Context),
416  .close = libaribb24_close,
418  .flush = libaribb24_flush,
419 };
LIBAVCODEC_VERSION
#define LIBAVCODEC_VERSION
Definition: version.h:38
AVSubtitle
Definition: avcodec.h:2384
AVMEDIA_TYPE_SUBTITLE
@ AVMEDIA_TYPE_SUBTITLE
Definition: avutil.h:204
AV_BPRINT_SIZE_UNLIMITED
#define AV_BPRINT_SIZE_UNLIMITED
av_bprint_is_complete
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
Definition: bprint.h:215
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
opt.h
av_bprint_init
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Definition: bprint.c:69
Libaribb24Context::lib_instance
arib_instance_t * lib_instance
Definition: libaribb24.c:35
AV_TIME_BASE_Q
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
Definition: avutil.h:260
av_asprintf
char * av_asprintf(const char *fmt,...)
Definition: avstring.c:116
AVSubtitle::num_rects
unsigned num_rects
Definition: avcodec.h:2388
libaribb24_generate_ass_header
static int libaribb24_generate_ass_header(AVCodecContext *avctx)
Definition: libaribb24.c:70
ASS_DEFAULT_ALIGNMENT
#define ASS_DEFAULT_ALIGNMENT
Definition: ass.h:42
ff_ass_add_rect
int ff_ass_add_rect(AVSubtitle *sub, const char *dialog, int readorder, int layer, const char *style, const char *speaker)
Add an ASS dialog to a subtitle.
Definition: ass.c:159
AVPacket::data
uint8_t * data
Definition: packet.h:374
AVOption
AVOption.
Definition: opt.h:251
FF_CODEC_CAP_NOT_INIT_THREADSAFE
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
Definition: codec_internal.h:34
FFCodec
Definition: codec_internal.h:127
AVCodecContext::subtitle_header
uint8_t * subtitle_header
Header containing style information for text subtitles.
Definition: avcodec.h:1758
ASS_DEFAULT_BORDERSTYLE
#define ASS_DEFAULT_BORDERSTYLE
Definition: ass.h:43
Libaribb24Context::decoder
arib_decoder_t * decoder
Definition: libaribb24.c:37
decoder
static const chunk_decoder decoder[8]
Definition: dfa.c:331
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
RGB_TO_BGR
#define RGB_TO_BGR(c)
Definition: libaribb24.c:223
Libaribb24Context::default_profile
int default_profile
Definition: libaribb24.c:44
AVCodecContext::flags
int flags
AV_CODEC_FLAG_*.
Definition: avcodec.h:515
SD
#define SD
Definition: libaribb24.c:386
AVRational::num
int num
Numerator.
Definition: rational.h:59
ass.h
ff_libaribb24_decoder
const FFCodec ff_libaribb24_decoder
Definition: libaribb24.c:406
pkt
AVPacket * pkt
Definition: movenc.c:59
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
ASS_DEFAULT_FONT
#define ASS_DEFAULT_FONT
Definition: ass.h:35
get_profile_font_size
static unsigned int get_profile_font_size(AVCodecContext *avctx)
Definition: libaribb24.c:47
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts_bsf.c:365
FF_PROFILE_ARIB_PROFILE_C
#define FF_PROFILE_ARIB_PROFILE_C
Definition: avcodec.h:1713
FF_PROFILE_UNKNOWN
#define FF_PROFILE_UNKNOWN
Definition: avcodec.h:1590
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:201
av_rescale_q
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Definition: mathematics.c:142
AVSubtitle::pts
int64_t pts
Same as packet pts, in AV_TIME_BASE.
Definition: avcodec.h:2390
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
AV_CODEC_ID_ARIB_CAPTION
@ AV_CODEC_ID_ARIB_CAPTION
Definition: codec_id.h:571
ASS_DEFAULT_BACK_COLOR
#define ASS_DEFAULT_BACK_COLOR
Definition: ass.h:38
libaribb24_handle_regions
static int libaribb24_handle_regions(AVCodecContext *avctx, AVSubtitle *sub)
Definition: libaribb24.c:225
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
NULL
#define NULL
Definition: coverity.c:32
options
static const AVOption options[]
Definition: libaribb24.c:387
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
AVCodecContext::subtitle_header_size
int subtitle_header_size
Definition: avcodec.h:1759
AVCodecContext::time_base
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
Definition: avcodec.h:557
AVCodecContext::flags2
int flags2
AV_CODEC_FLAG2_*.
Definition: avcodec.h:522
ASS_DEFAULT_BOLD
#define ASS_DEFAULT_BOLD
Definition: ass.h:39
AVPacket::size
int size
Definition: packet.h:375
av_bprint_finalize
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
Definition: bprint.c:235
codec_internal.h
Libaribb24Context
Definition: libaribb24.c:32
libaribb24_flush
static void libaribb24_flush(AVCodecContext *avctx)
Definition: libaribb24.c:378
Libaribb24Context::aribb24_base_path
char * aribb24_base_path
Definition: libaribb24.c:41
AVCodecContext::pkt_timebase
AVRational pkt_timebase
Timebase in which pkt_dts/pts and AVPacket.dts/pts are.
Definition: avcodec.h:1799
OFFSET
#define OFFSET(x)
Definition: libaribb24.c:385
AV_NOPTS_VALUE
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
Libaribb24Context::parser
arib_parser_t * parser
Definition: libaribb24.c:36
AVSubtitle::end_display_time
uint32_t end_display_time
Definition: avcodec.h:2387
AVPacket::dts
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
Definition: packet.h:373
AVERROR_EXTERNAL
#define AVERROR_EXTERNAL
Generic error in an external library.
Definition: error.h:59
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:191
ASS_DEFAULT_UNDERLINE
#define ASS_DEFAULT_UNDERLINE
Definition: ass.h:41
FF_PROFILE_ARIB_PROFILE_A
#define FF_PROFILE_ARIB_PROFILE_A
Definition: avcodec.h:1712
AVSubtitle::format
uint16_t format
Definition: avcodec.h:2385
log.h
AVPacket::pts
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: packet.h:367
AV_STRINGIFY
#define AV_STRINGIFY(s)
Definition: macros.h:66
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:254
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:194
ASS_DEFAULT_ITALIC
#define ASS_DEFAULT_ITALIC
Definition: ass.h:40
ASS_DEFAULT_COLOR
#define ASS_DEFAULT_COLOR
Definition: ass.h:37
profile
int profile
Definition: mxfenc.c:2111
av_rescale
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
Definition: mathematics.c:129
avcodec.h
ret
ret
Definition: filter_design.txt:187
AVClass::class_name
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:71
av_bprintf
void av_bprintf(AVBPrint *buf, const char *fmt,...)
Definition: bprint.c:94
libaribb24_close
static int libaribb24_close(AVCodecContext *avctx)
Definition: libaribb24.c:210
Libaribb24Context::aribb24_skip_ruby
unsigned int aribb24_skip_ruby
Definition: libaribb24.c:42
AVCodecContext
main external API structure.
Definition: avcodec.h:435
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
AVCodecContext::profile
int profile
profile
Definition: avcodec.h:1589
FF_CODEC_DECODE_SUB_CB
#define FF_CODEC_DECODE_SUB_CB(func)
Definition: codec_internal.h:309
libaribb24_log
static void libaribb24_log(void *p, const char *msg)
Definition: libaribb24.c:65
Libaribb24Context::read_order
int read_order
Definition: libaribb24.c:39
AV_CODEC_FLAG_BITEXACT
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
Definition: avcodec.h:330
av_free
#define av_free(p)
Definition: tableprint_vlc.h:33
AVPacket
This structure stores compressed data.
Definition: packet.h:351
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:462
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:244
libaribb24_decode
static int libaribb24_decode(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, const AVPacket *pkt)
Definition: libaribb24.c:304
aribb24_class
static const AVClass aribb24_class
Definition: libaribb24.c:399
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:229
AV_CODEC_FLAG2_RO_FLUSH_NOOP
#define AV_CODEC_FLAG2_RO_FLUSH_NOOP
Do not reset ASS ReadOrder field on flush (subtitles decoding)
Definition: avcodec.h:380
av_bprint_append_data
void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size)
Append data to a print buffer.
Definition: bprint.c:158
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
libaribb24_init
static int libaribb24_init(AVCodecContext *avctx)
Definition: libaribb24.c:146