38 #define OFFSET(x) offsetof(TextContext, x)
39 #define SD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM
41 {
"keep_ass_markup",
"Set if ASS tags must be escaped",
OFFSET(keep_ass_markup),
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, .flags=
SD },
51 const char *ptr = avpkt->
data;
55 if (ptr && avpkt->
size > 0 && *ptr) {
73 #define DECLARE_CLASS(decname) static const AVClass decname ## _decoder_class = { \
74 .class_name = #decname " decoder", \
75 .item_name = av_default_item_name, \
76 .option = decname ## _options, \
77 .version = LIBAVUTIL_VERSION_INT, \
80 #if CONFIG_TEXT_DECODER
81 #define text_options options
92 .priv_class = &text_decoder_class,
97 #if CONFIG_VPLAYER_DECODER || CONFIG_PJS_DECODER || CONFIG_SUBVIEWER1_DECODER || CONFIG_STL_DECODER
106 #if CONFIG_VPLAYER_DECODER
107 #define vplayer_options options
117 .
init = linebreak_init,
118 .priv_class = &vplayer_decoder_class,
123 #if CONFIG_STL_DECODER
124 #define stl_options options
134 .
init = linebreak_init,
135 .priv_class = &stl_decoder_class,
140 #if CONFIG_PJS_DECODER
141 #define pjs_options options
151 .
init = linebreak_init,
152 .priv_class = &pjs_decoder_class,
157 #if CONFIG_SUBVIEWER1_DECODER
158 #define subviewer1_options options
161 AVCodec ff_subviewer1_decoder = {
162 .
name =
"subviewer1",
168 .
init = linebreak_init,
169 .priv_class = &subviewer1_decoder_class,
ptrdiff_t const GLvoid * data
static void flush(AVCodecContext *avctx)
static av_cold int init(AVCodecContext *avctx)
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.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
static void text_flush(AVCodecContext *avctx)
int ff_ass_subtitle_header_default(AVCodecContext *avctx)
Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS with default style.
#define AV_CODEC_FLAG2_RO_FLUSH_NOOP
Do not reset ASS ReadOrder field on flush (subtitles decoding)
#define AV_BPRINT_SIZE_UNLIMITED
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
static const AVOption options[]
const char * name
Name of the codec implementation.
Libavcodec external API header.
main external API structure.
#define DECLARE_CLASS(decname)
Describe the class of an AVClass context structure.
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
void ff_ass_bprint_text_event(AVBPrint *buf, const char *p, int size, const char *linebreaks, int keep_ass_markup)
Escape a text subtitle using ASS syntax into an AVBPrint buffer.
int flags2
AV_CODEC_FLAG2_*.
static int text_decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr, AVPacket *avpkt)
This structure stores compressed data.