38 {
"{",
"\\{{}"}, {
"\\",
"\\\xe2\x81\xa0"},
39 {
">",
">"}, {
"<",
"<"},
40 {
"‎",
"\xe2\x80\x8e"}, {
"‏",
"\xe2\x80\x8f"},
41 {
"&",
"&"}, {
" ",
"\\h"},
47 {
"i",
"{\\i1}"}, {
"/i",
"{\\i0}"},
48 {
"b",
"{\\b1}"}, {
"/b",
"{\\b0}"},
49 {
"u",
"{\\u1}"}, {
"/u",
"{\\u0}"},
56 int h = 0, m = 0,
s = 0, ms = 0;
58 if (sscanf(buf,
"%d:%2d:%2d.%3d", &
h, &m, &
s, &ms) == 4) {
61 return (
int64_t)
h * 3600000 + m * 60000 +
s * 1000 + ms;
63 if (sscanf(buf,
"%2d:%2d.%3d", &m, &
s, &ms) == 3) {
66 return m * 60000 +
s * 1000 + ms;
83 if ((
int)strspn(
body,
"0123456789:.") !=
len)
87 if (ts <= cue_start || ts >= cue_end)
89 if (prev_ts >= 0 && ts <= prev_ts)
120 const char *tag_end = strchr(p,
'>');
124 len = tag_end - p + 1;
131 cue_start_ms, cue_end_ms, prev_ts, &ts)) {
132 int64_t end_cs = (ts - cue_start_ms + 5) / 10;
143 if(!strncmp(p + 1,
from, strlen(
from))) {
154 const size_t len = strlen(
from);
167 if (p[0] ==
'\n' && p[1])
177 prev_ts < 0 ? 0 : (cue_end_ms - cue_start_ms + 5) / 10 - start_cs);
184 int *got_sub_ptr,
const AVPacket *avpkt)
187 const char *ptr = avpkt->
data;
191 int64_t start_ms = 0, end_ms = 0;
203 if (ptr && avpkt->
size > 0 &&
const FFCodec ff_webvtt_decoder
av_cold void ff_ass_decoder_flush(AVCodecContext *avctx)
Helper to flush a text subtitles decoder making use of the FFASSDecoderContext.
int ff_ass_subtitle_header_default(AVCodecContext *avctx)
Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS with default style.
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.
Libavcodec external API header.
void av_bprintf(AVBPrint *buf, const char *fmt,...)
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
#define AV_BPRINT_SIZE_UNLIMITED
#define i(width, name, range_min, range_max)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_DECODE_SUB_CB(func)
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
static av_const int av_isdigit(int c)
Locale-independent conversion of ASCII isdigit.
#define AV_NOPTS_VALUE
Undefined timestamp value.
static int webvtt_event_to_ass(AVBPrint *buf, const char *p, int64_t cue_start_ms, int64_t cue_end_ms)
static const struct @100261322220050354054276343174076111370112303022 webvtt_tag_replace[]
static int read_cue_timestamp(const char *body, int len, int64_t cue_start, int64_t cue_end, int64_t prev_ts, int64_t *ts_out)
static int64_t parse_webvtt_timestamp(const char *buf)
static void flush_segment(AVBPrint *buf, AVBPrint *seg, int64_t dur_cs)
static int webvtt_decode_frame(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, const AVPacket *avpkt)
static const struct @211370307362230067325015074113005042221367315304 webvtt_valid_tags[]
static void body(uint32_t ABCD[4], const uint8_t *src, size_t nblocks)
#define FF_ARRAY_ELEMS(a)
main external API structure.
AVRational pkt_timebase
Timebase in which pkt_dts/pts and AVPacket.dts/pts are expressed.
This structure stores compressed data.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Rational number (pair of numerator and denominator).