61 }
else if(p[
offset] ==
'[') {
64 }
else if (p[
offset] ==
']' && in_brackets) {
67 }
else if(in_brackets &&
129 if(!memcmp(p->buf,
"\xef\xbb\xbf", 3)) {
132 while(p->buf[
offset] ==
'\n' || p->buf[
offset] ==
'\r') {
135 if(p->buf[
offset] !=
'[') {
140 if(!memcmp(p->buf +
offset,
"offset:", 7)) {
143 if(sscanf(p->buf +
offset,
"%"SCNd64
":%"SCNu64
".%"SCNu64
"]",
144 &mm, &
ss, &cs) == 3) {
149 metadata_item->
native; metadata_item++) {
150 size_t metadata_item_len = strlen(metadata_item->
native);
151 if(p->buf[
offset + metadata_item_len] ==
':' &&
152 !memcmp(p->buf +
offset, metadata_item->
native, metadata_item_len)) {
181 if(header_offset >= 0) {
182 char *comma_offset = strchr(
line.str,
':');
184 char *right_bracket_offset = strchr(
line.str,
']');
185 if(!right_bracket_offset) {
189 *right_bracket_offset = *comma_offset =
'\0';
190 if(strcmp(
line.str + 1,
"offset") ||
191 sscanf(comma_offset + 1,
"%"SCNd64, &lrc->
ts_offset) != 1) {
197 *right_bracket_offset =
']';
207 while((ts_stroffset_incr =
read_ts(
line.str + ts_stroffset,
209 ts_start =
av_clip64(ts_start, INT64_MIN/4, INT64_MAX/4);
210 ts_stroffset += ts_stroffset_incr;
212 line.len - ts_strlength, 0);
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.
int avio_r8(AVIOContext *s)
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
int av_sscanf(const char *string, const char *format,...)
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
#define AV_BPRINT_SIZE_UNLIMITED
#define ss(width, name, subs,...)
static int read_probe(const AVProbeData *p)
#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)
@ AV_CODEC_ID_TEXT
raw UTF-8 text
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
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.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define AV_TIME_BASE
Internal time base represented as integer.
#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)
const AVMetadataConv ff_lrc_metadata_conv[]
static int lrc_read_header(AVFormatContext *s)
static int64_t read_line(AVBPrint *buf, AVIOContext *pb)
static int lrc_probe(const AVProbeData *p)
static int64_t find_header(const char *p)
static int64_t count_ts(const char *p)
static int64_t read_ts(const char *p, int64_t *start)
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 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.