Go to the documentation of this file.
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 &&
static const struct @364 webvtt_valid_tags[]
#define AV_BPRINT_SIZE_UNLIMITED
static int webvtt_event_to_ass(AVBPrint *buf, const char *p, int64_t cue_start_ms, int64_t cue_end_ms)
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)
int ff_ass_subtitle_header_default(AVCodecContext *avctx)
Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS with default style.
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
const FFCodec ff_webvtt_decoder
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.
static int webvtt_decode_frame(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, const AVPacket *avpkt)
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
static void flush_segment(AVBPrint *buf, AVBPrint *seg, int64_t dur_cs)
AVCodec p
The public AVCodec.
#define FF_ARRAY_ELEMS(a)
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
#define CODEC_LONG_NAME(str)
Rational number (pair of numerator and denominator).
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
#define i(width, name, range_min, range_max)
AVRational pkt_timebase
Timebase in which pkt_dts/pts and AVPacket.dts/pts are expressed.
#define AV_NOPTS_VALUE
Undefined timestamp value.
static av_const int av_isdigit(int c)
Locale-independent conversion of ASCII isdigit.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
const char * name
Name of the codec implementation.
void av_bprintf(AVBPrint *buf, const char *fmt,...)
main external API structure.
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 again
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
static void body(uint32_t ABCD[4], const uint8_t *src, size_t nblocks)
IDirect3DDxgiInterfaceAccess _COM_Outptr_ void ** p
#define FF_CODEC_DECODE_SUB_CB(func)
This structure stores compressed data.
static const struct @363 webvtt_tag_replace[]
av_cold void ff_ass_decoder_flush(AVCodecContext *avctx)
Helper to flush a text subtitles decoder making use of the FFASSDecoderContext.
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.