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/mem.h"
27 #include "libavutil/opt.h"
28 
29 #include <aribb24/aribb24.h>
30 #include <aribb24/parser.h>
31 #include <aribb24/decoder.h>
32 
33 typedef struct Libaribb24Context {
34  AVClass *class;
35 
36  arib_instance_t *lib_instance;
37  arib_parser_t *parser;
38  arib_decoder_t *decoder;
39 
41 
43  unsigned int aribb24_skip_ruby;
44 
47 
48 static unsigned int get_profile_font_size(AVCodecContext *avctx)
49 {
50  Libaribb24Context *b24 = avctx->priv_data;
51  int profile = avctx->profile;
52 
54  profile = b24->default_profile;
55 
56  switch (profile) {
58  return 36;
60  return 18;
61  default:
62  return 0;
63  }
64 }
65 
66 static void libaribb24_log(void *p, const char *msg)
67 {
68  av_log((AVCodecContext *)p, AV_LOG_INFO, "%s\n", msg);
69 }
70 
72 {
73  Libaribb24Context *b24 = avctx->priv_data;
74  unsigned int plane_width = 0;
75  unsigned int plane_height = 0;
76  unsigned int font_size = 0;
77  int profile = avctx->profile;
78 
80  profile = b24->default_profile;
81 
82  switch (profile) {
84  plane_width = 960;
85  plane_height = 540;
86  break;
88  plane_width = 320;
89  plane_height = 180;
90  break;
91  default:
92  av_log(avctx, AV_LOG_ERROR, "Unknown or unsupported profile set!\n");
93  return AVERROR(EINVAL);
94  }
95 
96  font_size = get_profile_font_size(avctx);
97 
99  "[Script Info]\r\n"
100  "; Script generated by FFmpeg/Lavc%s\r\n"
101  "ScriptType: v4.00+\r\n"
102  "PlayResX: %d\r\n"
103  "PlayResY: %d\r\n"
104  "\r\n"
105  "[V4+ Styles]\r\n"
106 
107  /* ASSv4 header */
108  "Format: Name, "
109  "Fontname, Fontsize, "
110  "PrimaryColour, SecondaryColour, OutlineColour, BackColour, "
111  "Bold, Italic, Underline, StrikeOut, "
112  "ScaleX, ScaleY, "
113  "Spacing, Angle, "
114  "BorderStyle, Outline, Shadow, "
115  "Alignment, MarginL, MarginR, MarginV, "
116  "Encoding\r\n"
117 
118  "Style: "
119  "Default," /* Name */
120  "%s,%d," /* Font{name,size} */
121  "&H%x,&H%x,&H%x,&H%x," /* {Primary,Secondary,Outline,Back}Colour */
122  "%d,%d,%d,0," /* Bold, Italic, Underline, StrikeOut */
123  "100,100," /* Scale{X,Y} */
124  "0,0," /* Spacing, Angle */
125  "%d,1,0," /* BorderStyle, Outline, Shadow */
126  "%d,10,10,10," /* Alignment, Margin[LRV] */
127  "0\r\n" /* Encoding */
128 
129  "\r\n"
130  "[Events]\r\n"
131  "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\r\n",
133  plane_width, plane_height,
138 
139  if (!avctx->subtitle_header)
140  return AVERROR(ENOMEM);
141 
142  avctx->subtitle_header_size = strlen(avctx->subtitle_header);
143 
144  return 0;
145 }
146 
147 static int libaribb24_init(AVCodecContext *avctx)
148 {
149  Libaribb24Context *b24 = avctx->priv_data;
150  void(* arib_dec_init)(arib_decoder_t* decoder) = NULL;
151  int ret;
152  int profile = avctx->profile;
153 
154  if (!(b24->lib_instance = arib_instance_new(avctx))) {
155  av_log(avctx, AV_LOG_ERROR, "Failed to initialize libaribb24!\n");
156  return AVERROR_EXTERNAL;
157  }
158 
159  if (b24->aribb24_base_path) {
160  av_log(avctx, AV_LOG_INFO, "Setting the libaribb24 base path to '%s'\n",
161  b24->aribb24_base_path);
162  arib_set_base_path(b24->lib_instance, b24->aribb24_base_path);
163  }
164 
165  arib_register_messages_callback(b24->lib_instance, libaribb24_log);
166 
167  if (!(b24->parser = arib_get_parser(b24->lib_instance))) {
168  av_log(avctx, AV_LOG_ERROR, "Failed to initialize libaribb24 PES parser!\n");
169  return AVERROR_EXTERNAL;
170  }
171  if (!(b24->decoder = arib_get_decoder(b24->lib_instance))) {
172  av_log(avctx, AV_LOG_ERROR, "Failed to initialize libaribb24 decoder!\n");
173  return AVERROR_EXTERNAL;
174  }
175 
177  profile = b24->default_profile;
178 
179  switch (profile) {
181  arib_dec_init = arib_initialize_decoder_a_profile;
182  break;
184  arib_dec_init = arib_initialize_decoder_c_profile;
185  break;
186  default:
187  av_log(avctx, AV_LOG_ERROR, "Unknown or unsupported profile set!\n");
188  return AVERROR(EINVAL);
189  }
190 
191  arib_dec_init(b24->decoder);
192 
194  if (ret < 0)
195  return ret;
196 
197  return 0;
198 }
199 
201 {
202  Libaribb24Context *b24 = avctx->priv_data;
203 
204  if (b24->decoder)
205  arib_finalize_decoder(b24->decoder);
206 
207  if (b24->lib_instance)
208  arib_instance_destroy(b24->lib_instance);
209 
210  return 0;
211 }
212 
213 #define RGB_TO_BGR(c) (((c) & 0xff) << 16 | ((c) & 0xff00) | (((c) >> 16) & 0xff))
214 
216 {
217  Libaribb24Context *b24 = avctx->priv_data;
218  const arib_buf_region_t *region = arib_decoder_get_regions(b24->decoder);
219  unsigned int profile_font_size = get_profile_font_size(avctx);
220  AVBPrint buf;
221  int ret = 0;
222 
224 
225  while (region) {
226  ptrdiff_t region_length = region->p_end - region->p_start;
227  unsigned int ruby_region =
228  region->i_fontheight == (profile_font_size / 2);
229 
230  // ASS requires us to make the colors BGR, so we convert here
231  int foreground_bgr_color = RGB_TO_BGR(region->i_foreground_color);
232  int background_bgr_color = RGB_TO_BGR(region->i_background_color);
233 
234  if (region_length < 0) {
235  av_log(avctx, AV_LOG_ERROR, "Invalid negative region length!\n");
237  break;
238  }
239 
240  if (region_length == 0 || (ruby_region && b24->aribb24_skip_ruby)) {
241  goto next_region;
242  }
243 
244  // color and alpha
245  if (foreground_bgr_color != ASS_DEFAULT_COLOR)
246  av_bprintf(&buf, "{\\1c&H%06x&}", foreground_bgr_color);
247 
248  if (region->i_foreground_alpha != 0)
249  av_bprintf(&buf, "{\\1a&H%02x&}", region->i_foreground_alpha);
250 
251  if (background_bgr_color != ASS_DEFAULT_BACK_COLOR)
252  av_bprintf(&buf, "{\\3c&H%06x&}", background_bgr_color);
253 
254  if (region->i_background_alpha != 0)
255  av_bprintf(&buf, "{\\3a&H%02x&}", region->i_background_alpha);
256 
257  // font size
258  if (region->i_fontwidth != profile_font_size ||
259  region->i_fontheight != profile_font_size) {
260  av_bprintf(&buf, "{\\fscx%"PRId64"\\fscy%"PRId64"}",
261  av_rescale(region->i_fontwidth, 100,
262  profile_font_size),
263  av_rescale(region->i_fontheight, 100,
264  profile_font_size));
265  }
266 
267  // TODO: positioning
268 
269  av_bprint_append_data(&buf, region->p_start, region_length);
270 
271  av_bprintf(&buf, "{\\r}");
272 
273 next_region:
274  region = region->p_next;
275  }
276 
277  if (!av_bprint_is_complete(&buf))
278  ret = AVERROR(ENOMEM);
279 
280  if (ret == 0) {
281  av_log(avctx, AV_LOG_DEBUG, "Styled ASS line: %s\n",
282  buf.str);
283 
284  sub->format = 1; /* text */
285  ret = ff_ass_add_rect(sub, buf.str, b24->read_order++,
286  0, NULL, NULL);
287  }
288 
289  av_bprint_finalize(&buf, NULL);
290 
291  return ret;
292 }
293 
295  int *got_sub_ptr, const AVPacket *pkt)
296 {
297  Libaribb24Context *b24 = avctx->priv_data;
298  size_t parsed_data_size = 0;
299  size_t decoded_subtitle_size = 0;
300  const unsigned char *parsed_data = NULL;
301  char *decoded_subtitle = NULL;
302  time_t subtitle_duration = 0;
303  int ret = 0;
304 
305  if (pkt->size <= 0)
306  return pkt->size;
307 
308  arib_parse_pes(b24->parser, pkt->data, pkt->size);
309 
310  parsed_data = arib_parser_get_data(b24->parser,
311  &parsed_data_size);
312  if (!parsed_data || !parsed_data_size) {
313  av_log(avctx, AV_LOG_DEBUG, "No decode'able data was received from "
314  "packet (dts: %"PRId64", pts: %"PRId64").\n",
315  pkt->dts, pkt->pts);
316  return pkt->size;
317  }
318 
319  decoded_subtitle_size = parsed_data_size * 4;
320  if (!(decoded_subtitle = av_mallocz(decoded_subtitle_size + 1))) {
321  av_log(avctx, AV_LOG_ERROR,
322  "Failed to allocate buffer for decoded subtitle!\n");
323  return AVERROR(ENOMEM);
324  }
325 
326  decoded_subtitle_size = arib_decode_buffer(b24->decoder,
327  parsed_data,
328  parsed_data_size,
329  decoded_subtitle,
330  decoded_subtitle_size);
331 
332  subtitle_duration = arib_decoder_get_time(b24->decoder);
333 
334  if (avctx->pkt_timebase.num && pkt->pts != AV_NOPTS_VALUE)
335  sub->pts = av_rescale_q(pkt->pts,
336  avctx->pkt_timebase, AV_TIME_BASE_Q);
337 
338  sub->end_display_time = subtitle_duration ?
339  av_rescale_q(subtitle_duration,
341  (AVRational){1, 1000}) :
342  UINT32_MAX;
343 
344  av_log(avctx, AV_LOG_DEBUG,
345  "Result: '%s' (size: %zu, pkt_pts: %"PRId64", sub_pts: %"PRId64" "
346  "duration: %"PRIu32", pkt_timebase: %d/%d, time_base: %d/%d')\n",
347  decoded_subtitle ? decoded_subtitle : "<no subtitle>",
348  decoded_subtitle_size,
349  pkt->pts, sub->pts,
350  sub->end_display_time,
351  avctx->pkt_timebase.num, avctx->pkt_timebase.den,
352  avctx->time_base.num, avctx->time_base.den);
353 
354  if (decoded_subtitle)
355  ret = libaribb24_handle_regions(avctx, sub);
356 
357  *got_sub_ptr = sub->num_rects > 0;
358 
359  av_free(decoded_subtitle);
360 
361  // flush the region buffers, otherwise the linked list keeps getting
362  // longer and longer...
363  arib_finalize_decoder(b24->decoder);
364 
365  return ret < 0 ? ret : pkt->size;
366 }
367 
368 static void libaribb24_flush(AVCodecContext *avctx)
369 {
370  Libaribb24Context *b24 = avctx->priv_data;
371  if (!(avctx->flags2 & AV_CODEC_FLAG2_RO_FLUSH_NOOP))
372  b24->read_order = 0;
373 }
374 
375 #define OFFSET(x) offsetof(Libaribb24Context, x)
376 #define SD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM
377 static const AVOption options[] = {
378  { "aribb24-base-path", "set the base path for the libaribb24 library",
379  OFFSET(aribb24_base_path), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, SD },
380  { "aribb24-skip-ruby-text", "skip ruby text blocks during decoding",
381  OFFSET(aribb24_skip_ruby), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD },
382  { "default_profile", "default profile to use if not specified in the stream parameters",
383  OFFSET(default_profile), AV_OPT_TYPE_INT, { .i64 = AV_PROFILE_UNKNOWN }, AV_PROFILE_UNKNOWN, AV_PROFILE_ARIB_PROFILE_C, SD, .unit = "profile" },
384  {"a", "Profile A", 0, AV_OPT_TYPE_CONST, {.i64 = AV_PROFILE_ARIB_PROFILE_A}, INT_MIN, INT_MAX, SD, .unit = "profile"},
385  {"c", "Profile C", 0, AV_OPT_TYPE_CONST, {.i64 = AV_PROFILE_ARIB_PROFILE_C}, INT_MIN, INT_MAX, SD, .unit = "profile"},
386  { NULL }
387 };
388 
389 static const AVClass aribb24_class = {
390  .class_name = "libaribb24 decoder",
391  .item_name = av_default_item_name,
392  .option = options,
393  .version = LIBAVUTIL_VERSION_INT,
394 };
395 
397  .p.name = "libaribb24",
398  CODEC_LONG_NAME("libaribb24 ARIB STD-B24 caption decoder"),
399  .p.type = AVMEDIA_TYPE_SUBTITLE,
400  .p.id = AV_CODEC_ID_ARIB_CAPTION,
401  .p.priv_class = &aribb24_class,
402  .p.wrapper_name = "libaribb24",
404  .priv_data_size = sizeof(Libaribb24Context),
406  .close = libaribb24_close,
408  .flush = libaribb24_flush,
409 };
LIBAVCODEC_VERSION
#define LIBAVCODEC_VERSION
Definition: version.h:38
AVSubtitle
Definition: avcodec.h:2238
AVMEDIA_TYPE_SUBTITLE
@ AVMEDIA_TYPE_SUBTITLE
Definition: avutil.h:204
AV_BPRINT_SIZE_UNLIMITED
#define AV_BPRINT_SIZE_UNLIMITED
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:43
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:218
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:36
AV_TIME_BASE_Q
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
Definition: avutil.h:264
av_asprintf
char * av_asprintf(const char *fmt,...)
Definition: avstring.c:115
AVSubtitle::num_rects
unsigned num_rects
Definition: avcodec.h:2242
libaribb24_generate_ass_header
static int libaribb24_generate_ass_header(AVCodecContext *avctx)
Definition: libaribb24.c:71
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:539
AVOption
AVOption.
Definition: opt.h:429
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:35
FFCodec
Definition: codec_internal.h:127
AVCodecContext::subtitle_header
uint8_t * subtitle_header
Definition: avcodec.h:1902
ASS_DEFAULT_BORDERSTYLE
#define ASS_DEFAULT_BORDERSTYLE
Definition: ass.h:43
AV_PROFILE_ARIB_PROFILE_C
#define AV_PROFILE_ARIB_PROFILE_C
Definition: defs.h:189
Libaribb24Context::decoder
arib_decoder_t * decoder
Definition: libaribb24.c:38
AV_PROFILE_ARIB_PROFILE_A
#define AV_PROFILE_ARIB_PROFILE_A
Definition: defs.h:188
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:213
Libaribb24Context::default_profile
int default_profile
Definition: libaribb24.c:45
AVCodecContext::flags
int flags
AV_CODEC_FLAG_*.
Definition: avcodec.h:508
SD
#define SD
Definition: libaribb24.c:376
AVRational::num
int num
Numerator.
Definition: rational.h:59
ass.h
ff_libaribb24_decoder
const FFCodec ff_libaribb24_decoder
Definition: libaribb24.c:396
pkt
AVPacket * pkt
Definition: movenc.c:60
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:209
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:48
AV_PROFILE_UNKNOWN
#define AV_PROFILE_UNKNOWN
Definition: defs.h:65
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:230
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:2244
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:296
AV_CODEC_ID_ARIB_CAPTION
@ AV_CODEC_ID_ARIB_CAPTION
Definition: codec_id.h:581
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:215
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:75
NULL
#define NULL
Definition: coverity.c:32
options
static const AVOption options[]
Definition: libaribb24.c:377
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
Header containing style information for text subtitles.
Definition: avcodec.h:1901
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:550
AVCodecContext::flags2
int flags2
AV_CODEC_FLAG2_*.
Definition: avcodec.h:515
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
ASS_DEFAULT_BOLD
#define ASS_DEFAULT_BOLD
Definition: ass.h:39
AVPacket::size
int size
Definition: packet.h:540
av_bprint_finalize
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
Definition: bprint.c:240
codec_internal.h
Libaribb24Context
Definition: libaribb24.c:33
libaribb24_flush
static void libaribb24_flush(AVCodecContext *avctx)
Definition: libaribb24.c:368
Libaribb24Context::aribb24_base_path
char * aribb24_base_path
Definition: libaribb24.c:42
AVCodecContext::pkt_timebase
AVRational pkt_timebase
Timebase in which pkt_dts/pts and AVPacket.dts/pts are expressed.
Definition: avcodec.h:557
OFFSET
#define OFFSET(x)
Definition: libaribb24.c:375
AV_NOPTS_VALUE
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
Libaribb24Context::parser
arib_parser_t * parser
Definition: libaribb24.c:37
AVSubtitle::end_display_time
uint32_t end_display_time
Definition: avcodec.h:2241
AVPacket::dts
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
Definition: packet.h:538
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:220
ASS_DEFAULT_UNDERLINE
#define ASS_DEFAULT_UNDERLINE
Definition: ass.h:41
AVSubtitle::format
uint16_t format
Definition: avcodec.h:2239
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:532
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:256
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:2233
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:80
av_bprintf
void av_bprintf(AVBPrint *buf, const char *fmt,...)
Definition: bprint.c:99
libaribb24_close
static int libaribb24_close(AVCodecContext *avctx)
Definition: libaribb24.c:200
Libaribb24Context::aribb24_skip_ruby
unsigned int aribb24_skip_ruby
Definition: libaribb24.c:43
AVCodecContext
main external API structure.
Definition: avcodec.h:451
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
AVCodecContext::profile
int profile
profile
Definition: avcodec.h:1650
FF_CODEC_DECODE_SUB_CB
#define FF_CODEC_DECODE_SUB_CB(func)
Definition: codec_internal.h:314
libaribb24_log
static void libaribb24_log(void *p, const char *msg)
Definition: libaribb24.c:66
Libaribb24Context::read_order
int read_order
Definition: libaribb24.c:40
mem.h
AV_CODEC_FLAG_BITEXACT
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
Definition: avcodec.h:342
av_free
#define av_free(p)
Definition: tableprint_vlc.h:33
AVPacket
This structure stores compressed data.
Definition: packet.h:516
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:478
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327
libaribb24_decode
static int libaribb24_decode(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, const AVPacket *pkt)
Definition: libaribb24.c:294
aribb24_class
static const AVClass aribb24_class
Definition: libaribb24.c:389
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
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition: opt.h:276
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:392
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:163
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
libaribb24_init
static int libaribb24_init(AVCodecContext *avctx)
Definition: libaribb24.c:147