37 #define OFFSET(x) offsetof(TextContext, x)
38 #define SD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM
40 {
"keep_ass_markup",
"Set if ASS tags must be escaped",
OFFSET(keep_ass_markup),
AV_OPT_TYPE_INT, {.i64=0}, 0, 1, .flags=
SD },
50 const char *ptr = avpkt->
data;
53 const int ts_duration = avpkt->duration != -1 ?
57 if (ptr && avpkt->size > 0 && *ptr) {
64 *got_sub_ptr = sub->num_rects > 0;
68 #define DECLARE_CLASS(decname) static const AVClass decname ## _decoder_class = { \
69 .class_name = #decname " decoder", \
70 .item_name = av_default_item_name, \
71 .option = decname ## _options, \
72 .version = LIBAVUTIL_VERSION_INT, \
75 #if CONFIG_TEXT_DECODER
76 #define text_options options
87 .priv_class = &text_decoder_class,
91 #if CONFIG_VPLAYER_DECODER || CONFIG_PJS_DECODER || CONFIG_SUBVIEWER1_DECODER || CONFIG_STL_DECODER
100 #if CONFIG_VPLAYER_DECODER
101 #define vplayer_options options
111 .
init = linebreak_init,
112 .priv_class = &vplayer_decoder_class,
116 #if CONFIG_STL_DECODER
117 #define stl_options options
127 .
init = linebreak_init,
128 .priv_class = &stl_decoder_class,
132 #if CONFIG_PJS_DECODER
133 #define pjs_options options
143 .
init = linebreak_init,
144 .priv_class = &pjs_decoder_class,
148 #if CONFIG_SUBVIEWER1_DECODER
149 #define subviewer1_options options
152 AVCodec ff_subviewer1_decoder = {
153 .
name =
"subviewer1",
159 .
init = linebreak_init,
160 .priv_class = &subviewer1_decoder_class,
ptrdiff_t const GLvoid * data
static av_cold int init(AVCodecContext *avctx)
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
int ff_ass_subtitle_header_default(AVCodecContext *avctx)
Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS with default style.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
#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.
int ff_ass_add_rect_bprint(AVSubtitle *sub, AVBPrint *buf, int ts_start, int duration)
Same as ff_ass_add_rect_bprint, but taking an AVBPrint buffer instead of a string, and assuming raw=0.
main external API structure.
#define DECLARE_CLASS(decname)
Describe the class of an AVClass context structure.
rational number numerator/denominator
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.
static int text_decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr, AVPacket *avpkt)
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...