55 #include "libavutil/ffversion.h" 
   71     return FFMPEG_CONFIGURATION;
 
   76 #define LICENSE_PREFIX "libavformat license: " 
   80 #define RELATIVE_TS_BASE (INT64_MAX - (1LL<<48)) 
   98             timestamp < st->pts_wrap_reference)
 
  111 MAKE_ACCESSORS(AVFormatContext, format, AVCodec *, subtitle_codec)
 
  113 MAKE_ACCESSORS(AVFormatContext, format, 
int, metadata_header_padding)
 
  116 #if FF_API_OLD_OPEN_CALLBACKS 
  155     if (   (src-> codec_whitelist && !dst-> codec_whitelist)
 
  156         || (src->  format_whitelist && !dst->  format_whitelist)
 
  167 #if FF_API_LAVF_AVCTX 
  169     if (st->codec->codec)
 
  170         return st->codec->codec;
 
  191     const AVCodec *codec;
 
  193 #if CONFIG_H264_DECODER 
  207             if (probe_codec->
id == codec_id &&
 
  224 #define SANE_CHUNK_SIZE (50000000) 
  230         if (remaining < size) {
 
  233                 s->
maxsize = newsize - !newsize;
 
  235             remaining= 
FFMAX(remaining, 0);
 
  238         if (s->
maxsize>= 0 && remaining+1 < size) {
 
  250     int64_t orig_pos   = pkt->
pos; 
 
  251     int orig_size      = pkt->
size;
 
  255         int prev_size = pkt->
size;
 
  273         if (ret != read_size) {
 
  286     return pkt->
size > orig_size ? pkt->
size - orig_size : ret;
 
  316     static const struct {
 
  343                "Probe with size=%d, packets=%d detected %s with score=%d\n",
 
  346         for (i = 0; fmt_id_type[i].name; i++) {
 
  347             if (!strcmp(fmt->
name, fmt_id_type[i].name)) {
 
  357 #if FF_API_LAVF_AVCTX 
  408                                       "will be ignored with AVFMT_NOFILE format.\n");
 
  444         (*plast_pktl)->next = pktl;
 
  446         *packet_buffer = pktl;
 
  461                     "Attached picture on stream %d has invalid size, " 
  495 #if FF_API_LAVF_AVCTX 
  513     AVFormatContext *
s = *ps;
 
  521         av_log(
NULL, 
AV_LOG_ERROR, 
"Input context has not been properly allocated by avformat_alloc_context() and is not NULL either\n");
 
  537     if ((ret = 
init_input(s, filename, &tmp)) < 0)
 
  605         av_log(s, level, 
"Discarding ID3 tags because more suitable tags were found.\n");
 
  611     if (id3v2_extra_meta) {
 
  689                        "Failed to reallocate probe buffer for stream %d\n",
 
  702                        "nothing to probe for stream %d\n", st->
index);
 
  730     int i, pts_wrap_behavior;
 
  731     int64_t pts_wrap_reference;
 
  749     if (!first_program) {
 
  776         program = first_program;
 
  825             if (!pktl || ret == 
AVERROR(EAGAIN))
 
  848                    "Dropped corrupted packet (stream = %d)\n",
 
  919 #if FF_API_LAVF_AVCTX 
  921     if ((!codec_framerate.den || !codec_framerate.num) && st->codec->time_base.den && st->codec->time_base.num)
 
  928     switch (st->codecpar->codec_type) {
 
  930         if (st->r_frame_rate.num && !pc && 
s->iformat) {
 
  931             *pnum = st->r_frame_rate.den;
 
  932             *pden = st->r_frame_rate.num;
 
  933         } 
else if (st->time_base.num * 1000LL > st->time_base.den) {
 
  934             *pnum = st->time_base.num;
 
  935             *pden = st->time_base.den;
 
  936         } 
else if (codec_framerate.den * 1000LL > codec_framerate.num) {
 
  937             av_assert0(st->internal->avctx->ticks_per_frame);
 
  940                       codec_framerate.num * (int64_t)st->internal->avctx->ticks_per_frame,
 
  943             if (pc && pc->repeat_pict) {
 
  946                           (*pnum) * (1LL + pc->repeat_pict),
 
  953             if (st->internal->avctx->ticks_per_frame > 1 && !pc)
 
  958         if (st->internal->avctx_inited) {
 
  960             sample_rate = st->internal->avctx->sample_rate;
 
  963             sample_rate = st->codecpar->sample_rate;
 
  965         if (frame_size <= 0 || sample_rate <= 0)
 
  990 #if CONFIG_H264_DECODER 
 1021             int64_t best_score = INT64_MAX;
 
 1022             for (i = 0; i<delay; i++) {
 
 1025                     if (score < best_score) {
 
 1027                         dts = pts_buffer[i];
 
 1032             for (i = 0; i<delay; i++) {
 
 1034                     int64_t 
diff =  
FFABS(pts_buffer[i] - dts)
 
 1049         dts = pts_buffer[0];
 
 1061     AVStream *st       = s->
streams[stream_index];
 
 1070     for (; pkt_buffer; pkt_buffer = 
get_next_pkt(s, st, pkt_buffer)) {
 
 1075             pts_buffer[0] = pkt_buffer->
pkt.
pts;
 
 1076             for (i = 0; i<delay && pts_buffer[i] > pts_buffer[i + 1]; i++)
 
 1077                 FFSWAP(int64_t, pts_buffer[i], pts_buffer[i + 1]);
 
 1087     AVStream *st       = s->
streams[stream_index];
 
 1106     for (pktl_it = pktl; pktl_it; pktl_it = 
get_next_pkt(s, st, pktl_it)) {
 
 1110             pktl_it->
pkt.
pts += shift;
 
 1113             pktl_it->
pkt.
dts += shift;
 
 1127         st->start_time = 
pts;
 
 1129             st->start_time += 
av_rescale_q(st->skip_samples, (
AVRational){1, st->codecpar->sample_rate}, st->time_base);
 
 1154             av_log(s, 
AV_LOG_DEBUG, 
"first_dts %s not matching first dts %s (pts %s, duration %"PRId64
") in the queue\n",
 
 1191                                int64_t next_dts, int64_t next_pts)
 
 1193     int num, den, presentation_delayed, delay, i;
 
 1208                        "DTS %"PRIi64
" < %"PRIi64
" out of order\n",
 
 1234     presentation_delayed = 0;
 
 1240         presentation_delayed = 1;
 
 1255     if (delay == 1 && pkt->
dts == pkt->
pts &&
 
 1258         if (    strcmp(s->
iformat->
name, 
"mov,mp4,m4a,3gp,3g2,mj2")
 
 1293         presentation_delayed = 1;
 
 1297             "IN delayed:%d pts:%s, dts:%s cur_dts:%s st:%d pc:%p duration:%"PRId64
" delay:%d onein_oneout:%d\n",
 
 1303     if ((delay == 0 || (delay == 1 && pc)) &&
 
 1305         if (presentation_delayed) {
 
 1323                 ((uint64_t)st->
cur_dts - (uint64_t)next_dts + 1) <= 2 &&
 
 1324                 next_dts != next_pts &&
 
 1326                 pkt->
pts = next_dts;
 
 1371 #if FF_API_CONVERGENCE_DURATION 
 1383         *pkt_buf = pktl->
next;
 
 1387     *pkt_buf_end = 
NULL;
 
 1398     AVStream *st = s->
streams[stream_index];
 
 1401     int ret = 0, got_output = 0;
 
 1412     while (size > 0 || (pkt == &
flush_pkt && got_output)) {
 
 1414         int64_t next_pts = pkt->
pts;
 
 1415         int64_t next_dts = pkt->
dts;
 
 1419                                &out_pkt.
data, &out_pkt.
size, data, size,
 
 1428         got_output = !!out_pkt.
size;
 
 1496     *pkt_buffer = pktl->
next;
 
 1498         *pkt_buffer_end = 
NULL;
 
 1510     int ret = 0, i, got_packet = 0;
 
 1540                 av_log(s, 
AV_LOG_DEBUG, 
"Demuxer context update while decoder is open, closing and trying to re-open\n");
 
 1555 #if FF_API_LAVF_AVCTX 
 1569             cur_pkt.
pts < cur_pkt.
dts) {
 
 1571                    "Invalid timestamps stream=%d, pts=%s, dts=%s, size=%d\n",
 
 1579                    "ff_read_packet stream=%d, pts=%s, dts=%s, size=%d, duration=%"PRId64
", flags=%d\n",
 
 1589                        "%s, packets or times may be invalid.\n",
 
 1640         int discard_padding = 0;
 
 1645             int64_t end_sample = sample + 
duration;
 
 1647                 sample < st->last_discard_sample)
 
 1656                 AV_WL32(p + 4, discard_padding);
 
 1676                 memcpy(dst_data, src_sd->
data, src_sd->
size);
 
 1681 #if FF_API_LAVF_MERGE_SD 
 1683         if (!(s->
flags & AVFMT_FLAG_KEEP_SIDE_DATA))
 
 1697 #if FF_API_LAVF_AVCTX 
 1703                "read_frame_internal stream=%d, pts=%s, dts=%s, " 
 1704                "size=%d, duration=%"PRId64
", flags=%d\n",
 
 1740                 int64_t last_dts = next_pkt->
dts;
 
 1751                             last_dts = pktl->
pkt.
dts;
 
 1779             if (pktl && ret != 
AVERROR(EAGAIN)) {
 
 1828     int best_stream = 0;
 
 1829     int best_score = INT_MIN;
 
 1853         if (score > best_score) {
 
 1913     AVStream *st             = s->
streams[stream_index];
 
 1925                        int *nb_index_entries,
 
 1926                        unsigned int *index_entries_allocated_size,
 
 1927                        int64_t pos, int64_t timestamp,
 
 1933     if ((
unsigned) *nb_index_entries + 1 >= UINT_MAX / 
sizeof(
AVIndexEntry))
 
 1946                               index_entries_allocated_size,
 
 1947                               (*nb_index_entries + 1) *
 
 1952     *index_entries = entries;
 
 1958         index = (*nb_index_entries)++;
 
 1959         ie    = &entries[
index];
 
 1960         av_assert0(index == 0 || ie[-1].timestamp < timestamp);
 
 1962         ie = &entries[
index];
 
 1966             memmove(entries + index + 1, entries + index,
 
 1968             (*nb_index_entries)++;
 
 1969         } 
else if (ie->
pos == pos && distance < ie->min_distance)
 
 1989                               timestamp, size, distance, flags);
 
 1993                               int64_t wanted_timestamp, 
int flags)
 
 2002     if (b && entries[b - 1].timestamp < wanted_timestamp)
 
 2011             if (m == b && entries[m].timestamp >= wanted_timestamp) {
 
 2018         if (timestamp >= wanted_timestamp)
 
 2020         if (timestamp <= wanted_timestamp)
 
 2026         while (m >= 0 && m < nb_entries &&
 
 2030     if (m == nb_entries)
 
 2038     int64_t pos_delta = 0;
 
 2045                "Protocol name not provided, cannot determine if input is local or " 
 2046                "a network protocol, buffers and access patterns cannot be configured " 
 2047                "optimally without knowing the protocol\n");
 
 2050     if (proto && !(strcmp(proto, 
"file") && strcmp(proto, 
"pipe") && strcmp(proto, 
"cache")))
 
 2053     for (ist1 = 0; ist1 < s->
nb_streams; ist1++) {
 
 2054         AVStream *st1 = s->
streams[ist1];
 
 2055         for (ist2 = 0; ist2 < s->
nb_streams; ist2++) {
 
 2056             AVStream *st2 = s->
streams[ist2];
 
 2070                     if (e2_pts - e1_pts < time_tolerance)
 
 2081     if (s->
pb->
buffer_size < pos_delta && pos_delta < (1<<24)) {
 
 2087     if (skip < (1<<23)) {
 
 2095                                      wanted_timestamp, flags);
 
 2099                                  int64_t (*read_timestamp)(
struct AVFormatContext *, 
int , int64_t *, int64_t ))
 
 2101     int64_t ts = read_timestamp(s, stream_index, ppos, pos_limit);
 
 2102     if (stream_index >= 0)
 
 2108                          int64_t target_ts, 
int flags)
 
 2112     int64_t ts_min, ts_max, ts;
 
 2117     if (stream_index < 0)
 
 2126     st = s->
streams[stream_index];
 
 2134         index = 
FFMAX(index, 0);
 
 2156                     " dts_max=%s\n", pos_max, pos_limit, 
av_ts2str(ts_max));
 
 2160     pos = 
ff_gen_search(s, stream_index, target_ts, pos_min, pos_max, pos_limit,
 
 2176                     int64_t (*read_timestamp)(
struct AVFormatContext *, 
int , int64_t *, int64_t ))
 
 2178     int64_t step = 1024;
 
 2179     int64_t limit, ts_max;
 
 2181     int64_t pos_max  = filesize - 1;
 
 2184         pos_max = 
FFMAX(0, (pos_max) - step);
 
 2186                                     &pos_max, limit, read_timestamp);
 
 2193         int64_t tmp_pos = pos_max + 1;
 
 2195                                             &tmp_pos, INT64_MAX, read_timestamp);
 
 2201         if (tmp_pos >= filesize)
 
 2214                       int64_t pos_min, int64_t pos_max, int64_t pos_limit,
 
 2215                       int64_t ts_min, int64_t ts_max,
 
 2216                       int flags, int64_t *ts_ret,
 
 2217                       int64_t (*read_timestamp)(
struct AVFormatContext *, 
int,
 
 2218                                                 int64_t *, int64_t))
 
 2229         ts_min  = 
ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp);
 
 2234     if (ts_min >= target_ts) {
 
 2240         if ((ret = 
ff_find_last_ts(s, stream_index, &ts_max, &pos_max, read_timestamp)) < 0)
 
 2242         pos_limit = pos_max;
 
 2245     if (ts_max <= target_ts) {
 
 2253     while (pos_min < pos_limit) {
 
 2255                 "pos_min=0x%"PRIx64
" pos_max=0x%"PRIx64
" dts_min=%s dts_max=%s\n",
 
 2259         if (no_change == 0) {
 
 2260             int64_t approximate_keyframe_distance = pos_max - pos_limit;
 
 2262             pos = 
av_rescale(target_ts - ts_min, pos_max - pos_min,
 
 2264                   pos_min - approximate_keyframe_distance;
 
 2265         } 
else if (no_change == 1) {
 
 2267             pos = (pos_min + pos_limit) >> 1;
 
 2275         else if (pos > pos_limit)
 
 2286                 " target:%s limit:%"PRId64
" start:%"PRId64
" noc:%d\n",
 
 2287                 pos_min, pos, pos_max,
 
 2289                 pos_limit, start_pos, no_change);
 
 2294         if (target_ts <= ts) {
 
 2295             pos_limit = start_pos - 1;
 
 2299         if (target_ts >= ts) {
 
 2309     ts_min  = 
ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp);
 
 2311     ts_max = 
ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp);
 
 2320                            int64_t pos, 
int flags)
 
 2322     int64_t pos_min, pos_max;
 
 2329     else if (pos > pos_max)
 
 2340                               int64_t timestamp, 
int flags)
 
 2347     st = s->
streams[stream_index];
 
 2351     if (index < 0 && st->nb_index_entries &&
 
 2352         timestamp < st->index_entries[0].timestamp)
 
 2355     if (index < 0 || index == st->nb_index_entries - 1) {
 
 2373             } 
while (read_status == 
AVERROR(EAGAIN));
 
 2374             if (read_status < 0)
 
 2382                     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);
 
 2407                                int64_t timestamp, 
int flags)
 
 2419     if (stream_index < 0) {
 
 2421         if (stream_index < 0)
 
 2424         st = s->
streams[stream_index];
 
 2451                   int64_t timestamp, 
int flags)
 
 2456         int64_t min_ts = INT64_MIN, max_ts = INT64_MAX;
 
 2462                                   flags & ~AVSEEK_FLAG_BACKWARD);
 
 2474                        int64_t ts, int64_t max_ts, 
int flags)
 
 2476     if (min_ts > ts || max_ts < ts)
 
 2478     if (stream_index < -1 || stream_index >= (
int)s->
nb_streams)
 
 2489         if (stream_index == -1 && s->
nb_streams == 1) {
 
 2496                                     time_base.
num * (int64_t)AV_TIME_BASE,
 
 2518         if (ret<0 && ts != min_ts && max_ts != ts) {
 
 2519             ret = 
av_seek_frame(s, stream_index, dir ? max_ts : min_ts, flags | dir);
 
 2565     int64_t 
start_time, start_time1, start_time_text, end_time, end_time1, end_time_text;
 
 2566     int64_t 
duration, duration1, filesize;
 
 2571     start_time = INT64_MAX;
 
 2572     start_time_text = INT64_MAX;
 
 2573     end_time   = INT64_MIN;
 
 2574     end_time_text   = INT64_MIN;
 
 2575     duration   = INT64_MIN;
 
 2582                 if (start_time1 < start_time_text)
 
 2583                     start_time_text = start_time1;
 
 2585                 start_time = 
FFMIN(start_time, start_time1);
 
 2589             if (end_time1 != 
AV_NOPTS_VALUE && (end_time1 > 0 ? start_time1 <= INT64_MAX - end_time1 : start_time1 >= INT64_MIN - end_time1)) {
 
 2590                 end_time1 += start_time1;
 
 2592                     end_time_text = 
FFMAX(end_time_text, end_time1);
 
 2594                     end_time = 
FFMAX(end_time, end_time1);
 
 2606             duration  = 
FFMAX(duration, duration1);
 
 2609     if (start_time == INT64_MAX || (start_time > start_time_text && start_time - start_time_text < 
AV_TIME_BASE))
 
 2610         start_time = start_time_text;
 
 2611     else if (start_time > start_time_text)
 
 2614     if (end_time == INT64_MIN || (end_time < end_time_text && end_time_text - end_time < AV_TIME_BASE)) {
 
 2615         end_time = end_time_text;
 
 2616     } 
else if (end_time < end_time_text) {
 
 2617         av_log(ic, 
AV_LOG_VERBOSE, 
"Ignoring outlier non primary stream endtime %f\n", end_time_text / (
float)AV_TIME_BASE);
 
 2620     if (start_time != INT64_MAX) {
 
 2622         if (end_time != INT64_MIN) {
 
 2631             } 
else if (end_time >= start_time && end_time - (uint64_t)start_time <= INT64_MAX) {
 
 2632                 duration = 
FFMAX(duration, end_time - start_time);
 
 2641         double bitrate = (double) filesize * 8.0 * AV_TIME_BASE /
 
 2643         if (bitrate >= 0 && bitrate <= INT64_MAX)
 
 2670     int i, show_warning = 0;
 
 2675         int64_t bit_rate = 0;
 
 2717                "Estimating duration from bitrate, this may be inaccurate\n");
 
 2720 #define DURATION_MAX_READ_SIZE 250000LL 
 2721 #define DURATION_MAX_RETRY 6 
 2728     int num, den, read_size, i, ret;
 
 2729     int found_duration = 0;
 
 2743                    "start time for stream %d is not set in estimate_timings_from_pts\n", i);
 
 2756         is_end = found_duration;
 
 2769             } 
while (ret == 
AVERROR(EAGAIN));
 
 2772             read_size += pkt->
size;
 
 2829                     av_log(ic, 
AV_LOG_DEBUG, 
"stream %d : no PTS found at end of file, duration not set\n", i);
 
 2831                     av_log(ic, 
AV_LOG_DEBUG, 
"stream %d : no TS found at start of file, duration not set\n", i);
 
 2859         file_size = 
FFMAX(0, file_size);
 
 2886                    (
double) st->start_time * 
av_q2d(st->time_base),
 
 2887                    (
double) st->duration   * 
av_q2d(st->time_base));
 
 2890                 "format: start_time: %0.3f duration: %0.3f bitrate=%"PRId64
" kb/s\n",
 
 2901 #define FAIL(errmsg) do {                                         \ 
 2903             *errmsg_ptr = errmsg;                                 \ 
 2909         FAIL(
"unknown codec");
 
 2913             FAIL(
"unspecified frame size");
 
 2916             FAIL(
"unspecified sample format");
 
 2918             FAIL(
"unspecified sample rate");
 
 2920             FAIL(
"unspecified number of channels");
 
 2922             FAIL(
"no decodable DTS frames");
 
 2926             FAIL(
"unspecified size");
 
 2928             FAIL(
"unspecified pixel format");
 
 2931                 FAIL(
"no frame in rv30/40 and no sar");
 
 2935             FAIL(
"unspecified size");
 
 2949     const AVCodec *codec;
 
 2950     int got_picture = 1, ret = 0;
 
 2954     int do_skip_frame = 0;
 
 2975         av_dict_set(options ? options : &thread_opt, 
"threads", 
"1", 0);
 
 2978         ret = 
avcodec_open2(avctx, codec, options ? options : &thread_opt);
 
 3000     while ((pkt.
size > 0 || (!pkt.
data && got_picture)) &&
 
 3020                                            &got_picture, &pkt);
 
 3031     if (!pkt.
data && !got_picture)
 
 3035     if (do_skip_frame) {
 
 3057         if (tag == tags[i].tag)
 
 3067     if (bps <= 0 || bps > 64)
 
 3082         if (sflags & (1 << (bps - 1))) {
 
 3126     for (i = 0; tags && tags[i]; i++) {
 
 3129             if (codec_tags->
id == 
id) {
 
 3130                 *tag = codec_tags->
tag;
 
 3142     for (i = 0; tags && tags[i]; i++) {
 
 3153     int64_t max_time = 0;
 
 3170                 if (j != i && next_start > ch->
start && next_start < end)
 
 3173             ch->
end = (end == INT64_MAX || end < ch->
start) ? ch->
start : end;
 
 3180         return (i + 1) * 1001;
 
 3184         return (i + 31) * 1001 * 12;
 
 3188         return ((
const int[]) { 80, 120, 240})[i] * 1001 * 12;
 
 3192     return ((
const int[]) { 24, 30, 60, 12, 15, 48 })[i] * 1000 * 12;
 
 3259        && ts - (uint64_t)last < INT64_MAX) {
 
 3273                 double sdts = dts*framerate/(1001*12);
 
 3274                 for (j= 0; j<2; j++) {
 
 3275                     int64_t ticks = 
llrint(sdts+j*0.5);
 
 3276                     double error= sdts - ticks + j*0.5;
 
 3293                     if (error0 > 0.04 && error1 > 0.04) {
 
 3316         AVStream *st = ic->
streams[i];
 
 3328             double best_error= 0.01;
 
 3343                 for (k= 0; k<2; k++) {
 
 3348                     if (error < best_error && best_error> 0.000000001) {
 
 3357             if (num && (!ref_rate.
num || (
double)num/(12*1001) < 1.01 * 
av_q2d(ref_rate)))
 
 3500     int i, 
count = 0, ret = 0, j;
 
 3510     int64_t max_stream_analyze_duration;
 
 3511     int64_t max_subtitle_analyze_duration;
 
 3513     int eof_reached = 0;
 
 3516     flush_codecs = probesize > 0;
 
 3520     max_stream_analyze_duration = max_analyze_duration;
 
 3521     max_subtitle_analyze_duration = max_analyze_duration;
 
 3522     if (!max_analyze_duration) {
 
 3523         max_stream_analyze_duration =
 
 3533         av_log(ic, 
AV_LOG_DEBUG, 
"Before avformat_find_stream_info() pos: %"PRId64
" bytes read:%"PRId64
" seeks:%d nb_streams:%d\n",
 
 3537         const AVCodec *codec;
 
 3551 #if FF_API_LAVF_AVCTX 
 3571                        "%s, packets or times may be invalid.\n",
 
 3581             goto find_stream_info_err;
 
 3589         av_dict_set(options ? &options[i] : &thread_opt, 
"threads", 
"1", 0);
 
 3596             && codec && !avctx->
codec) {
 
 3597             if (
avcodec_open2(avctx, codec, options ? &options[i] : &thread_opt) < 0)
 
 3599                        "Failed to open codec in %s\n",__FUNCTION__);
 
 3604             if (codec && !avctx->
codec)
 
 3605                 if (
avcodec_open2(avctx, codec, options ? &options[i] : &thread_opt) < 0)
 
 3607                            "Failed to open codec in %s\n",__FUNCTION__);
 
 3614 #if FF_API_R_FRAME_RATE 
 3623         int analyzed_all_streams;
 
 3632             int fps_analyze_framecount = 20;
 
 3641                 fps_analyze_framecount *= 2;
 
 3643                 fps_analyze_framecount = 0;
 
 3647                 fps_analyze_framecount = 0;
 
 3654                 if (count < fps_analyze_framecount)
 
 3669         analyzed_all_streams = 0;
 
 3670         if (!missing_streams || !*missing_streams)
 
 3672             analyzed_all_streams = 1;
 
 3684         if (read_size >= probesize) {
 
 3687                    "Probe buffer size limit of %"PRId64
" bytes reached\n", probesize);
 
 3694                            "Stream #%d: not enough frames to estimate rate; " 
 3695                            "consider increasing probesize\n", i);
 
 3717                 goto find_stream_info_err;
 
 3722             read_size += pkt->
size;
 
 3728                 goto find_stream_info_err;
 
 3737                        "Non-increasing DTS in stream %d: packet %d with DTS " 
 3738                        "%"PRId64
", packet %d with DTS %"PRId64
"\n",
 
 3754                        "DTS discontinuity in stream %d: packet %d with DTS " 
 3755                        "%"PRId64
", packet %d with DTS %"PRId64
"\n",
 
 3786             if (analyzed_all_streams)                                limit = max_analyze_duration;
 
 3788             else                                                     limit = max_stream_analyze_duration;
 
 3791                 av_log(ic, 
AV_LOG_VERBOSE, 
"max_analyze_duration %"PRId64
" reached at %"PRId64
" microseconds st:%d\n",
 
 3806 #if FF_API_R_FRAME_RATE 
 3813                 goto find_stream_info_err;
 
 3826                          (options && i < orig_nb_streams) ? &options[i] : 
NULL);
 
 3837         for (stream_index = 0; stream_index < ic->
nb_streams; stream_index++) {
 
 3838             st = ic->
streams[stream_index];
 
 3842                 if (codec && !avctx->
codec) {
 
 3846                     if (
avcodec_open2(avctx, codec, (options && stream_index < orig_nb_streams) ? &options[stream_index] : &opts) < 0)
 
 3848                                "Failed to open codec in %s\n",__FUNCTION__);
 
 3874                                             (options && i < orig_nb_streams)
 
 3875                                             ? &options[i] : 
NULL);
 
 3880                         "decoding for stream %d failed\n", st->
index);
 
 3903                 double best_error = 0.01;
 
 3921                     if (error < best_error) {
 
 3923                         best_fps   = std_fps.
num;
 
 3927                         error       = fabs(
av_q2d(codec_frame_rate) /
 
 3929                         if (error < best_error) {
 
 3931                             best_fps   = std_fps.
num;
 
 3937                               best_fps, 12 * 1001, INT_MAX);
 
 3999                 goto find_stream_info_err;
 
 4005                    "Could not find codec parameters for stream %d (%s): %s\n" 
 4006                    "Consider increasing the value for the 'analyzeduration' and 'probesize' options\n",
 
 4024                 goto find_stream_info_err;
 
 4032 #if FF_API_LAVF_AVCTX 
 4036             goto find_stream_info_err;
 
 4046         if (st->codec->codec_tag != 
MKTAG(
't',
'm',
'c',
'd')) {
 
 4054             if (!st->codec->subtitle_header)
 
 4055                 goto find_stream_info_err;
 
 4058                    st->codec->subtitle_header_size);
 
 4071 find_stream_info_err:
 
 4082         av_log(ic, 
AV_LOG_DEBUG, 
"After avformat_find_stream_info() pos: %"PRId64
" bytes read:%"PRId64
" seeks:%d frames:%d\n",
 
 4105                         int wanted_stream_nb, 
int related_stream,
 
 4106                         AVCodec **decoder_ret, 
int flags)
 
 4110     int best_count = -1, best_multiframe = -1, best_disposition = -1;
 
 4111     int count, multiframe, disposition;
 
 4112     int64_t best_bitrate = -1;
 
 4114     unsigned *program = 
NULL;
 
 4117     if (related_stream >= 0 && wanted_stream_nb < 0) {
 
 4125         int real_stream_index = program ? program[i] : i;
 
 4126         AVStream *st          = ic->
streams[real_stream_index];
 
 4130         if (wanted_stream_nb >= 0 && real_stream_index != wanted_stream_nb)
 
 4145         multiframe = 
FFMIN(5, count);
 
 4146         if ((best_disposition >  disposition) ||
 
 4147             (best_disposition == disposition && best_multiframe >  multiframe) ||
 
 4148             (best_disposition == disposition && best_multiframe == multiframe && best_bitrate >  bitrate) ||
 
 4149             (best_disposition == disposition && best_multiframe == multiframe && best_bitrate == bitrate && best_count >= count))
 
 4151         best_disposition = disposition;
 
 4153         best_bitrate = bitrate;
 
 4154         best_multiframe = multiframe;
 
 4155         ret          = real_stream_index;
 
 4157         if (program && i == nb_streams - 1 && ret < 0) {
 
 4165         *decoder_ret = (AVCodec*)best_decoder;
 
 4248     AVStream *st = *pst;
 
 4279 #if FF_API_LAVF_AVCTX 
 4375             av_log(s, 
AV_LOG_ERROR, 
"Number of streams exceeds max_streams parameter (%d), see the documentation if you wish to increase it\n", s->
max_streams);
 
 4392 #if FF_API_LAVF_AVCTX 
 4416 #if FF_API_LAVF_AVCTX 
 4419         st->codec->bit_rate = 0;
 
 4449 #if FF_API_R_FRAME_RATE 
 4495                               int64_t 
start, int64_t 
end, 
const char *title)
 
 4501         av_log(s, 
AV_LOG_ERROR, 
"Chapter end time %"PRId64
" before start %"PRId64
"\n", end, start);
 
 4560     char *q, buf1[20], 
c;
 
 4561     int nd, 
len, percentd_found;
 
 4574                     nd = nd * 10 + *p++ - 
'0';
 
 4587                 snprintf(buf1, 
sizeof(buf1), 
"%0*d", nd, number);
 
 4589                 if ((q - buf + len) > buf_size - 1)
 
 4591                 memcpy(q, buf1, len);
 
 4599             if ((q - buf) < buf_size - 1)
 
 4603     if (!percentd_found)
 
 4618                   char *authorization, 
int authorization_size,
 
 4619                   char *hostname, 
int hostname_size,
 
 4620                   int *port_ptr, 
char *path, 
int path_size, 
const char *url)
 
 4622     const char *p, *ls, *ls2, *at, *at2, *col, *brk;
 
 4628     if (authorization_size > 0)
 
 4629         authorization[0] = 0;
 
 4630     if (hostname_size > 0)
 
 4636     if ((p = strchr(url, 
':'))) {
 
 4650     ls = strchr(p, 
'/');
 
 4651     ls2 = strchr(p, 
'?');
 
 4655         ls = 
FFMIN(ls, ls2);
 
 4665         while ((at = strchr(p, 
'@')) && at < ls) {
 
 4667                        FFMIN(authorization_size, at + 1 - at2));
 
 4671         if (*p == 
'[' && (brk = strchr(p, 
']')) && brk < ls) {
 
 4674                        FFMIN(hostname_size, brk - p));
 
 4675             if (brk[1] == 
':' && port_ptr)
 
 4676                 *port_ptr = atoi(brk + 2);
 
 4677         } 
else if ((col = strchr(p, 
':')) && col < ls) {
 
 4679                        FFMIN(col + 1 - p, hostname_size));
 
 4681                 *port_ptr = atoi(col + 1);
 
 4684                        FFMIN(ls + 1 - p, hostname_size));
 
 4691     static const char hex_table_uc[16] = { 
'0', 
'1', 
'2', 
'3',
 
 4694                                            'C', 
'D', 
'E', 
'F' };
 
 4695     static const char hex_table_lc[16] = { 
'0', 
'1', 
'2', 
'3',
 
 4698                                            'c', 
'd', 
'e', 
'f' };
 
 4699     const char *hex_table = lowercase ? hex_table_lc : hex_table_uc;
 
 4701     for (i = 0; i < 
s; i++) {
 
 4702         buff[i * 2]     = hex_table[src[i] >> 4];
 
 4703         buff[i * 2 + 1] = hex_table[src[i] & 0xF];
 
 4720         if (c >= 
'0' && c <= 
'9')
 
 4722         else if (c >= 
'A' && c <= 
'F')
 
 4738                          unsigned int pts_num, 
unsigned int pts_den)
 
 4742         if (new_tb.
num != pts_num)
 
 4744                    "st:%d removing common factor %d from timebase\n",
 
 4748                "st:%d has too large timebase, reducing\n", s->
index);
 
 4750     if (new_tb.
num <= 0 || new_tb.
den <= 0) {
 
 4752                "Ignoring attempt to set invalid timebase %d/%d for st:%d\n",
 
 4758 #if FF_API_LAVF_AVCTX 
 4770     const char *ptr = str;
 
 4775         char *dest = 
NULL, *dest_end;
 
 4776         int key_len, dest_len = 0;
 
 4779         while (*ptr && (
av_isspace(*ptr) || *ptr == 
','))
 
 4786         if (!(ptr = strchr(key, 
'=')))
 
 4789         key_len = ptr - key;
 
 4791         callback_get_buf(context, key, key_len, &dest, &dest_len);
 
 4792         dest_end = dest + dest_len - 1;
 
 4796             while (*ptr && *ptr != 
'\"') {
 
 4800                     if (dest && dest < dest_end)
 
 4804                     if (dest && dest < dest_end)
 
 4812             for (; *ptr && !(
av_isspace(*ptr) || *ptr == 
','); ptr++)
 
 4813                 if (dest && dest < dest_end)
 
 4834         unsigned int codec_tag;
 
 4836             return ofmt->
query_codec(codec_id, std_compliance);
 
 4872                         uint64_t channel_layout, 
int32_t sample_rate,
 
 4884     if (channel_layout) {
 
 4892     if (width || height) {
 
 4899     bytestream_put_le32(&data, flags);
 
 4901         bytestream_put_le32(&data, channels);
 
 4903         bytestream_put_le64(&data, channel_layout);
 
 4905         bytestream_put_le32(&data, sample_rate);
 
 4906     if (width || height) {
 
 4907         bytestream_put_le32(&data, width);
 
 4908         bytestream_put_le32(&data, height);
 
 4920     av_reduce(&stream_sample_aspect_ratio.
num, &stream_sample_aspect_ratio.
den,
 
 4921                stream_sample_aspect_ratio.
num,  stream_sample_aspect_ratio.
den, INT_MAX);
 
 4922     if (stream_sample_aspect_ratio.
num <= 0 || stream_sample_aspect_ratio.
den <= 0)
 
 4923         stream_sample_aspect_ratio = undef;
 
 4925     av_reduce(&frame_sample_aspect_ratio.
num, &frame_sample_aspect_ratio.
den,
 
 4926                frame_sample_aspect_ratio.
num,  frame_sample_aspect_ratio.
den, INT_MAX);
 
 4927     if (frame_sample_aspect_ratio.
num <= 0 || frame_sample_aspect_ratio.
den <= 0)
 
 4928         frame_sample_aspect_ratio = undef;
 
 4930     if (stream_sample_aspect_ratio.
num)
 
 4931         return stream_sample_aspect_ratio;
 
 4933         return frame_sample_aspect_ratio;
 
 4942     if (avg_fr.
num > 0 && avg_fr.
den > 0 && fr.
num > 0 && fr.
den > 0 &&
 
 4949         if (   codec_fr.
num > 0 && codec_fr.
den > 0 &&
 
 4960     if (*spec <= '9' && *spec >= 
'0') 
 
 4961         return strtol(spec, 
NULL, 0) == st->
index;
 
 4962     else if (*spec == 
'v' || *spec == 
'a' || *spec == 
's' || *spec == 
'd' ||
 
 4963              *spec == 
't' || *spec == 
'V') { 
 
 4976 #if FF_API_LAVF_AVCTX 
 4988         if (*spec++ == 
':') { 
 
 4991 #if FF_API_LAVF_AVCTX 
 4994                       || s->
streams[i]->codec->codec_type == type
 
 4998                     return i == st->
index;
 
 5004                     return i == st->
index;
 
 5010     } 
else if (*spec == 
'p' && *(spec + 1) == 
':') {
 
 5014         prog_id = strtol(spec, &endptr, 0);
 
 5019             if (*endptr++ == 
':') {
 
 5020                 int stream_idx = strtol(endptr, 
NULL, 0);
 
 5021                 return stream_idx >= 0 &&
 
 5031     } 
else if (*spec == 
'#' ||
 
 5032                (*spec == 
'i' && *(spec + 1) == 
':')) {
 
 5035         spec += 1 + (*spec == 
'i');
 
 5036         stream_id = strtol(spec, &endptr, 0);
 
 5038             return stream_id == st->
id;
 
 5039     } 
else if (*spec == 
'm' && *(spec + 1) == 
':') {
 
 5045         val = strchr(spec, 
':');
 
 5053             if (!val || !strcmp(tag->
value, val + 1))
 
 5062     } 
else if (*spec == 
'u') {
 
 5064 #if FF_API_LAVF_AVCTX 
 5073 #if FF_API_LAVF_AVCTX 
 5074             val = val || (codec->sample_rate && codec->channels);
 
 5085 #if FF_API_LAVF_AVCTX 
 5086             val = val || (codec->width && codec->height);
 
 5102 #if FF_API_LAVF_AVCTX 
 5116     static const uint8_t avci100_1080p_extradata[] = {
 
 5118         0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
 
 5119         0xb6, 0xd4, 0x20, 0x22, 0x33, 0x19, 0xc6, 0x63,
 
 5120         0x23, 0x21, 0x01, 0x11, 0x98, 0xce, 0x33, 0x19,
 
 5121         0x18, 0x21, 0x02, 0x56, 0xb9, 0x3d, 0x7d, 0x7e,
 
 5122         0x4f, 0xe3, 0x3f, 0x11, 0xf1, 0x9e, 0x08, 0xb8,
 
 5123         0x8c, 0x54, 0x43, 0xc0, 0x78, 0x02, 0x27, 0xe2,
 
 5124         0x70, 0x1e, 0x30, 0x10, 0x10, 0x14, 0x00, 0x00,
 
 5125         0x03, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0xca,
 
 5126         0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 5128         0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x33, 0x48,
 
 5131     static const uint8_t avci100_1080i_extradata[] = {
 
 5133         0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
 
 5134         0xb6, 0xd4, 0x20, 0x22, 0x33, 0x19, 0xc6, 0x63,
 
 5135         0x23, 0x21, 0x01, 0x11, 0x98, 0xce, 0x33, 0x19,
 
 5136         0x18, 0x21, 0x03, 0x3a, 0x46, 0x65, 0x6a, 0x65,
 
 5137         0x24, 0xad, 0xe9, 0x12, 0x32, 0x14, 0x1a, 0x26,
 
 5138         0x34, 0xad, 0xa4, 0x41, 0x82, 0x23, 0x01, 0x50,
 
 5139         0x2b, 0x1a, 0x24, 0x69, 0x48, 0x30, 0x40, 0x2e,
 
 5140         0x11, 0x12, 0x08, 0xc6, 0x8c, 0x04, 0x41, 0x28,
 
 5141         0x4c, 0x34, 0xf0, 0x1e, 0x01, 0x13, 0xf2, 0xe0,
 
 5142         0x3c, 0x60, 0x20, 0x20, 0x28, 0x00, 0x00, 0x03,
 
 5143         0x00, 0x08, 0x00, 0x00, 0x03, 0x01, 0x94, 0x20,
 
 5145         0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x33, 0x48,
 
 5148     static const uint8_t avci50_1080p_extradata[] = {
 
 5150         0x00, 0x00, 0x00, 0x01, 0x67, 0x6e, 0x10, 0x28,
 
 5151         0xa6, 0xd4, 0x20, 0x32, 0x33, 0x0c, 0x71, 0x18,
 
 5152         0x88, 0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8c,
 
 5153         0x44, 0x30, 0x21, 0x02, 0x56, 0x4e, 0x6f, 0x37,
 
 5154         0xcd, 0xf9, 0xbf, 0x81, 0x6b, 0xf3, 0x7c, 0xde,
 
 5155         0x6e, 0x6c, 0xd3, 0x3c, 0x05, 0xa0, 0x22, 0x7e,
 
 5156         0x5f, 0xfc, 0x00, 0x0c, 0x00, 0x13, 0x8c, 0x04,
 
 5157         0x04, 0x05, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00,
 
 5158         0x00, 0x03, 0x00, 0x32, 0x84, 0x00, 0x00, 0x00,
 
 5160         0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x31, 0x12,
 
 5163     static const uint8_t avci50_1080i_extradata[] = {
 
 5165         0x00, 0x00, 0x00, 0x01, 0x67, 0x6e, 0x10, 0x28,
 
 5166         0xa6, 0xd4, 0x20, 0x32, 0x33, 0x0c, 0x71, 0x18,
 
 5167         0x88, 0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8c,
 
 5168         0x44, 0x30, 0x21, 0x02, 0x56, 0x4e, 0x6e, 0x61,
 
 5169         0x87, 0x3e, 0x73, 0x4d, 0x98, 0x0c, 0x03, 0x06,
 
 5170         0x9c, 0x0b, 0x73, 0xe6, 0xc0, 0xb5, 0x18, 0x63,
 
 5171         0x0d, 0x39, 0xe0, 0x5b, 0x02, 0xd4, 0xc6, 0x19,
 
 5172         0x1a, 0x79, 0x8c, 0x32, 0x34, 0x24, 0xf0, 0x16,
 
 5173         0x81, 0x13, 0xf7, 0xff, 0x80, 0x02, 0x00, 0x01,
 
 5174         0xf1, 0x80, 0x80, 0x80, 0xa0, 0x00, 0x00, 0x03,
 
 5175         0x00, 0x20, 0x00, 0x00, 0x06, 0x50, 0x80, 0x00,
 
 5177         0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x31, 0x12,
 
 5180     static const uint8_t avci100_720p_extradata[] = {
 
 5182         0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
 
 5183         0xb6, 0xd4, 0x20, 0x2a, 0x33, 0x1d, 0xc7, 0x62,
 
 5184         0xa1, 0x08, 0x40, 0x54, 0x66, 0x3b, 0x8e, 0xc5,
 
 5185         0x42, 0x02, 0x10, 0x25, 0x64, 0x2c, 0x89, 0xe8,
 
 5186         0x85, 0xe4, 0x21, 0x4b, 0x90, 0x83, 0x06, 0x95,
 
 5187         0xd1, 0x06, 0x46, 0x97, 0x20, 0xc8, 0xd7, 0x43,
 
 5188         0x08, 0x11, 0xc2, 0x1e, 0x4c, 0x91, 0x0f, 0x01,
 
 5189         0x40, 0x16, 0xec, 0x07, 0x8c, 0x04, 0x04, 0x05,
 
 5190         0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x03,
 
 5191         0x00, 0x64, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 5193         0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x31, 0x12,
 
 5196     static const uint8_t avci50_720p_extradata[] = {
 
 5198         0x00, 0x00, 0x00, 0x01, 0x67, 0x6e, 0x10, 0x20,
 
 5199         0xa6, 0xd4, 0x20, 0x32, 0x33, 0x0c, 0x71, 0x18,
 
 5200         0x88, 0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8c,
 
 5201         0x44, 0x30, 0x21, 0x02, 0x56, 0x4e, 0x6f, 0x37,
 
 5202         0xcd, 0xf9, 0xbf, 0x81, 0x6b, 0xf3, 0x7c, 0xde,
 
 5203         0x6e, 0x6c, 0xd3, 0x3c, 0x0f, 0x01, 0x6e, 0xff,
 
 5204         0xc0, 0x00, 0xc0, 0x01, 0x38, 0xc0, 0x40, 0x40,
 
 5205         0x50, 0x00, 0x00, 0x03, 0x00, 0x10, 0x00, 0x00,
 
 5206         0x06, 0x48, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 5208         0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x31, 0x12,
 
 5217             data = avci100_1080p_extradata;
 
 5218             size = 
sizeof(avci100_1080p_extradata);
 
 5220             data = avci100_1080i_extradata;
 
 5221             size = 
sizeof(avci100_1080i_extradata);
 
 5225             data = avci50_1080p_extradata;
 
 5226             size = 
sizeof(avci50_1080p_extradata);
 
 5228             data = avci50_1080i_extradata;
 
 5229             size = 
sizeof(avci50_1080i_extradata);
 
 5232         data = avci100_720p_extradata;
 
 5233         size = 
sizeof(avci100_720p_extradata);
 
 5235         data = avci50_720p_extradata;
 
 5236         size = 
sizeof(avci50_720p_extradata);
 
 5250 #if FF_API_NOCONST_GET_SIDE_DATA 
 5279         if (sd->
type == type) {
 
 5354         const char * shorthand[2] = {
NULL};
 
 5357             shorthand[0] = opt->
name;
 
 5376            "Automatically inserted bitstream filter '%s'; args='%s'\n",
 
 5377            name, args ? args : 
"");
 
 5395             memset(pkt, 0, 
sizeof(*pkt));
 
 5398         if(a == 0 && new_pkt.
data != pkt->
data) {
 
 5401                 memcpy(t, new_pkt.
data, new_pkt.
size);
 
 5424                    "Failed to open bitstream filter %s for stream %d with codec %s",
 
 5459     int64_t parsed_timestamp;
 
 5463             *timestamp = return_seconds ? parsed_timestamp / 1000000 : parsed_timestamp;
 
 5531                                                   AVStream *ost, 
const AVStream *ist,
 
 5544     if (!strcmp(ofmt->
name, 
"avi")) {
 
 5545 #if FF_API_R_FRAME_RATE 
 5551             || copy_tb == AVFMT_TBCF_R_FRAMERATE) {
 
 5595 #if FF_API_LAVF_AVCTX 
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. 
int64_t probesize
Maximum size of the data read from input for determining the input container format. 
int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDictionary **out_val)
void av_bsf_free(AVBSFContext **ctx)
Free a bitstream filter context and everything associated with it; write NULL into the supplied point...
int64_t first_dts
Timestamp corresponding to the last dts sync point. 
const struct AVCodec * codec
const char const char void * val
#define AV_CODEC_PROP_INTRA_ONLY
Codec uses only intra compression. 
enum AVFieldOrder field_order
Video only. 
#define AVERROR_INVALIDDATA
Invalid data found when processing input. 
const AVClass * priv_class
A class for the private data, used to declare bitstream filter private AVOptions. ...
int64_t avio_size(AVIOContext *s)
Get the filesize. 
AVCodecParameters * par_out
Parameters of the output stream. 
static int shift(int a, int b)
AVRational av_div_q(AVRational b, AVRational c)
Divide one rational by another. 
static av_const int av_isdigit(int c)
Locale-independent conversion of ASCII isdigit. 
int av_demuxer_open(AVFormatContext *ic)
char * recommended_encoder_configuration
String containing paris of key and values describing recommended encoder configuration. 
This structure describes decoded (raw) audio or video data. 
AVIOInterruptCB interrupt_callback
Custom interrupt callbacks for the I/O layer. 
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory. 
ptrdiff_t const GLvoid * data
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. 
int coded_width
Bitstream width / height, may be different from width/height e.g. 
enum AVDurationEstimationMethod duration_estimation_method
The duration field can be estimated through various ways, and this field can be used to know how the ...
int64_t start_skip_samples
If not 0, the number of samples that should be skipped from the start of the stream (the samples are ...
#define AV_LOG_WARNING
Something somehow does not look correct. 
int64_t bit_rate
the average bitrate 
int64_t pos
byte position in stream, -1 if unknown 
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding. 
int64_t pts_buffer[MAX_REORDER_DELAY+1]
int av_parse_time(int64_t *timeval, const char *timestr, int duration)
Parse timestr and return in *time a corresponding number of microseconds. 
int probe_packets
Number of packets to buffer for codec probing. 
AVRational sample_aspect_ratio
Video only. 
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...
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values. 
int64_t first_discard_sample
If not 0, the first audio sample that should be discarded from the stream. 
attribute_deprecated int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int keyframe)
Filter bitstream. 
enum AVCodecID codec_id
Specific type of the encoded data (the codec used). 
const struct AVBitStreamFilter * filter
The bitstream filter this context is an instance of. 
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)
The bitstream filter state. 
int index
stream index in AVFormatContext 
#define ID3v2_DEFAULT_MAGIC
Default magic bytes for ID3v2 header: "ID3". 
int avio_flags
avio flags, used to force AVIO_FLAG_DIRECT. 
#define AV_EF_COMPLIANT
consider all spec non compliances as errors 
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext. 
#define AVIO_FLAG_READ
read-only 
AVIndexEntry * index_entries
Only used if the format does not support seeking natively. 
static av_const int av_isspace(int c)
Locale-independent conversion of ASCII isspace. 
AVFormatInternal * internal
An opaque field for libavformat internal usage. 
const AVBitStreamFilter * av_bsf_get_by_name(const char *name)
#define AVIO_FLAG_WRITE
write-only 
int64_t bit_rate
Total stream bitrate in bit/s, 0 if not available. 
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx. 
void ff_network_close(void)
int event_flags
Flags for the user to detect events happening on the file. 
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another. 
int avpriv_codec_get_cap_skip_frame_fill_param(const AVCodec *codec)
#define AV_CODEC_CAP_EXPERIMENTAL
Codec is experimental and is thus avoided in favor of non experimental encoders. 
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward. 
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container. 
AVInputFormat * av_probe_input_format3(AVProbeData *pd, int is_opened, int *score_ret)
Guess the file format. 
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
int duration
Duration of the current frame. 
AVPacketSideData * side_data
An array of side data that applies to the whole stream (i.e. 
int ctx_flags
Flags signalling stream properties. 
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt)
Decode a subtitle message. 
int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, int search_flags)
int64_t maxsize
max filesize, used to limit allocations This field is internal to libavformat and access from outside...
void * priv_data
Opaque filter-specific private data. 
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. 
This struct describes the properties of an encoded stream. 
int av_bsf_init(AVBSFContext *ctx)
Prepare the filter for use, after all the parameters and options have been set. 
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer. 
int64_t last_dts_for_order_check
Internal data to analyze DTS and detect faulty mpeg streams. 
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
int av_codec_is_decoder(const AVCodec *codec)
enum AVAudioServiceType audio_service_type
Type of service that the audio stream conveys. 
enum AVDiscard skip_frame
Skip decoding for selected frames. 
int avpriv_h264_has_num_reorder_frames(AVCodecContext *avctx)
AVRational av_guess_frame_rate(AVFormatContext *format, AVStream *st, AVFrame *frame)
Guess the frame rate, based on both the container and codec information. 
unsigned int nb_stream_indexes
int ff_network_inited_globally
int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **ctx)
Allocate a context for a given bitstream filter. 
int av_opt_set_from_string(void *ctx, const char *opts, const char *const *shorthand, const char *key_val_sep, const char *pairs_sep)
Parse the key-value pairs list in opts. 
#define av_assert0(cond)
assert() equivalent, that is always enabled. 
int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp)
Set a dictionary value to an ISO-8601 compliant timestamp string. 
int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt)
Retrieve a filtered packet. 
static int64_t start_time
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first. 
enum AVSampleFormat sample_fmt
audio sample format 
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values. 
Opaque data information usually continuous. 
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code. 
int ff_network_init(void)
attribute_deprecated int av_packet_merge_side_data(AVPacket *pkt)
int ff_id3v2_parse_chapters(AVFormatContext *s, ID3v2ExtraMeta **extra_meta)
Create chapters for all CHAP tags found in the ID3v2 header. 
AVCodecParameters * avcodec_parameters_alloc(void)
Allocate a new AVCodecParameters and set its fields to default values (unknown/invalid/0). 
timestamp utils, mostly useful for debugging/logging purposes 
unsigned avformat_version(void)
Return the LIBAVFORMAT_VERSION_INT constant. 
const char * avformat_license(void)
Return the libavformat license. 
int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt, AVStream *ost, const AVStream *ist, enum AVTimebaseSource copy_tb)
Transfer internal timing information from one stream to another. 
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. 
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development. 
static av_cold int end(AVCodecContext *avctx)
int id
unique ID to identify the chapter 
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown. 
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(constuint8_t *) pi-0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(constint16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(constint32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(constint64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0f/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(constfloat *) pi *(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(constdouble *) pi *(INT64_C(1)<< 63)))#defineFMT_PAIR_FUNC(out, in) staticconv_func_type *constfmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64),};staticvoidcpy1(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, len);}staticvoidcpy2(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 2 *len);}staticvoidcpy4(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 4 *len);}staticvoidcpy8(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 8 *len);}AudioConvert *swri_audio_convert_alloc(enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, constint *ch_map, intflags){AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) returnNULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) returnNULL;if(channels==1){in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);}ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map){switch(av_get_bytes_per_sample(in_fmt)){case1:ctx->simd_f=cpy1;break;case2:ctx->simd_f=cpy2;break;case4:ctx->simd_f=cpy4;break;case8:ctx->simd_f=cpy8;break;}}if(HAVE_X86ASM &&1) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);if(ARCH_ARM) swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);if(ARCH_AARCH64) swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);returnctx;}voidswri_audio_convert_free(AudioConvert **ctx){av_freep(ctx);}intswri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, intlen){intch;intoff=0;constintos=(out->planar?1:out->ch_count)*out->bps;unsignedmisaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask){intplanes=in->planar?in->ch_count:1;unsignedm=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;}if(ctx->out_simd_align_mask){intplanes=out->planar?out->ch_count:1;unsignedm=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;}if(ctx->simd_f &&!ctx->ch_map &&!misaligned){off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){if(out->planar==in->planar){intplanes=out->planar?out->ch_count:1;for(ch=0;ch< planes;ch++){ctx->simd_f(out-> ch ch
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. 
int nb_side_data
The number of elements in the AVStream.side_data array. 
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. 
uint8_t * av_stream_get_side_data(const AVStream *st, enum AVPacketSideDataType type, int *size)
Get side information from stream. 
AVStream ** streams
A list of all streams in the file. 
int avcodec_parameters_to_context(AVCodecContext *codec, const AVCodecParameters *par)
Fill the codec context based on the values from the supplied codec parameters. 
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext. 
int inject_global_side_data
Internal data to inject global side data. 
const char * avformat_configuration(void)
Return the libavformat build-time configuration. 
int64_t bytes_read
Bytes read statistic This field is internal to libavformat and access from outside is not allowed...
void av_codec_set_lowres(AVCodecContext *avctx, int val)
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key. 
int flags
Flags modifying the (de)muxer behaviour. 
static double av_q2d(AVRational a)
Convert an AVRational to a double. 
struct AVStreamInternal::@212 extract_extradata
AVProgram * av_new_program(AVFormatContext *ac, int id)
char * protocol_whitelist
',' separated list of allowed protocols. 
int avformat_network_init(void)
Do global initialization of network components. 
int fps_probe_size
The number of frames used for determining the framerate in avformat_find_stream_info(). 
#define AVERROR_EOF
End of file. 
#define AV_LOG_VERBOSE
Detailed information. 
int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem)
Add an element to a dynamic array. 
int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt, const char *url, void *logctx, unsigned int offset, unsigned int max_probe_size)
Probe a bytestream to determine the input format. 
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext. 
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction. 
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv). 
enum AVDiscard discard
selects which program to discard and which to feed to the caller 
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
const OptionDef options[]
struct AVBitStreamFilterContext * next
unsigned int * stream_index
enum AVCodecID video_codec_id
Forced video codec_id. 
uint64_t channel_layout
Audio only. 
int64_t rfps_duration_sum
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf. 
unsigned int correct_ts_overflow
Correct single timestamp overflows. 
struct AVOutputFormat * oformat
The output container format. 
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet. 
int64_t bit_rate
The average bitrate of the encoded data (in bits per second). 
#define AV_PKT_FLAG_KEY
The packet contains a keyframe. 
void av_buffer_default_free(void *opaque, uint8_t *data)
Default free callback, which calls av_free() on the buffer data. 
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers. 
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. 
av_cold int avcodec_close(AVCodecContext *avctx)
Close a given AVCodecContext and free all the data associated with it (but not the AVCodecContext its...
AVRational av_stream_get_codec_timebase(const AVStream *st)
Get the internal codec timebase from a stream. 
int avctx_inited
1 if avctx has been initialized with the values from the codec parameters 
AVProgram * av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s)
Find the programs which belong to a given stream. 
int max_ts_probe
Maximum number of packets to read while waiting for the first timestamp. 
int format_probesize
number of bytes to read maximally to identify format. 
AVCodecID
Identify the syntax and semantics of the bitstream. 
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src)
Copy the contents of src to dst. 
#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. 
AVDictionary * metadata
Metadata that applies to the whole file. 
An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE bytes worth of palette...
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. 
void * av_opt_ptr(const AVClass *class, void *obj, const char *name)
Gets a pointer to the requested field in a struct. 
int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp, int flags)
Get the index for a specific timestamp. 
#define MAKE_ACCESSORS(str, name, type, field)
int64_t pts_wrap_reference
reference dts for wrap detection 
An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows: 
int ffio_set_buf_size(AVIOContext *s, int buf_size)
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet. 
enum AVCodecID * codec_ids
A list of codec ids supported by the filter, terminated by AV_CODEC_ID_NONE. 
unsigned int avpriv_toupper4(unsigned int x)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g. 
int64_t timestamp
Timestamp in AVStream.time_base units, preferably the time from which on correctly decoded frames are...
AVCodec * av_codec_next(const AVCodec *c)
If c is NULL, returns the first registered codec, if c is non-NULL, returns the next registered codec...
int avio_close(AVIOContext *s)
Close the resource accessed by the AVIOContext s and free it. 
int avcodec_is_open(AVCodecContext *s)
int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Return decoded output data from a decoder. 
int av_match_list(const char *name, const char *list, char separator)
Check if a name is in a list. 
int capabilities
Codec capabilities. 
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers. 
int av_read_play(AVFormatContext *s)
Start playing a network-based stream (e.g. 
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
preferred ID for decoding MPEG audio layer 1, 2 or 3 
enum AVMediaType codec_type
General type of the encoded data. 
AVBufferRef * buf
A reference to the reference-counted buffer where the packet data is stored. 
void ff_id3v2_free_extra_meta(ID3v2ExtraMeta **extra_meta)
Free memory allocated parsing special (non-text) metadata. 
Round to nearest and halfway cases away from zero. 
AVRational time_base_in
The timebase used for the timestamps of the input packets. 
simple assert() macros that are a bit more flexible than ISO C assert(). 
int64_t av_gcd(int64_t a, int64_t b)
Compute the greatest common divisor of two integer operands. 
const AVOption * av_opt_next(const void *obj, const AVOption *last)
Iterate over all AVOptions belonging to obj. 
const char * protocol_whitelist
',' separated list of allowed protocols. 
enum AVPacketSideDataType type
const char * name
Name of the codec implementation. 
int av_match_name(const char *name, const char *names)
Match instances of a name in a comma-separated list of names. 
AVBufferRef * av_buffer_create(uint8_t *data, int size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags)
Create an AVBuffer from an existing array. 
#define AV_FRAME_FILENAME_FLAGS_MULTIPLE
Allow multiple d. 
int skip_samples
Number of samples to skip at the start of the frame decoded from the next packet. ...
static const uint8_t offset[127][2]
void * av_memdup(const void *p, size_t size)
Duplicate a buffer with av_malloc(). 
AVRational avg_frame_rate
Average framerate. 
New fields can be added to the end with minor version bumps. 
void avcodec_parameters_free(AVCodecParameters **ppar)
Free an AVCodecParameters instance and everything associated with it and write NULL to the supplied p...
int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes)
This function is the same as av_get_audio_frame_duration(), except it works with AVCodecParameters in...
static void * av_mallocz_array(size_t nmemb, size_t size)
AVInputFormat * av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max)
Guess the file format. 
int min_distance
Minimum distance between this and the previous keyframe, used to avoid unneeded searching. 
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. 
const char * protocol_blacklist
',' separated list of disallowed protocols. 
AVCodec * audio_codec
Forced audio codec. 
int flags
A combination of AV_PKT_FLAG values. 
int av_codec_get_lowres(const AVCodecContext *avctx)
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
uint64_t channel_layout
Audio channel layout. 
int extradata_size
Size of the extradata content in bytes. 
int seek_count
seek statistic This field is internal to libavformat and access from outside is not allowed...
char * format_whitelist
',' separated list of allowed demuxers. 
static AVPacket flush_pkt
int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance)
Test if the given container can store a codec. 
static float distance(float x, float y, int band)
int props
Codec properties, a combination of AV_CODEC_PROP_* flags. 
int buf_size
Size of buf except extra allocated bytes. 
struct AVStream::@197 * info
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero. 
common internal API header 
unsigned int nb_streams
Number of elements in AVFormatContext.streams. 
AVBSFContext ** bsfcs
bitstream filters to run on stream 
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. 
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable. 
char filename[1024]
input or output filename 
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code. 
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest. 
int update_initial_durations_done
Internal data to prevent doing update_initial_durations() twice. 
#define AV_TIME_BASE
Internal time base represented as integer. 
enum AVCodecID audio_codec_id
Forced audio codec_id. 
int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type, uint8_t *data, size_t size)
Wrap an existing array as stream side data. 
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values. 
#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 max_streams
The maximum number of streams. 
int width
picture width / height. 
int64_t offset
byte offset from starting packet start 
AVRational time_base_out
The timebase used for the timestamps of the output packets. 
int av_find_default_stream_index(AVFormatContext *s)
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
Submit a packet for filtering. 
internal header for RIFF based (de)muxers do NOT include this in end user applications ...
void av_parser_close(AVCodecParserContext *s)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given buffer if it is not large enough, otherwise do nothing. 
#define AVERROR_BSF_NOT_FOUND
Bitstream filter not found. 
#define AV_EF_EXPLODE
abort decoding on minor error detection 
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated). 
uint8_t * av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type, int size)
Allocate new information from stream. 
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. 
Usually treated as AVMEDIA_TYPE_DATA. 
Opaque data information usually sparse. 
int64_t skip_initial_bytes
Skip initial bytes when opening stream. 
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted. 
enum AVPixelFormat avpriv_find_pix_fmt(const PixelFormatTag *tags, unsigned int fourcc)
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. 
int buffer_size
Maximum buffer size. 
preferred ID for MPEG-1/2 video decoding 
static void error(const char *err)
int64_t max_analyze_duration
Maximum duration (in AV_TIME_BASE units) of the data read from input in avformat_find_stream_info(). 
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec. 
int av_get_frame_filename(char *buf, int buf_size, const char *path, int number)
uint8_t pts_reorder_error_count[MAX_REORDER_DELAY+1]
int64_t av_gettime(void)
Get the current time in microseconds. 
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome. 
int64_t end
chapter start/end time in time_base units 
int avformat_queue_attached_pictures(AVFormatContext *s)
int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt)
Supply raw packet data as input to a decoder. 
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. 
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file. 
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
#define AV_LOG_INFO
Standard information. 
int64_t pts_reorder_error[MAX_REORDER_DELAY+1]
Internal data to generate dts from pts. 
AVCodecParserContext * av_parser_init(int codec_id)
char * av_strdup(const char *s)
Duplicate a string. 
AVStreamInternal * internal
An opaque field for libavformat internal usage. 
enum AVMediaType codec_type
int ff_check_interrupt(AVIOInterruptCB *cb)
Check if the user has requested to interrupt a blocking function associated with cb. 
int debug
Flags to enable debugging. 
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer...
#define AV_TIME_BASE_Q
Internal time base represented as fractional value. 
int av_opt_set_dict(void *obj, AVDictionary **options)
Set all the options from a given dictionary on an object. 
int sample_rate
samples per second 
AVIOContext * pb
I/O context. 
main external API structure. 
AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID. 
void av_packet_unref(AVPacket *pkt)
Wipe the packet. 
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 av_get_frame_filename2(char *buf, int buf_size, const char *path, int number, int flags)
Return in 'buf' the path with 'd' replaced by a number. 
int pts_wrap_behavior
behavior on wrap detection 
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. 
static const char * format
Describe the class of an AVClass context structure. 
static av_const int av_toupper(int c)
Locale-independent conversion of ASCII characters to uppercase. 
Rational number (pair of numerator and denominator). 
int avcodec_parameters_from_context(AVCodecParameters *par, const AVCodecContext *codec)
Fill the parameters struct based on the values from the supplied codec context. 
AVRational display_aspect_ratio
display aspect ratio (0 if unknown) 
Recommmends skipping the specified number of samples. 
int need_context_update
Whether the internal avctx needs to be updated from codecpar (after a late change to codecpar) ...
const AVClass * av_class
A class for logging and AVOptions. 
int short_seek_threshold
Threshold to favor readahead over seek. 
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec. 
int found_decoder
0 -> decoder has not been searched for yet. 
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 avio_pause(AVIOContext *h, int pause)
Pause and resume playing - only meaningful if using a network streaming protocol (e.g. 
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. 
attribute_deprecated int64_t convergence_duration
This struct describes the properties of a single codec described by an AVCodecID. ...
int seek2any
Force seeking to any (also non key) frames. 
const char * avio_find_protocol_name(const char *url)
Return the name of the protocol that will handle the passed URL. 
int64_t codec_info_duration
static int64_t pts
Global timestamp for the audio frames. 
AVCodec * avcodec_find_decoder_by_name(const char *name)
Find a registered decoder with the specified name. 
int64_t start_time
Position of the first frame of the component, in AV_TIME_BASE fractional seconds. ...
int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Seek to the keyframe at timestamp. 
int64_t duration
Decoding: duration of the stream, in stream time base. 
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational. 
int sample_rate
Audio only. 
AVPacketSideData * side_data
Additional packet data that can be provided by the container. 
attribute_deprecated int64_t convergence_duration
void av_opt_free(void *obj)
Free all allocated objects in obj. 
#define FF_DISABLE_DEPRECATION_WARNINGS
common internal api header. 
struct AVPacketList * next
static int ref[MAX_W *MAX_W]
int pts_wrap_behavior
Options for behavior, when a wrap is detected. 
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...
int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc)
Add a value to a timestamp. 
AVCodec * video_codec
Forced video codec. 
int error_recognition
Error recognition; higher values will detect more errors but may misdetect some more or less valid pa...
static AVCodecContext * dec_ctx
int disposition
AV_DISPOSITION_* bit field. 
enum AVCodecID orig_codec_id
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 
#define PARSER_FLAG_COMPLETE_FRAMES
int av_grow_packet(AVPacket *pkt, int grow_by)
Increase packet size, correctly zeroing padding. 
unsigned properties
Properties of the stream that gets decoded. 
void av_init_packet(AVPacket *pkt)
Initialize optional fields of a packet with default values. 
int64_t nb_frames
number of frames in this stream if known or 0 
#define AV_PKT_FLAG_CORRUPT
The packet content is corrupted. 
struct AVInputFormat * iformat
The input container format. 
void avformat_close_input(AVFormatContext **ps)
Close an opened input AVFormatContext. 
int64_t codec_info_duration_fields
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
Flag telling rescaling functions to pass INT64_MIN/MAX through unchanged, avoiding special cases for ...
unsigned int index_entries_allocated_size
#define AVERROR_DECODER_NOT_FOUND
Decoder not found. 
int skip_to_keyframe
Indicates that everything up to the next keyframe should be discarded. 
static av_always_inline int diff(const uint32_t a, const uint32_t b)
enum AVCodecID data_codec_id
Forced Data codec_id. 
void ff_id3v2_read_dict(AVIOContext *pb, AVDictionary **metadata, const char *magic, ID3v2ExtraMeta **extra_meta)
Read an ID3v2 tag into specified dictionary and retrieve supported extra metadata. 
AVCodec * subtitle_codec
Forced subtitle codec. 
#define FF_ENABLE_DEPRECATION_WARNINGS
#define av_ts2str(ts)
Convenience macro, the return value should be used only directly in function arguments but never stan...
int channels
number of audio channels 
char * codec_whitelist
',' separated list of allowed decoders. 
struct AVCodecParserContext * parser
void * priv_data
Format private data. 
int codec_info_nb_frames
Number of frames that have been demuxed during avformat_find_stream_info() 
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values. 
const struct PixelFormatTag * avpriv_get_raw_pix_fmt_tags(void)
#define AV_CODEC_CAP_AVOID_PROBING
Decoder is not a preferred choice for probing. 
#define AVERROR_STREAM_NOT_FOUND
Stream not found. 
int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header. 
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent. 
AVCodecContext * avctx
The codec context used by avformat_find_stream_info, the parser, etc. 
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
const struct AVBitStreamFilter * filter
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals. 
char * protocol_blacklist
',' separated list of disallowed protocols. 
int repeat_pict
This field is used for proper frame duration computation in lavf. 
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds. 
int avformat_flush(AVFormatContext *s)
Discard all internally buffered data. 
unbuffered private I/O API 
AVCodecParameters * codecpar
int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq, enum AVRounding rnd)
Rescale a 64-bit integer by 2 rational numbers with specified rounding. 
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC). 
#define FFSWAP(type, a, b)
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int size)
Allocate new information of a packet. 
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
#define MKTAG(a, b, c, d)
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. 
int(* io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, AVDictionary **options)
int request_probe
stream probing state -1 -> probing finished 0 -> no probing requested rest -> perform probing with re...
int use_wallclock_as_timestamps
forces the use of wallclock timestamps as pts/dts of packets This has undefined results in the presen...
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
This structure stores compressed data. 
int avio_closep(AVIOContext **s)
Close the resource accessed by the AVIOContext *s, free it and set the pointer pointing to it to NULL...
AVCodecParameters * par_in
Parameters of the input stream. 
int key_frame
Set by parser to 1 for key frames and 0 for non-key frames. 
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
void(* io_close)(struct AVFormatContext *s, AVIOContext *pb)
A callback for closing the streams opened with AVFormatContext.io_open(). 
char * av_strndup(const char *s, size_t len)
Duplicate a substring of a string. 
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...
#define AV_NOPTS_VALUE
Undefined timestamp value. 
#define PARSER_FLAG_USE_CODEC_TS
int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod)
Compare the remainders of two integer operands divided by a common divisor. 
uint8_t * subtitle_header
Header containing style information for text subtitles.