26 #define MAX_LINESIZE 2000
37 const char *header=
"[Script Info]";
39 if( !memcmp(p->
buf , header, strlen(header))
40 || !memcmp(p->
buf+3, header, strlen(header)))
58 int hour,
min, sec, hsec;
60 if(sscanf(p,
"%*[^,],%d:%d:%d%*c%d", &hour, &min, &sec, &hsec) != 4)
63 av_dlog(
NULL,
"%d %d %d %d [%s]\n", hour, min, sec, hsec, p);
71 static int event_cmp(
const void *_a,
const void *_b)
73 const uint8_t *
const *
a = _a, *
const *
b = _b;
79 int i,
len, header_remaining;
94 header_remaining= INT_MAX;
102 if(!memcmp(line,
"[Events]", 8))
104 else if(line[0]==
'[')
105 header_remaining= INT_MAX;
107 i= header_remaining==0;
116 memcpy(p + pos[i], line, len+1);
119 else header_remaining--;
130 while(*p && *p !=
'\n')
155 end= strchr(p,
'\n');
168 int64_t min_ts, int64_t ts, int64_t max_ts,
int flags)
180 int64_t min_ts_diff = INT64_MAX;
181 if (stream_index == -1) {
188 time_base.
num * (int64_t)AV_TIME_BASE,
194 int64_t ts_diff =
FFABS(pts - ts);
195 if (pts >= min_ts && pts <= max_ts && ts_diff < min_ts_diff) {
196 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.
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. ...
AVStream * avformat_new_stream(AVFormatContext *s, AVCodec *c)
Add a new stream to a media file.
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.
int ff_get_line(AVIOContext *s, char *buf, int maxlen)
Read a whole line of text from AVIOContext.
enum AVMediaType codec_type
AVIOContext * pb
I/O context.
rational number numerator/denominator
This structure contains the data a format has to probe a file.
#define AVSEEK_FLAG_FRAME
#define AVPROBE_SCORE_MAX
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...