28 #include "libavutil/opt.h"
29 #include "libavutil/dict.h"
31 #include "libavutil/pixdesc.h"
34 #include "libavutil/avassert.h"
35 #include "libavutil/avstring.h"
36 #include "libavutil/mathematics.h"
37 #include "libavutil/parseutils.h"
38 #include "libavutil/time.h"
39 #include "libavutil/timestamp.h"
69 #define LICENSE_PREFIX "libavformat license: "
73 #define RELATIVE_TS_BASE (INT64_MAX - (1LL<<48))
91 timestamp < st->pts_wrap_reference)
103 MAKE_ACCESSORS(AVFormatContext, format, AVCodec *, subtitle_codec)
107 if (st->codec->codec)
108 return st->codec->codec;
110 switch(st->codec->codec_type){
112 if(s->video_codec)
return s->video_codec;
115 if(s->audio_codec)
return s->audio_codec;
118 if(s->subtitle_codec)
return s->subtitle_codec;
131 #define SANE_CHUNK_SIZE (50000000)
137 if(remaining < size){
140 s->
maxsize= newsize - !newsize;
142 remaining=
FFMAX(remaining, 0);
145 if(s->
maxsize>=0 && remaining+1 < size){
159 int64_t orig_pos = pkt->
pos;
160 int orig_size = pkt->
size;
164 int prev_size = pkt->
size;
184 if (ret != read_size) {
197 return pkt->
size > orig_size ? pkt->
size - orig_size :
ret;
228 int score, nodat = 0, score_max=0;
232 lpd.
buf = zerobuffer;
257 if (score > score_max) {
260 }
else if (score == score_max)
265 *score_ret= score_max;
274 if(score_ret > *score_max){
275 *score_max= score_ret;
288 static const struct {
309 for (i = 0; fmt_id_type[i].name; i++) {
310 if (!strcmp(fmt->
name, fmt_id_type[i].name)) {
340 const char *filename,
void *logctx,
341 unsigned int offset,
unsigned int max_probe_size)
343 AVProbeData pd = { filename ? filename :
"", NULL, -offset };
344 unsigned char *
buf = NULL;
346 int ret = 0, probe_size, buf_offset = 0;
349 if (!max_probe_size) {
355 "Specified probe size value %u cannot be < %u\n", max_probe_size,
PROBE_BUF_MIN);
359 if (offset >= max_probe_size) {
371 probe_size =
FFMIN(probe_size<<1,
FFMAX(max_probe_size, probe_size+1))) {
373 if (probe_size < offset) {
381 if ((ret =
avio_read(pb, buf + buf_offset, probe_size - buf_offset)) < 0) {
399 av_log(logctx,
AV_LOG_WARNING,
"Format %s detected only with low score of %d, misdetection possible!\n", (*fmt)->name, score);
401 av_log(logctx,
AV_LOG_DEBUG,
"Format %s probed with size=%d and score=%d\n", (*fmt)->name, probe_size, score);
413 return ret < 0 ? ret : score;
417 const char *filename,
void *logctx,
418 unsigned int offset,
unsigned int max_probe_size)
421 return ret < 0 ? ret : 0;
438 "will be ignored with AVFMT_NOFILE format.\n");
461 (*plast_pktl)->next = pktl;
463 *packet_buffer = pktl;
497 av_log(NULL,
AV_LOG_ERROR,
"Input context has not been properly allocated by avformat_alloc_context() and is not NULL either\n");
509 if ((ret =
init_input(s, filename, &tmp)) < 0)
547 if (id3v2_extra_meta) {
611 "Failed to reallocate probe buffer for stream %d\n",
677 if (!pktl || ret ==
AVERROR(EAGAIN))
693 "Dropped corrupted packet (stream = %d)\n",
728 #if FF_API_READ_PACKET
814 if (frame_size <= 0 || st->codec->sample_rate <= 0)
845 #if CONFIG_H264_DECODER
882 if (!first_program) {
907 program = first_program;
962 pts_buffer[0]= pktl->
pkt.
pts;
963 for(i=0; i<delay && pts_buffer[i] > pts_buffer[i+1]; i++)
964 FFSWAP(int64_t, pts_buffer[i], pts_buffer[i+1]);
966 pktl->
pkt.
dts= pts_buffer[0];
999 av_log(s,
AV_LOG_DEBUG,
"first_dts %s not matching first dts %s (pts %s, duration %d) in the queue\n",
1033 int num, den, presentation_delayed, delay, i;
1049 presentation_delayed = 0;
1055 presentation_delayed = 1;
1071 if(strcmp(s->
iformat->
name,
"mov,mp4,m4a,3gp,3g2,mj2"))
1118 presentation_delayed = 1;
1120 av_dlog(NULL,
"IN delayed:%d pts:%s, dts:%s cur_dts:%s st:%d pc:%p duration:%d\n",
1125 if (presentation_delayed) {
1175 av_dlog(NULL,
"OUTdelayed:%d/%d pts:%s, dts:%s cur_dts:%s\n",
1189 *pkt_buf = pktl->
next;
1193 *pkt_buf_end = NULL;
1207 int ret = 0, got_output = 0;
1218 while (size > 0 || (pkt == &
flush_pkt && got_output)) {
1223 &out_pkt.
data, &out_pkt.
size, data, size,
1232 got_output = !!out_pkt.
size;
1282 #if FF_API_DESTRUCT_PACKET
1319 *pkt_buffer = pktl->
next;
1321 *pkt_buffer_end = NULL;
1328 int ret = 0, i, got_packet = 0;
1356 cur_pkt.
pts < cur_pkt.
dts) {
1364 av_log(s,
AV_LOG_DEBUG,
"ff_read_packet stream=%d, pts=%s, dts=%s, size=%d, duration=%d, flags=%d\n",
1376 "%s, packets or times may be invalid.\n",
1421 av_log(s,
AV_LOG_DEBUG,
"read_frame_internal stream=%d, pts=%s, dts=%s, size=%d, duration=%d, flags=%d\n",
1458 int64_t last_dts = next_pkt->
dts;
1467 last_dts = pktl->
pkt.
dts;
1494 if (pktl && ret !=
AVERROR(EAGAIN)) {
1546 int first_audio_index = -1;
1559 first_audio_index = i;
1561 return first_audio_index >= 0 ? first_audio_index : 0;
1621 int *nb_index_entries,
1622 unsigned int *index_entries_allocated_size,
1628 if((
unsigned)*nb_index_entries + 1 >= UINT_MAX /
sizeof(
AVIndexEntry))
1634 if (size < 0 || size > 0x3FFFFFFF)
1641 index_entries_allocated_size,
1642 (*nb_index_entries + 1) *
1647 *index_entries= entries;
1652 index= (*nb_index_entries)++;
1653 ie= &entries[
index];
1654 av_assert0(index==0 || ie[-1].timestamp < timestamp);
1656 ie= &entries[
index];
1660 memmove(entries + index + 1, entries + index,
sizeof(
AVIndexEntry)*(*nb_index_entries - index));
1661 (*nb_index_entries)++;
1662 }
else if(ie->
pos == pos && distance < ie->min_distance)
1681 timestamp, size, distance, flags);
1685 int64_t wanted_timestamp,
int flags)
1694 if(b && entries[b-1].timestamp < wanted_timestamp)
1700 if(timestamp >= wanted_timestamp)
1702 if(timestamp <= wanted_timestamp)
1722 wanted_timestamp, flags);
1726 int64_t (*read_timestamp)(
struct AVFormatContext *,
int , int64_t *, int64_t ))
1728 int64_t ts = read_timestamp(s, stream_index, ppos, pos_limit);
1729 if (stream_index >= 0)
1738 int64_t ts_min, ts_max, ts;
1743 if (stream_index < 0)
1757 index=
FFMAX(index, 0);
1763 av_dlog(s,
"using cached pos_min=0x%"PRIx64
" dts_min=%s\n",
1777 av_dlog(s,
"using cached pos_max=0x%"PRIx64
" pos_limit=0x%"PRIx64
" dts_max=%s\n",
1782 pos=
ff_gen_search(s, stream_index, target_ts, pos_min, pos_max, pos_limit, ts_min, ts_max, flags, &ts, avif->
read_timestamp);
1797 int64_t (*read_timestamp)(
struct AVFormatContext *,
int , int64_t *, int64_t ))
1800 int64_t limit, ts_max;
1802 int64_t pos_max = filesize - 1;
1805 pos_max =
FFMAX(0, (pos_max) - step);
1813 int64_t tmp_pos = pos_max + 1;
1814 int64_t tmp_ts =
ff_read_timestamp(s, stream_index, &tmp_pos, INT64_MAX, read_timestamp);
1820 if(tmp_pos >= filesize)
1833 int64_t pos_min, int64_t pos_max, int64_t pos_limit,
1834 int64_t ts_min, int64_t ts_max,
int flags, int64_t *ts_ret,
1835 int64_t (*read_timestamp)(
struct AVFormatContext *,
int , int64_t *, int64_t ))
1846 ts_min =
ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp);
1851 if(ts_min >= target_ts){
1857 if ((ret =
ff_find_last_ts(s, stream_index, &ts_max, &pos_max, read_timestamp)) < 0)
1862 if(ts_max <= target_ts){
1867 if(ts_min > ts_max){
1869 }
else if(ts_min == ts_max){
1874 while (pos_min < pos_limit) {
1875 av_dlog(s,
"pos_min=0x%"PRIx64
" pos_max=0x%"PRIx64
" dts_min=%s dts_max=%s\n",
1877 assert(pos_limit <= pos_max);
1880 int64_t approximate_keyframe_distance= pos_max - pos_limit;
1882 pos =
av_rescale(target_ts - ts_min, pos_max - pos_min, ts_max - ts_min)
1883 + pos_min - approximate_keyframe_distance;
1884 }
else if(no_change==1){
1886 pos = (pos_min + pos_limit)>>1;
1894 else if(pos > pos_limit)
1903 av_dlog(s,
"%"PRId64
" %"PRId64
" %"PRId64
" / %s %s %s target:%s limit:%"PRId64
" start:%"PRId64
" noc:%d\n",
1904 pos_min, pos, pos_max,
1906 pos_limit, start_pos, no_change);
1912 if (target_ts <= ts) {
1913 pos_limit = start_pos - 1;
1917 if (target_ts >= ts) {
1927 ts_min =
ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp);
1929 ts_max =
ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp);
1930 av_dlog(s,
"pos=0x%"PRIx64
" %s<=%s<=%s\n",
1938 int64_t pos_min, pos_max;
1943 if (pos < pos_min) pos= pos_min;
1944 else if(pos > pos_max) pos= pos_max;
1954 int stream_index, int64_t timestamp,
int flags)
1961 st = s->
streams[stream_index];
1965 if(index < 0 && st->nb_index_entries && timestamp < st->index_entries[0].timestamp)
1968 if(index < 0 || index==st->nb_index_entries-1){
1986 }
while (read_status ==
AVERROR(EAGAIN));
1987 if (read_status < 0)
1994 av_log(s,
AV_LOG_ERROR,
"seek_frame_generic failed as this stream seems to contain no keyframes after the target timestamp, %d non keyframes found\n", nonkey);
2018 int64_t timestamp,
int flags)
2030 if(stream_index < 0){
2032 if(stream_index < 0)
2066 int64_t min_ts = INT64_MIN, max_ts = INT64_MAX;
2072 flags & ~AVSEEK_FLAG_BACKWARD);
2085 if(min_ts > ts || max_ts < ts)
2087 if (stream_index < -1 || stream_index >= (
int)s->
nb_streams)
2098 if (stream_index == -1 && s->
nb_streams == 1) {
2105 time_base.
num * (int64_t)AV_TIME_BASE,
2125 if (ret<0 && ts != min_ts && max_ts != ts) {
2126 ret =
av_seek_frame(s, stream_index, dir ? max_ts : min_ts, flags | dir);
2166 int64_t
start_time, start_time1, start_time_text, end_time, end_time1;
2167 int64_t
duration, duration1, filesize;
2172 start_time = INT64_MAX;
2173 start_time_text = INT64_MAX;
2174 end_time = INT64_MIN;
2175 duration = INT64_MIN;
2181 if (start_time1 < start_time_text)
2182 start_time_text = start_time1;
2184 start_time =
FFMIN(start_time, start_time1);
2187 end_time1 = start_time1
2189 end_time =
FFMAX(end_time, end_time1);
2200 duration =
FFMAX(duration, duration1);
2203 if (start_time == INT64_MAX || (start_time > start_time_text && start_time - start_time_text <
AV_TIME_BASE))
2204 start_time = start_time_text;
2205 else if(start_time > start_time_text)
2208 if (start_time != INT64_MAX) {
2210 if (end_time != INT64_MIN) {
2218 duration =
FFMAX(duration, end_time - start_time);
2226 double bitrate = (double)filesize * 8.0 * AV_TIME_BASE /
2228 if (bitrate >= 0 && bitrate <= INT_MAX)
2253 int i, show_warning = 0;
2292 #define DURATION_MAX_READ_SIZE 250000LL
2293 #define DURATION_MAX_RETRY 4
2300 int read_size, i,
ret;
2336 }
while(ret ==
AVERROR(EAGAIN));
2339 read_size += pkt->
size;
2344 duration = end_time = pkt->
pts;
2382 file_size =
FFMAX(0, file_size);
2408 av_dlog(ic,
"%d: start_time: %0.3f duration: %0.3f\n", i,
2412 av_dlog(ic,
"stream: start_time: %0.3f duration: %0.3f bitrate=%d kb/s\n",
2423 #define FAIL(errmsg) do { \
2425 *errmsg_ptr = errmsg; \
2432 FAIL(
"unspecified frame size");
2434 FAIL(
"unspecified sample format");
2436 FAIL(
"unspecified sample rate");
2438 FAIL(
"unspecified number of channels");
2440 FAIL(
"no decodable DTS frames");
2444 FAIL(
"unspecified size");
2446 FAIL(
"unspecified pixel format");
2449 FAIL(
"no frame in rv30/40 and no sar");
2453 FAIL(
"unspecified size");
2460 FAIL(
"unknown codec");
2468 int got_picture = 1,
ret = 0;
2489 av_dict_set(options ? options : &thread_opt,
"threads",
"1", 0);
2506 while ((pkt.
size > 0 || (!pkt.
data && got_picture)) &&
2516 &got_picture, &pkt);
2523 &got_picture, &pkt);
2538 if(!pkt.
data && !got_picture)
2560 if(tag == tags[i].tag)
2581 if (sflags & (1 << (bps - 1))) {
2613 for(i=0; tags && tags[i]; i++){
2616 if (codec_tags->
id ==
id) {
2617 *tag = codec_tags->
tag;
2629 for(i=0; tags && tags[i]; i++){
2650 if (j != i && next_start > ch->
start && next_start < end)
2653 ch->
end = (end == INT64_MAX) ? ch->
start : end;
2658 if(i<60*12)
return (i+1)*1001;
2659 else return ((
const int[]){24,30,60,12,15,48})[i-60*12]*1000*12;
2683 #if FF_API_FORMAT_PARAMETERS
2746 "%s, packets or times may be invalid.\n",
2754 av_dict_set(options ? &options[i] : &thread_opt,
"threads",
"1", 0);
2773 #if FF_API_R_FRAME_RATE
2791 int fps_analyze_framecount = 20;
2800 fps_analyze_framecount *= 2;
2804 fps_analyze_framecount = 0;
2838 "Stream #%d: not enough frames to estimate rate; "
2839 "consider increasing probesize\n", i);
2861 goto find_stream_info_err;
2864 goto find_stream_info_err;
2869 read_size += pkt->
size;
2876 "packet %d with DTS %"PRId64
", packet %d with DTS "
2889 "packet %d with DTS %"PRId64
", packet %d with DTS "
2925 #if FF_API_R_FRAME_RATE
2930 && pkt->
dts - (uint64_t)last < INT64_MAX){
2943 double sdts= dts*framerate/(1001*12);
2945 int64_t ticks=
llrint(sdts+j*0.5);
2946 double error= sdts - ticks + j*0.5;
2978 try_decode_frame(ic, st, pkt, (options && i < orig_nb_streams ) ? &options[i] : NULL);
2997 (options && i < orig_nb_streams) ?
2998 &options[i] : NULL);
3003 "decoding for stream %d failed\n", st->
index);
3026 double best_error = 0.01;
3042 if (error < best_error) {
3044 best_fps = std_fps.
num;
3049 best_fps, 12*1001, INT_MAX);
3060 double best_error= 0.01;
3074 if(error < best_error && best_error> 0.000000001){
3128 "Could not find codec parameters for stream %d (%s): %s\n"
3129 "Consider increasing the value for the 'analyzeduration' and 'probesize' options\n",
3138 find_stream_info_err:
3171 int wanted_stream_nb,
3178 unsigned *program = NULL;
3181 if (related_stream >= 0 && wanted_stream_nb < 0) {
3188 for (i = 0; i < nb_streams; i++) {
3189 int real_stream_index = program ? program[i] : i;
3194 if (wanted_stream_nb >= 0 && real_stream_index != wanted_stream_nb)
3209 if ((best_multiframe > multiframe) ||
3210 (best_multiframe == multiframe && best_bitrate > bitrate) ||
3211 (best_multiframe == multiframe && best_bitrate == bitrate && best_count >=
count))
3214 best_bitrate = bitrate;
3215 best_multiframe = multiframe;
3216 ret = real_stream_index;
3218 if (program && i == nb_streams - 1 && ret < 0) {
3225 *decoder_ret = best_decoder;
3302 #if FF_API_CLOSE_INPUT_FILE
3338 #if FF_API_NEW_STREAM
3354 if (s->
nb_streams >= INT_MAX/
sizeof(*streams))
3397 #if FF_API_R_FRAME_RATE
3412 av_dlog(ac,
"new_program: id=0x%04x\n",
id);
3501 if(strcmp(
"language", tag->
key)){
3502 const char *p = tag->
value;
3506 size_t len = strcspn(p,
"\x8\xa\xb\xc\xd");
3547 display_aspect_ratio.
num, display_aspect_ratio.
den);
3552 #if FF_API_R_FRAME_RATE
3596 is_output ?
"Output" :
"Input",
3599 is_output ?
"to" :
"from", url);
3604 int hours, mins, secs, us;
3642 int j, k, total = 0;
3647 name ? name->
value :
"");
3655 if (total < ic->nb_streams)
3671 const char *path,
int number)
3674 char *q, buf1[20],
c;
3675 int nd,
len, percentd_found;
3688 nd = nd * 10 + *p++ -
'0';
3700 snprintf(buf1,
sizeof(buf1),
"%0*d", nd, number);
3702 if ((q - buf + len) > buf_size - 1)
3704 memcpy(q, buf1, len);
3712 if ((q - buf) < buf_size - 1)
3716 if (!percentd_found)
3729 #define PRINT(...) do { if (!f) av_log(avcl, level, __VA_ARGS__); else fprintf(f, __VA_ARGS__); } while(0)
3731 for(i=0;i<
size;i+=16) {
3738 PRINT(
" %02x", buf[i+j]);
3743 for(j=0;j<
len;j++) {
3745 if (c < ' ' || c >
'~')
3766 #define PRINT(...) do { if (!f) av_log(avcl, level, __VA_ARGS__); else fprintf(f, __VA_ARGS__); } while(0)
3801 char *authorization,
int authorization_size,
3802 char *hostname,
int hostname_size,
3804 char *path,
int path_size,
3807 const char *p, *ls, *ls2, *at, *at2, *col, *brk;
3809 if (port_ptr) *port_ptr = -1;
3810 if (proto_size > 0) proto[0] = 0;
3811 if (authorization_size > 0) authorization[0] = 0;
3812 if (hostname_size > 0) hostname[0] = 0;
3813 if (path_size > 0) path[0] = 0;
3816 if ((p = strchr(url,
':'))) {
3828 ls = strchr(p,
'/');
3829 ls2 = strchr(p,
'?');
3833 ls =
FFMIN(ls, ls2);
3843 while ((at = strchr(p,
'@')) && at < ls) {
3845 FFMIN(authorization_size, at + 1 - at2));
3849 if (*p ==
'[' && (brk = strchr(p,
']')) && brk < ls) {
3852 FFMIN(hostname_size, brk - p));
3853 if (brk[1] ==
':' && port_ptr)
3854 *port_ptr = atoi(brk + 2);
3855 }
else if ((col = strchr(p,
':')) && col < ls) {
3857 FFMIN(col + 1 - p, hostname_size));
3858 if (port_ptr) *port_ptr = atoi(col + 1);
3861 FFMIN(ls + 1 - p, hostname_size));
3868 static const char hex_table_uc[16] = {
'0',
'1',
'2',
'3',
3871 'C',
'D',
'E',
'F' };
3872 static const char hex_table_lc[16] = {
'0',
'1',
'2',
'3',
3875 'c',
'd',
'e',
'f' };
3876 const char *hex_table = lowercase ? hex_table_lc : hex_table_uc;
3878 for(i = 0; i <
s; i++) {
3879 buff[i * 2] = hex_table[src[i] >> 4];
3880 buff[i * 2 + 1] = hex_table[src[i] & 0xF];
3897 if (c >=
'0' && c <=
'9')
3899 else if (c >=
'A' && c <=
'F')
3914 #if FF_API_SET_PTS_INFO
3915 void av_set_pts_info(
AVStream *s,
int pts_wrap_bits,
3916 unsigned int pts_num,
unsigned int pts_den)
3923 unsigned int pts_num,
unsigned int pts_den)
3927 if(new_tb.
num != pts_num)
3932 if(new_tb.
num <= 0 || new_tb.
den <= 0) {
3944 const char *ptr = str;
3949 char *dest = NULL, *dest_end;
3950 int key_len, dest_len = 0;
3953 while (*ptr && (
av_isspace(*ptr) || *ptr ==
','))
3960 if (!(ptr = strchr(key,
'=')))
3963 key_len = ptr - key;
3965 callback_get_buf(context, key, key_len, &dest, &dest_len);
3966 dest_end = dest + dest_len - 1;
3970 while (*ptr && *ptr !=
'\"') {
3974 if (dest && dest < dest_end)
3978 if (dest && dest < dest_end)
3986 for (; *ptr && !(
av_isspace(*ptr) || *ptr ==
','); ptr++)
3987 if (dest && dest < dest_end)
4007 struct tm time1 = {0}, time2 = {0};
4021 return ofmt->
query_codec(codec_id, std_compliance);
4065 if (channel_layout) {
4073 if (width || height) {
4080 bytestream_put_le32(&data, flags);
4082 bytestream_put_le32(&data, channels);
4084 bytestream_put_le64(&data, channel_layout);
4086 bytestream_put_le32(&data, sample_rate);
4087 if (width || height) {
4088 bytestream_put_le32(&data, width);
4089 bytestream_put_le32(&data, height);
4101 av_reduce(&stream_sample_aspect_ratio.
num, &stream_sample_aspect_ratio.
den,
4102 stream_sample_aspect_ratio.
num, stream_sample_aspect_ratio.
den, INT_MAX);
4103 if (stream_sample_aspect_ratio.
num <= 0 || stream_sample_aspect_ratio.
den <= 0)
4104 stream_sample_aspect_ratio = undef;
4106 av_reduce(&frame_sample_aspect_ratio.
num, &frame_sample_aspect_ratio.
den,
4107 frame_sample_aspect_ratio.
num, frame_sample_aspect_ratio.
den, INT_MAX);
4108 if (frame_sample_aspect_ratio.
num <= 0 || frame_sample_aspect_ratio.
den <= 0)
4109 frame_sample_aspect_ratio = undef;
4111 if (stream_sample_aspect_ratio.
num)
4112 return stream_sample_aspect_ratio;
4114 return frame_sample_aspect_ratio;
4136 if (*spec <= '9' && *spec >=
'0')
4137 return strtol(spec, NULL, 0) == st->
index;
4138 else if (*spec ==
'v' || *spec ==
'a' || *spec ==
's' || *spec ==
'd' ||
4152 if (*spec++ ==
':') {
4153 int i,
index = strtol(spec, NULL, 0);
4156 return i == st->
index;
4160 }
else if (*spec ==
'p' && *(spec + 1) ==
':') {
4164 prog_id = strtol(spec, &endptr, 0);
4169 if (*endptr++ ==
':') {
4170 int stream_idx = strtol(endptr, NULL, 0);
4171 return stream_idx >= 0 &&
4181 }
else if (*spec ==
'#') {
4184 sid = strtol(spec + 1, &endptr, 0);
4186 return st->
id == sid;
4196 static const uint8_t avci100_1080p_extradata[] = {
4198 0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
4199 0xb6, 0xd4, 0x20, 0x22, 0x33, 0x19, 0xc6, 0x63,
4200 0x23, 0x21, 0x01, 0x11, 0x98, 0xce, 0x33, 0x19,
4201 0x18, 0x21, 0x02, 0x56, 0xb9, 0x3d, 0x7d, 0x7e,
4202 0x4f, 0xe3, 0x3f, 0x11, 0xf1, 0x9e, 0x08, 0xb8,
4203 0x8c, 0x54, 0x43, 0xc0, 0x78, 0x02, 0x27, 0xe2,
4204 0x70, 0x1e, 0x30, 0x10, 0x10, 0x14, 0x00, 0x00,
4205 0x03, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0xca,
4206 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4208 0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x33, 0x48,
4211 static const uint8_t avci100_1080i_extradata[] = {
4213 0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
4214 0xb6, 0xd4, 0x20, 0x22, 0x33, 0x19, 0xc6, 0x63,
4215 0x23, 0x21, 0x01, 0x11, 0x98, 0xce, 0x33, 0x19,
4216 0x18, 0x21, 0x03, 0x3a, 0x46, 0x65, 0x6a, 0x65,
4217 0x24, 0xad, 0xe9, 0x12, 0x32, 0x14, 0x1a, 0x26,
4218 0x34, 0xad, 0xa4, 0x41, 0x82, 0x23, 0x01, 0x50,
4219 0x2b, 0x1a, 0x24, 0x69, 0x48, 0x30, 0x40, 0x2e,
4220 0x11, 0x12, 0x08, 0xc6, 0x8c, 0x04, 0x41, 0x28,
4221 0x4c, 0x34, 0xf0, 0x1e, 0x01, 0x13, 0xf2, 0xe0,
4222 0x3c, 0x60, 0x20, 0x20, 0x28, 0x00, 0x00, 0x03,
4223 0x00, 0x08, 0x00, 0x00, 0x03, 0x01, 0x94, 0x00,
4225 0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x33, 0x48,
4228 static const uint8_t avci50_1080i_extradata[] = {
4230 0x00, 0x00, 0x00, 0x01, 0x67, 0x6e, 0x10, 0x28,
4231 0xa6, 0xd4, 0x20, 0x32, 0x33, 0x0c, 0x71, 0x18,
4232 0x88, 0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8c,
4233 0x44, 0x30, 0x21, 0x02, 0x56, 0x4e, 0x6e, 0x61,
4234 0x87, 0x3e, 0x73, 0x4d, 0x98, 0x0c, 0x03, 0x06,
4235 0x9c, 0x0b, 0x73, 0xe6, 0xc0, 0xb5, 0x18, 0x63,
4236 0x0d, 0x39, 0xe0, 0x5b, 0x02, 0xd4, 0xc6, 0x19,
4237 0x1a, 0x79, 0x8c, 0x32, 0x34, 0x24, 0xf0, 0x16,
4238 0x81, 0x13, 0xf7, 0xff, 0x80, 0x02, 0x00, 0x01,
4239 0xf1, 0x80, 0x80, 0x80, 0xa0, 0x00, 0x00, 0x03,
4240 0x00, 0x20, 0x00, 0x00, 0x06, 0x50, 0x80, 0x00,
4242 0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x31, 0x12,
4245 static const uint8_t avci100_720p_extradata[] = {
4247 0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
4248 0xb6, 0xd4, 0x20, 0x2a, 0x33, 0x1d, 0xc7, 0x62,
4249 0xa1, 0x08, 0x40, 0x54, 0x66, 0x3b, 0x8e, 0xc5,
4250 0x42, 0x02, 0x10, 0x25, 0x64, 0x2c, 0x89, 0xe8,
4251 0x85, 0xe4, 0x21, 0x4b, 0x90, 0x83, 0x06, 0x95,
4252 0xd1, 0x06, 0x46, 0x97, 0x20, 0xc8, 0xd7, 0x43,
4253 0x08, 0x11, 0xc2, 0x1e, 0x4c, 0x91, 0x0f, 0x01,
4254 0x40, 0x16, 0xec, 0x07, 0x8c, 0x04, 0x04, 0x05,
4255 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x03,
4256 0x00, 0x64, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00,
4258 0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x31, 0x12,
4265 data = avci100_1080p_extradata;
4266 size =
sizeof(avci100_1080p_extradata);
4268 data = avci100_1080i_extradata;
4269 size =
sizeof(avci100_1080i_extradata);
4272 data = avci50_1080i_extradata;
4273 size =
sizeof(avci50_1080i_extradata);
4275 data = avci100_720p_extradata;
4276 size =
sizeof(avci100_720p_extradata);
unsigned int nb_chapters
Number of chapters in AVChapter array.
unsigned int max_index_size
Maximum amount of memory in bytes to use for the index of each stream.
void av_url_split(char *proto, int proto_size, char *authorization, int authorization_size, char *hostname, int hostname_size, int *port_ptr, char *path, int path_size, const char *url)
Split a URL string into components.
struct AVPacketList * raw_packet_buffer_end
#define AVERROR_STREAM_NOT_FOUND
#define AV_CODEC_PROP_INTRA_ONLY
Codec uses only intra compression.
#define AVERROR_PATCHWELCOME
static int shift(int a, int b)
char * av_small_strptime(const char *p, const char *fmt, struct tm *dt)
Parse the input string p according to the format string fmt and store its results in the structure dt...
attribute_deprecated int av_demuxer_open(AVFormatContext *ic)
void av_free_packet(AVPacket *pkt)
Free a packet.
This structure describes decoded (raw) audio or video data.
AVIOInterruptCB interrupt_callback
Custom interrupt callbacks for the I/O layer.
int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags)
Add an index entry into a sorted list.
struct AVPacketList * packet_buffer_end
AVInputFormat * av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max)
Guess the file format.
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const
Rescale a 64-bit integer with specified rounding.
enum AVDurationEstimationMethod duration_estimation_method
The duration field can be estimated through various ways, and this field can be used to know how the ...
#define AV_LOG_WARNING
Something somehow does not look correct.
int64_t pos
byte position in stream, -1 if unknown
uint8_t * subtitle_header
Header containing style information for text subtitles.
int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding.
int avformat_query_codec(AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance)
Test if the given container can store a codec.
int ffio_rewind_with_probe_data(AVIOContext *s, unsigned char **buf, int buf_size)
Rewind the AVIOContext using the specified buffer containing the first buf_size bytes of the file...
int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size)
Probe a bytestream to determine the input format.
AVFrame * avcodec_alloc_frame(void)
Allocate an AVFrame and set its fields to default values.
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
AVRational av_guess_sample_aspect_ratio(AVFormatContext *format, AVStream *stream, AVFrame *frame)
Guess the sample aspect ratio of a frame, based on both the stream and the frame aspect ratio...
AVDictionaryEntry * av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
AVCodecContext * codec
Codec context associated with this stream.
int64_t pts_wrap_reference
Internal data to check for wrapping of the time stamp.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
void av_codec_set_pkt_timebase(AVCodecContext *avctx, AVRational val)
int index
stream index in AVFormatContext
int av_dict_count(const AVDictionary *m)
Get number of entries in dictionary.
int avio_flags
avio flags, used to force AVIO_FLAG_DIRECT.
#define ID3v2_DEFAULT_MAGIC
Default magic bytes for ID3v2 header: "ID3".
#define PARSER_FLAG_USE_CODEC_TS
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel...
void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st)
Send a nice dump of a packet to the specified file stream.
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
void ff_network_close(void)
int av_isdigit(int c)
Locale-independent conversion of ASCII isdigit.
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
unsigned int skip_initial_bytes
Skip initial bytes when opening stream.
time_t av_timegm(struct tm *tm)
Convert the decomposed UTC time in tm to a time_t value.
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)
int64_t data_offset
offset of the first packet
int duration
Duration of the current frame.
int ctx_flags
Format-specific flags, see AVFMTCTX_xx.
int dts_ref_dts_delta
Offset of the current timestamp against last timestamp sync point in units of AVCodecContext.time_base.
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt)
Decode a subtitle message.
int64_t maxsize
max filesize, used to limit allocations This field is internal to libavformat and access from outside...
int av_dup_packet(AVPacket *pkt)
int ff_id3v2_parse_apic(AVFormatContext *s, ID3v2ExtraMeta **extra_meta)
Create a stream for each APIC (attached picture) extracted from the ID3v2 header. ...
enum AVCodecID subtitle_codec_id
Forced subtitle codec_id.
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
int avpriv_h264_has_num_reorder_frames(AVCodecContext *avctx)
AVBufferRef * buf
A reference to the reference-counted buffer where the packet data is stored.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
enum AVAudioServiceType audio_service_type
Type of service that the audio stream conveys.
if((e=av_dict_get(options,"", NULL, AV_DICT_IGNORE_SUFFIX)))
AVRational av_guess_frame_rate(AVFormatContext *ctx, AVStream *stream, AVFrame *frame)
Guess the frame rate, based on both the container and codec information.
unsigned int nb_stream_indexes
int ff_network_inited_globally
int64_t pts_buffer[MAX_REORDER_DELAY+1]
int ffio_limit(AVIOContext *s, int size)
static int64_t start_time
enum AVSampleFormat sample_fmt
audio sample format
int ff_network_init(void)
AVInputFormat * av_probe_input_format(AVProbeData *pd, int is_opened)
Guess the file format.
enum AVCodecID av_codec_get_id(const struct AVCodecTag *const *tags, unsigned int tag)
Get the AVCodecID for the given codec tag tag.
unsigned avformat_version(void)
Return the LIBAVFORMAT_VERSION_INT constant.
attribute_deprecated void(* destruct)(struct AVPacket *)
unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt)
Return a value representing the fourCC code associated to the pixel format pix_fmt, or 0 if no associated fourCC code can be found.
static const uint8_t offset[511][2]
static av_cold int end(AVCodecContext *avctx)
int id
unique ID to identify the chapter
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
int id
Format-specific stream ID.
enum AVStreamParseType need_parsing
int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
Check if the stream st contained in s is matched by the stream specifier spec.
const PixelFormatTag ff_raw_pix_fmt_tags[]
int av_codec_get_tag2(const struct AVCodecTag *const *tags, enum AVCodecID id, unsigned int *tag)
Get the codec tag for the given codec id.
static double av_q2d(AVRational a)
Convert rational to double.
int av_reallocp(void *ptr, size_t size)
Allocate or reallocate a block of memory.
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
int avformat_network_init(void)
Do global initialization of network components.
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
int fps_probe_size
decoding: number of frames used to probe fps
#define AV_LOG_VERBOSE
Detailed information.
int av_match_ext(const char *filename, const char *extensions)
Return a positive value if the given filename has one of the given extensions, 0 otherwise.
static void copy(LZOContext *c, int cnt)
Copies bytes from input to output buffer with checking.
struct AVPacket::@25 * side_data
Additional packet data that can be provided by the container.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
#define FFSWAP(type, a, b)
enum AVDiscard discard
selects which program to discard and which to feed to the caller
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
const OptionDef options[]
enum AVCodecID video_codec_id
Forced video codec_id.
unsigned int correct_ts_overflow
Correct single timestamp overflows.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const
Rescale a 64-bit integer by 2 rational numbers.
static const uint8_t frame_size[4]
void av_dump_format(AVFormatContext *ic, int index, const char *url, int is_output)
void av_dict_copy(AVDictionary **dst, AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
int av_find_best_stream(AVFormatContext *ic, enum AVMediaType type, int wanted_stream_nb, int related_stream, AVCodec **decoder_ret, int flags)
Find the "best" stream in the file.
AVInputFormat * av_iformat_next(AVInputFormat *f)
If f is NULL, returns the first registered input format, if f is non-NULL, returns the next registere...
int avcodec_close(AVCodecContext *avctx)
Close a given AVCodecContext and free all the data associated with it (but not the AVCodecContext its...
AVCodecID
Identify the syntax and semantics of the bitstream.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
int has_b_frames
Size of the frame reordering buffer in the decoder.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
int nb_decoded_frames
Number of internally decoded frames, used internally in libavformat, do not access its lifetime diffe...
int64_t pos
Byte position of currently parsed frame in stream.
int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, const AVPacket *avpkt)
Decode the video frame of size avpkt->size from avpkt->data into picture.
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
void av_hex_dump(FILE *f, const uint8_t *buf, int size)
Send a nice hexadecimal dump of a buffer to the specified file stream.
#define MAKE_ACCESSORS(str, name, type, field)
int64_t pts_wrap_reference
reference dts for wrap detection
void * priv_data
Format private data.
char filename[1024]
input or output filename
An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
int64_t timestamp
Timestamp in AVStream.time_base units, preferably the time from which on correctly decoded frames are...
int avcodec_is_open(AVCodecContext *s)
AVRational av_div_q(AVRational b, AVRational c) av_const
Divide one rational by another.
int64_t convergence_duration
Time difference in AVStream->time_base units from the pts of this packet to the point at which the ou...
int capabilities
Codec capabilities.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define PARSER_FLAG_COMPLETE_FRAMES
int av_read_play(AVFormatContext *s)
Start playing a network-based stream (e.g.
void av_dict_free(AVDictionary **m)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
struct AVInputFormat * iformat
Can only be iformat or oformat, not both at the same time.
preferred ID for decoding MPEG audio layer 1, 2 or 3
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
void ff_id3v2_free_extra_meta(ID3v2ExtraMeta **extra_meta)
Free memory allocated parsing special (non-text) metadata.
int64_t av_const av_gcd(int64_t a, int64_t b)
Return the greatest common divisor of a and b.
int skip_samples
Number of samples to skip at the start of the frame decoded from the next packet. ...
int av_isspace(int c)
Locale-independent conversion of ASCII isspace.
AVRational avg_frame_rate
Average framerate.
New fields can be added to the end with minor version bumps.
int min_distance
Minimum distance between this and the previous keyframe, used to avoid unneeded searching.
#define av_unused
Disable warnings about deprecated features This is useful for sections of code kept for backward comp...
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int size)
Allocate new information of a packet.
const AVCodecDescriptor * av_codec_get_codec_descriptor(const AVCodecContext *avctx)
int flags
A combination of AV_PKT_FLAG values.
static AVPacket flush_pkt
int av_packet_merge_side_data(AVPacket *pkt)
static float distance(float x, float y, int band)
int props
Codec properties, a combination of AV_CODEC_PROP_* flags.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
int buf_size
Size of buf except extra allocated bytes.
common internal API header
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
#define FF_MAX_EXTRADATA_SIZE
Maximum size in bytes of extradata.
unsigned int nb_streams
A list of all streams in the file.
int64_t fps_first_dts
Those are used for average framerate estimation.
int av_read_pause(AVFormatContext *s)
Pause a network-based stream (e.g.
int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq, enum AVRounding) av_const
Rescale a 64-bit integer by 2 rational numbers with specified rounding.
int64_t av_gettime(void)
Get the current time in microseconds.
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
int bit_rate
the average bitrate
Opaque data information usually continuous.
int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const
Rescale a 64-bit integer with rounding to nearest.
#define AV_TIME_BASE
Internal time base represented as integer.
enum AVCodecID audio_codec_id
Forced audio codec_id.
void * av_realloc(void *ptr, size_t size) 1(2)
Allocate or reallocate a block of memory.
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int64_t pts, int64_t dts, int64_t pos)
Parse a packet.
static const chunk_decoder decoder[8]
int width
picture width / height.
int64_t offset
byte offset from starting packet start
int av_find_default_stream_index(AVFormatContext *s)
int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size)
Like av_probe_input_buffer2() but returns 0 on success.
void * av_malloc(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
int64_t convergence_duration
Time difference in stream time base units from the pts of this packet to the point at which the outpu...
internal header for RIFF based (de)muxers do NOT include this in end user applications ...
void av_parser_close(AVCodecParserContext *s)
AVCodecParserContext * av_parser_init(int codec_id)
AVProgram * av_new_program(AVFormatContext *s, int id)
int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, const AVPacket *avpkt)
Decode the audio frame of size avpkt->size from avpkt->data into frame.
int ticks_per_frame
For some codecs, the time base is closer to the field rate than the frame rate.
int probe_score
format probing score.
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
unsigned int probesize
decoding: size of data to probe; encoding: unused.
preferred ID for MPEG-1/2 video decoding
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
struct AVPacketList * parse_queue_end
int av_get_frame_filename(char *buf, int buf_size, const char *path, int number)
Return in 'buf' the path with 'd' replaced by a number.
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.
void ff_id3v2_read(AVFormatContext *s, const char *magic, ID3v2ExtraMeta **extra_meta)
Read an ID3v2 tag, including supported extra metadata.
int raw_packet_buffer_remaining_size
AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
int64_t end
chapter start/end time in time_base units
int avformat_queue_attached_pictures(AVFormatContext *s)
int avformat_network_deinit(void)
Undo the initialization done by avformat_network_init.
int frame_size
Number of samples per channel in an audio frame.
int pts_dts_delta
Presentation delay of current frame in units of AVCodecContext.time_base.
struct AVPacketList * raw_packet_buffer
Raw packets from the demuxer, prior to parsing and decoding.
enum AVPixelFormat avpriv_find_pix_fmt(const PixelFormatTag *tags, unsigned int fourcc)
#define AV_LOG_INFO
Standard information.
enum AVMediaType codec_type
int ff_check_interrupt(AVIOInterruptCB *cb)
Check if the user has requested to interrup a blocking function associated with cb.
int debug
Flags to enable debugging.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
int av_opt_set_dict(void *obj, struct AVDictionary **options)
Set all the options from a given dictionary on an object.
int sample_rate
samples per second
int64_t reference_dts
Timestamp corresponding to the last dts sync point.
main external API structure.
int io_repositioned
IO repositioned flag.
int av_filename_number_test(const char *filename)
Check whether filename actually is a numbered sequence generator.
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
int pts_wrap_behavior
behavior on wrap detection
AVIOContext * pb
I/O context.
double(* duration_error)[2][MAX_STD_TIMEBASES]
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
BYTE int const BYTE int int int height
void avcodec_get_frame_defaults(AVFrame *frame)
Set the fields of the given AVFrame to default values.
Describe the class of an AVClass context structure.
unsigned int avpriv_toupper4(unsigned int x)
rational number numerator/denominator
#define AVERROR_DECODER_NOT_FOUND
Recommmends skipping the specified number of samples.
struct AVStream::@29 * info
int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
This structure contains the data a format has to probe a file.
int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
Return audio frame duration.
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
Return the next frame of a stream.
int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
Seek to timestamp ts.
This struct describes the properties of a single codec described by an AVCodecID. ...
int seek2any
Force seeking to any (also non key) frames.
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
int64_t codec_info_duration
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
int64_t start_time
Decoding: position of the first frame of the component, in AV_TIME_BASE fractional seconds...
AVInputFormat * av_probe_input_format3(AVProbeData *pd, int is_opened, int *score_ret)
Guess the file format.
int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Seek to the keyframe at timestamp.
struct AVCodecParserContext * parser
int64_t duration
Decoding: duration of the stream, in stream time base.
static int av_toupper(int c)
Locale-independent conversion of ASCII characters to uppercase.
const AVClass * av_class
A class for logging and AVOptions.
int(* split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
void av_opt_free(void *obj)
Free all string and binary options in obj.
#define FF_DISABLE_DEPRECATION_WARNINGS
common internal api header.
int pts_wrap_behavior
Options for behavior, when a wrap is detected.
int ff_id3v2_match(const uint8_t *buf, const char *magic)
Detect ID3v2 Header.
#define CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
Read packets of a media file to get stream information.
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base...
int disposition
AV_DISPOSITION_* bit field.
void av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc)
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
int pts_wrap_bits
number of bits in pts (used for wrapping control)
AVRational time_base
time base in which the start/end timestamps are specified
int av_grow_packet(AVPacket *pkt, int grow_by)
Increase packet size, correctly zeroing padding.
void av_init_packet(AVPacket *pkt)
Initialize optional fields of a packet with default values.
#define AV_PKT_FLAG_CORRUPT
The packet content is corrupted.
int max_analyze_duration
decoding: maximum time (in AV_TIME_BASE units) during which the input should be analyzed in avformat_...
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
#define FFMPEG_CONFIGURATION
int64_t codec_info_duration_fields
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
struct AVPacketList * packet_buffer
This buffer is only needed when packets were already buffered but not decoded, for example to get the...
Flag to pass INT64_MIN/MAX through instead of rescaling, this avoids special cases for AV_NOPTS_VALUE...
unsigned int index_entries_allocated_size
int skip_to_keyframe
Indicates that everything up to the next keyframe should be discarded.
struct AVOutputFormat * oformat
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
const AVClass * av_class
A class for private options.
#define AVERROR_INVALIDDATA
#define FF_ENABLE_DEPRECATION_WARNINGS
struct AVCodecParser * parser
int channels
number of audio channels
int ff_id3v2_tag_len(const uint8_t *buf)
Get the length of an ID3v2 tag.
int codec_info_nb_frames
Number of frames that have been demuxed during av_find_stream_info()
Opaque data information usually sparse.
const char * avformat_configuration(void)
Return the libavformat build-time configuration.
void avcodec_free_frame(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
AVProgram * av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s)
Find the programs which belong to a given stream.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
int bit_rate
Decoding: total stream bitrate in bit/s, 0 if not available.
int repeat_pict
This field is used for proper frame duration computation in lavf.
int64_t duration
Decoding: duration of the stream, in AV_TIME_BASE fractional seconds.
enum AVFieldOrder field_order
Field order.
#define AV_DICT_IGNORE_SUFFIX
unbuffered private I/O API
#define av_assert0(cond)
assert() equivalent, that is always enabled.
void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, AVStream *st)
Send a nice dump of a packet to the log.
void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size)
Send a nice hexadecimal dump of a buffer to the log.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
unsigned int av_codec_get_tag(const struct AVCodecTag *const *tags, enum AVCodecID id)
Get the codec tag for the given codec id id.
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
AVRational r_frame_rate
Real base framerate of the stream.
struct AVPacketList * parse_queue
Packets split by the parser get queued here.
int request_probe
stream probing state -1 -> probing finished 0 -> no probing requested rest -> perform probing with re...
unsigned int * stream_index
int use_wallclock_as_timestamps
forces the use of wallclock timestamps as pts/dts of packets This has undefined results in the presen...
This structure stores compressed data.
int key_frame
Set by parser to 1 for key frames and 0 for non-key frames.
int dts_sync_point
Synchronization point for start of timestamp generation.
#define av_ts2str(ts)
Convenience macro, the return value should be used only directly in function arguments but never stan...
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
AVPacket attached_pic
For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet will contain the attached pictu...
const char * avformat_license(void)
Return the libavformat license.
#define AV_NOPTS_VALUE
Undefined timestamp value.
AVInputFormat * av_find_input_format(const char *short_name)
Find AVInputFormat based on the short name of the input format.
void * av_mallocz(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
struct AVPacketList * next
int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod)
Compare 2 integers modulo mod.