48 return (sscanf(ptr,
"%*u:%*u:%*u.%*u %*u:%*u:%*u.%*u %c", &
c) == 1 ||
49 (sscanf(ptr,
"@%u @%u %c", &
fs, &fe, &
c) == 3 &&
fs < fe));
54 const char *ptr = p->buf;
55 const char *ptr_end = p->buf + p->buf_size;
60 while (ptr < ptr_end) {
63 if (*ptr !=
'#' && *ptr !=
'\n') {
73static const char *
const cmds[] = {
101 unsigned hs, ms,
ss,
fs;
102 unsigned he,
me,
se, fe;
103 int ts_start, ts_end;
107 if (sscanf(buf,
"%u:%u:%u.%u %u:%u:%u.%u %n",
109 &he, &
me, &
se, &fe, &
len) == 8) {
110 ts_start = (hs*3600 + ms*60 +
ss) * jacosub->
timeres +
fs;
111 ts_end = (he*3600 +
me*60 +
se) * jacosub->
timeres + fe;
116 if (sscanf(buf,
"@%u @%u %n", &ts_start, &ts_end, &
len) == 2)
132 int h = 0, m = 0,
s = 0, d = 0;
134#define SSEP "%*1[.:]"
135 int n = sscanf(buf,
"%d"SSEP"%d"SSEP"%d"SSEP"%d", &
h, &m, &
s, &d);
141 if (*buf ==
'-' ||
h < 0) {
150 case 3: d =
s;
s = m; m =
h;
h = 0;
156 ret = sign * (ret * timeres + d);
187 const char *p =
line;
203 merge_line =
len > 1 && !strcmp(&
line[
len - 2],
"\\\n");
216 cmd_len = strlen(
cmds[
i]);
224 switch (
cmds[
i][0]) {
234 if (timeres <= 0 || timeres > UINT32_MAX) {
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
int ff_get_line(AVIOContext *s, char *buf, int maxlen)
Read a whole line of text from AVIOContext.
void av_bprintf(AVBPrint *buf, const char *fmt,...)
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
#define i(width, name, range_min, range_max)
#define se(name, range_min, range_max)
#define ss(width, name, subs,...)
#define fs(width, name, subs,...)
static int read_probe(const AVProbeData *p)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
#define FF_INFMT_FLAG_INIT_CLEANUP
For an FFInputFormat with this flag set read_close() needs to be called by the caller upon read_heade...
static int read_header(FFV1Context *f, RangeCoder *c)
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
static av_const int av_toupper(int c)
Locale-independent conversion of ASCII characters to uppercase.
int av_strncasecmp(const char *a, const char *b, size_t n)
Locale-independent case-insensitive compare.
static av_always_inline int jss_whitespace(char c)
static av_always_inline const char * jss_skip_whitespace(const char *p)
Macro definitions for various function/variable attributes.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static av_cold int read_close(AVFormatContext *ctx)
static const uint8_t header[24]
#define FF_ARRAY_ELEMS(a)
enum AVMediaType codec_type
General type of the encoded data.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
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...
int64_t pos
byte position in stream, -1 if unknown
This structure contains the data a format has to probe a file.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int nb_subs
number of subtitles packets
AVPacket ** subs
array of subtitles packets
int ff_subtitles_read_packet(AVFormatContext *s, AVPacket *pkt)
AVPacket * ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q, const uint8_t *event, size_t len, int merge)
Insert a new subtitle event.
int ff_subtitles_read_seek(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
int ff_subtitles_read_close(AVFormatContext *s)
void ff_subtitles_queue_finalize(void *log_ctx, FFDemuxSubtitlesQueue *q)
Set missing durations, sort subtitles by PTS (and then byte position), and drop duplicated events.
static av_always_inline int ff_subtitles_next_line(const char *ptr)
Get the number of characters to increment to jump to the next line, or to the end of the string.