29 #define MAX_LINESIZE 2000
40 const char *header =
"[Script Info]";
42 if (!memcmp(p->
buf, header, strlen(header)) ||
43 !memcmp(p->
buf + 3, header, strlen(header)))
61 int hour,
min, sec, hsec;
63 if (sscanf(p,
"%*[^,],%d:%d:%d%*c%d", &hour, &min, &sec, &hsec) != 4)
66 av_dlog(
NULL,
"%d %d %d %d [%s]\n", hour, min, sec, hsec, p);
71 return sec * 100 + hsec;
74 static int event_cmp(
const void *_a,
const void *_b)
76 const uint8_t *
const *
a = _a, *
const *
b = _b;
82 int i,
len, header_remaining;
86 int allocated[2] = { 0 };
97 header_remaining = INT_MAX;
105 if (!memcmp(line,
"[Events]", 8))
106 header_remaining = 2;
107 else if (line[0] ==
'[')
108 header_remaining = INT_MAX;
110 i = header_remaining == 0;
119 memcpy(p + pos[i], line, len + 1);
135 while (*p && *p !=
'\n')
161 end = strchr(p,
'\n');
176 int64_t min_ts, int64_t ts, int64_t max_ts,
int flags)
188 int64_t min_ts_diff = INT64_MAX;
189 if (stream_index == -1) {
196 time_base.
num * (int64_t) AV_TIME_BASE,
202 int64_t ts_diff =
FFABS(pts - ts);
203 if (pts >= min_ts && pts <= max_ts && ts_diff < min_ts_diff) {
204 min_ts_diff = ts_diff;
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd)
Rescale a 64-bit integer with specified rounding.
int64_t pos
byte position in stream, -1 if unknown
av_dlog(ac->avr,"%d samples - audio_convert: %s to %s (%s)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic?ac->func_descr_generic:ac->func_descr)
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
AVStream ** streams
A list of all streams in the file.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given block if it is not large enough, otherwise do nothing.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int flags
A combination of AV_PKT_FLAG values.
AVCodecContext * codec
Codec context associated with this stream.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
#define AV_TIME_BASE
Internal time base represented as integer.
int ff_get_line(AVIOContext *s, char *buf, int maxlen)
Read a whole line of text from AVIOContext.
enum AVMediaType codec_type
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
AVIOContext * pb
I/O context.
rational number numerator/denominator
This structure contains the data a format has to probe a file.
int eof_reached
true if eof reached
void * priv_data
Format private data.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define AV_NOPTS_VALUE
Undefined timestamp value.