51 #include "libavutil/ffversion.h"
69 return FFMPEG_CONFIGURATION;
74 #define LICENSE_PREFIX "libavformat license: "
88 #define RELATIVE_TS_BASE (INT64_MAX - (1LL<<48))
106 timestamp < st->pts_wrap_reference)
115 #if FF_API_FORMAT_GET_SET
117 #if FF_API_LAVF_FFSERVER
129 #if FF_API_OLD_OPEN_CALLBACKS
152 s->internal->inject_global_side_data = 1;
153 for (
i = 0;
i <
s->nb_streams;
i++) {
165 dst-> codec_whitelist =
av_strdup(
src->codec_whitelist);
169 if ( (
src-> codec_whitelist && !dst-> codec_whitelist)
170 || (
src-> format_whitelist && !dst-> format_whitelist)
181 #if FF_API_LAVF_AVCTX
183 if (st->codec->codec)
184 return st->codec->codec;
190 if (
s->video_codec)
return s->video_codec;
193 if (
s->audio_codec)
return s->audio_codec;
196 if (
s->subtitle_codec)
return s->subtitle_codec;
207 #if CONFIG_H264_DECODER
233 #if FF_API_FORMAT_GET_SET
236 return s->probe_score;
241 #define SANE_CHUNK_SIZE (50000000)
245 if (
s->maxsize>= 0) {
247 int64_t remaining=
s->maxsize -
pos;
248 if (remaining <
size) {
250 if (!
s->maxsize ||
s->maxsize<newsize)
251 s->maxsize = newsize - !newsize;
252 if (
pos >
s->maxsize &&
s->maxsize >= 0)
255 remaining =
s->maxsize -
pos;
258 if (
s->maxsize>= 0 && remaining+1 <
size) {
292 if (
ret != read_size) {
334 static const struct {
362 "Probe with size=%d, packets=%d detected %s with score=%d\n",
365 for (
i = 0; fmt_id_type[
i].name;
i++) {
366 if (!strcmp(fmt->
name, fmt_id_type[
i].name)) {
376 #if FF_API_LAVF_AVCTX
424 s, 0,
s->format_probesize);
427 "will be ignored with AVFMT_NOFILE format.\n");
441 s, 0,
s->format_probesize);
469 (*plast_pktl)->next = pktl;
471 *packet_buffer = pktl;
481 for (
i = 0;
i <
s->nb_streams;
i++)
484 if (
s->streams[
i]->attached_pic.size <= 0) {
486 "Attached picture on stream %d has invalid size, "
492 &
s->internal->raw_packet_buffer_end,
493 &
s->streams[
i]->attached_pic,
504 for (
i = 0;
i <
s->nb_streams;
i++) {
521 #if FF_API_LAVF_AVCTX
547 av_log(
NULL,
AV_LOG_ERROR,
"Input context has not been properly allocated by avformat_alloc_context() and is not NULL either\n");
562 if (!(
s->url =
av_strdup(filename ? filename :
""))) {
567 #if FF_API_FORMAT_FILENAME
569 av_strlcpy(
s->filename, filename ? filename :
"",
sizeof(
s->filename));
574 s->probe_score =
ret;
576 if (!
s->protocol_whitelist &&
s->pb &&
s->pb->protocol_whitelist) {
577 s->protocol_whitelist =
av_strdup(
s->pb->protocol_whitelist);
578 if (!
s->protocol_whitelist) {
584 if (!
s->protocol_blacklist &&
s->pb &&
s->pb->protocol_blacklist) {
585 s->protocol_blacklist =
av_strdup(
s->pb->protocol_blacklist);
586 if (!
s->protocol_blacklist) {
592 if (
s->format_whitelist &&
av_match_list(
s->iformat->name,
s->format_whitelist,
',') <= 0) {
611 if (
s->iformat->priv_data_size > 0) {
612 if (!(
s->priv_data =
av_mallocz(
s->iformat->priv_data_size))) {
616 if (
s->iformat->priv_class) {
617 *(
const AVClass **)
s->priv_data =
s->iformat->priv_class;
630 if ((
ret =
s->iformat->read_header(
s)) < 0)
634 s->metadata =
s->internal->id3v2_meta;
635 s->internal->id3v2_meta =
NULL;
636 }
else if (
s->internal->id3v2_meta) {
641 if (id3v2_extra_meta) {
642 if (!strcmp(
s->iformat->name,
"mp3") || !strcmp(
s->iformat->name,
"aac") ||
643 !strcmp(
s->iformat->name,
"tta") || !strcmp(
s->iformat->name,
"wav")) {
665 for (
i = 0;
i <
s->nb_streams;
i++)
666 s->streams[
i]->internal->orig_codec_id =
s->streams[
i]->codecpar->codec_id;
676 if (
s->iformat->read_close)
677 s->iformat->read_close(
s);
694 if (
s->video_codec_id)
698 if (
s->audio_codec_id)
702 if (
s->subtitle_codec_id)
706 if (
s->data_codec_id)
724 "Failed to reallocate probe buffer for stream %d\n",
737 "nothing to probe for stream %d\n", st->
index);
741 end=
s->internal->raw_packet_buffer_remaining_size <= 0
765 int i, pts_wrap_behavior;
766 int64_t pts_wrap_reference;
784 if (!first_program) {
786 if (
s->streams[default_stream_index]->pts_wrap_reference ==
AV_NOPTS_VALUE) {
787 for (
i = 0;
i <
s->nb_streams;
i++) {
790 s->streams[
i]->pts_wrap_reference = pts_wrap_reference;
791 s->streams[
i]->pts_wrap_behavior = pts_wrap_behavior;
803 pts_wrap_reference =
program->pts_wrap_reference;
804 pts_wrap_behavior =
program->pts_wrap_behavior;
813 if (
program->pts_wrap_reference != pts_wrap_reference) {
814 for (
i = 0;
i<
program->nb_stream_indexes;
i++) {
815 s->streams[
program->stream_index[
i]]->pts_wrap_reference = pts_wrap_reference;
816 s->streams[
program->stream_index[
i]]->pts_wrap_behavior = pts_wrap_behavior;
819 program->pts_wrap_reference = pts_wrap_reference;
820 program->pts_wrap_behavior = pts_wrap_behavior;
843 if (
s->internal->raw_packet_buffer_remaining_size <= 0)
848 &
s->internal->raw_packet_buffer_end,
pkt);
849 s->internal->raw_packet_buffer_remaining_size +=
pkt->
size;
854 ret =
s->iformat->read_packet(
s,
pkt);
865 for (
i = 0;
i <
s->nb_streams;
i++) {
883 "Packet corrupt (stream = %d, dts = %s)",
894 "Invalid stream index.\n");
914 if (
s->use_wallclock_as_timestamps)
921 &
s->internal->raw_packet_buffer_end,
927 pkt1 = &
s->internal->raw_packet_buffer_end->pkt;
928 s->internal->raw_packet_buffer_remaining_size -= pkt1->
size;
961 #if FF_API_LAVF_AVCTX
978 }
else if (codec_framerate.
den * 1000LL > codec_framerate.
num) {
1033 #if CONFIG_H264_DECODER
1050 if (pktl ==
s->internal->packet_buffer_end)
1051 return s->internal->parse_queue;
1064 int64_t best_score = INT64_MAX;
1065 for (
i = 0;
i<delay;
i++) {
1068 if (score < best_score) {
1070 dts = pts_buffer[
i];
1075 for (
i = 0;
i<delay;
i++) {
1092 dts = pts_buffer[0];
1104 AVStream *st =
s->streams[stream_index];
1113 for (; pkt_buffer; pkt_buffer =
get_next_pkt(
s, st, pkt_buffer)) {
1118 pts_buffer[0] = pkt_buffer->
pkt.
pts;
1119 for (
i = 0; i<delay && pts_buffer[i] > pts_buffer[
i + 1];
i++)
1120 FFSWAP(int64_t, pts_buffer[
i], pts_buffer[
i + 1]);
1130 AVStream *st =
s->streams[stream_index];
1131 AVPacketList *pktl =
s->internal->packet_buffer ?
s->internal->packet_buffer :
s->internal->parse_queue;
1151 for (pktl_it = pktl; pktl_it; pktl_it =
get_next_pkt(
s, st, pktl_it)) {
1181 int stream_index, int64_t
duration)
1183 AVPacketList *pktl =
s->internal->packet_buffer ?
s->internal->packet_buffer :
s->internal->parse_queue;
1201 av_log(
s,
AV_LOG_DEBUG,
"first_dts %s not matching first dts %s (pts %s, duration %"PRId64
") in the queue\n",
1209 pktl =
s->internal->packet_buffer ?
s->internal->packet_buffer :
s->internal->parse_queue;
1240 int64_t next_dts, int64_t next_pts)
1242 int num, den, presentation_delayed, delay,
i;
1257 "DTS %"PRIi64
" < %"PRIi64
" out of order\n",
1283 presentation_delayed = 0;
1289 presentation_delayed = 1;
1307 if ( strcmp(
s->iformat->name,
"mov,mp4,m4a,3gp,3g2,mj2")
1308 && strcmp(
s->iformat->name,
"flv"))
1324 if (
pkt->
duration > 0 && (
s->internal->packet_buffer ||
s->internal->parse_queue))
1342 presentation_delayed = 1;
1346 "IN delayed:%d pts:%s, dts:%s cur_dts:%s st:%d pc:%p duration:%"PRId64
" delay:%d onein_oneout:%d\n",
1352 if ((delay == 0 || (delay == 1 && pc)) &&
1354 if (presentation_delayed) {
1372 ((uint64_t)st->
cur_dts - (uint64_t)next_dts + 1) <= 2 &&
1373 next_dts != next_pts &&
1421 #if FF_API_CONVERGENCE_DURATION
1440 *pkt_buf_end =
NULL;
1450 int stream_index,
int flush)
1453 AVStream *st =
s->streams[stream_index];
1465 while (
size > 0 || (
flush && got_output)) {
1467 int64_t next_pts =
pkt->
pts;
1468 int64_t next_dts =
pkt->
dts;
1481 got_output = !!out_pkt.
size;
1515 (
AVRational) { 1, st->internal->avctx->sample_rate },
1541 &
s->internal->parse_queue_end,
1568 *pkt_buffer = pktl->
next;
1570 *pkt_buffer_end =
NULL;
1582 int ret,
i, got_packet = 0;
1585 while (!got_packet && !
s->internal->parse_queue) {
1594 for (
i = 0;
i <
s->nb_streams;
i++) {
1609 av_log(
s,
AV_LOG_DEBUG,
"Demuxer context update while decoder is open, closing and trying to re-open\n");
1626 #if FF_API_LAVF_AVCTX
1644 "Invalid timestamps stream=%d, pts=%s, dts=%s, size=%d\n",
1652 "ff_read_packet stream=%d, pts=%s, dts=%s, size=%d, duration=%"PRId64
", flags=%d\n",
1662 "%s, packets or times may be invalid.\n",
1704 if (!got_packet &&
s->internal->parse_queue)
1709 int discard_padding = 0;
1716 sample < st->last_discard_sample)
1725 AV_WL32(p + 4, discard_padding);
1745 memcpy(dst_data, src_sd->
data, src_sd->
size);
1759 #if FF_API_LAVF_AVCTX
1765 "read_frame_internal stream=%d, pts=%s, dts=%s, "
1766 "size=%d, duration=%"PRId64
", flags=%d\n",
1788 ret =
s->internal->packet_buffer
1790 &
s->internal->packet_buffer_end,
pkt)
1804 int wrap_bits =
s->streams[next_pkt->
stream_index]->pts_wrap_bits;
1807 int64_t last_dts = next_pkt->
dts;
1818 last_dts = pktl->
pkt.
dts;
1831 pktl =
s->internal->packet_buffer;
1839 &
s->internal->packet_buffer_end,
pkt);
1854 &
s->internal->packet_buffer_end,
1897 int best_stream = 0;
1898 int best_score = INT_MIN;
1900 if (
s->nb_streams <= 0)
1902 for (
i = 0;
i <
s->nb_streams;
i++) {
1922 if (score > best_score) {
1939 for (
i = 0;
i <
s->nb_streams;
i++) {
1959 if (
s->internal->inject_global_side_data)
1970 for (
i = 0;
i <
s->nb_streams;
i++) {
1982 AVStream *st =
s->streams[stream_index];
1983 unsigned int max_entries =
s->max_index_size /
sizeof(
AVIndexEntry);
1994 int *nb_index_entries,
1995 unsigned int *index_entries_allocated_size,
1996 int64_t
pos, int64_t timestamp,
2002 if ((
unsigned) *nb_index_entries + 1 >= UINT_MAX /
sizeof(
AVIndexEntry))
2008 if (size < 0 || size > 0x3FFFFFFF)
2015 index_entries_allocated_size,
2016 (*nb_index_entries + 1) *
2021 *index_entries = entries;
2027 index = (*nb_index_entries)++;
2028 ie = &entries[
index];
2031 ie = &entries[
index];
2035 memmove(entries +
index + 1, entries +
index,
2037 (*nb_index_entries)++;
2038 }
else if (ie->
pos ==
pos && distance < ie->min_distance)
2062 int64_t wanted_timestamp,
int flags)
2071 if (
b && entries[
b - 1].timestamp < wanted_timestamp)
2080 if (m ==
b && entries[m].timestamp >= wanted_timestamp) {
2087 if (timestamp >= wanted_timestamp)
2089 if (timestamp <= wanted_timestamp)
2095 while (m >= 0 && m < nb_entries &&
2099 if (m == nb_entries)
2107 int64_t pos_delta = 0;
2116 "Protocol name not provided, cannot determine if input is local or "
2117 "a network protocol, buffers and access patterns cannot be configured "
2118 "optimally without knowing the protocol\n");
2121 if (proto && !(strcmp(proto,
"file") && strcmp(proto,
"pipe") && strcmp(proto,
"cache")))
2124 for (ist1 = 0; ist1 <
s->nb_streams; ist1++) {
2126 for (ist2 = 0; ist2 <
s->nb_streams; ist2++) {
2141 if (e2_pts < e1_pts || e2_pts - (uint64_t)e1_pts < time_tolerance)
2152 if (
s->pb->buffer_size < pos_delta && pos_delta < (1<<24)) {
2161 s->pb->short_seek_threshold =
FFMAX(
s->pb->short_seek_threshold, pos_delta/2);
2164 if (skip < (1<<23)) {
2165 s->pb->short_seek_threshold =
FFMAX(
s->pb->short_seek_threshold, skip);
2172 wanted_timestamp,
flags);
2176 int64_t (*read_timestamp)(
struct AVFormatContext *,
int , int64_t *, int64_t ))
2178 int64_t ts = read_timestamp(
s, stream_index, ppos, pos_limit);
2179 if (stream_index >= 0)
2185 int64_t target_ts,
int flags)
2189 int64_t ts_min, ts_max, ts;
2194 if (stream_index < 0)
2203 st =
s->streams[stream_index];
2233 " dts_max=%s\n", pos_max, pos_limit,
av_ts2str(ts_max));
2253 int64_t (*read_timestamp)(
struct AVFormatContext *,
int , int64_t *, int64_t ))
2255 int64_t
step = 1024;
2256 int64_t limit, ts_max;
2258 int64_t pos_max = filesize - 1;
2263 &pos_max, limit, read_timestamp);
2270 int64_t tmp_pos = pos_max + 1;
2272 &tmp_pos, INT64_MAX, read_timestamp);
2278 if (tmp_pos >= filesize)
2291 int64_t pos_min, int64_t pos_max, int64_t pos_limit,
2292 int64_t ts_min, int64_t ts_max,
2293 int flags, int64_t *ts_ret,
2295 int64_t *, int64_t))
2305 pos_min =
s->internal->data_offset;
2311 if (ts_min >= target_ts) {
2319 pos_limit = pos_max;
2322 if (ts_max <= target_ts) {
2330 while (pos_min < pos_limit) {
2332 "pos_min=0x%"PRIx64
" pos_max=0x%"PRIx64
" dts_min=%s dts_max=%s\n",
2336 if (no_change == 0) {
2337 int64_t approximate_keyframe_distance = pos_max - pos_limit;
2341 pos_min - approximate_keyframe_distance;
2342 }
else if (no_change == 1) {
2344 pos = (pos_min + pos_limit) >> 1;
2352 else if (
pos > pos_limit)
2363 " target:%s limit:%"PRId64
" start:%"PRId64
" noc:%d\n",
2364 pos_min,
pos, pos_max,
2366 pos_limit, start_pos, no_change);
2371 if (target_ts <= ts) {
2372 pos_limit = start_pos - 1;
2376 if (target_ts >= ts) {
2399 int64_t pos_min, pos_max;
2401 pos_min =
s->internal->data_offset;
2406 else if (
pos > pos_max)
2411 s->io_repositioned = 1;
2417 int64_t timestamp,
int flags)
2424 st =
s->streams[stream_index];
2428 if (index < 0 && st->nb_index_entries &&
2429 timestamp < st->index_entries[0].timestamp)
2432 if (index < 0 || index == st->nb_index_entries - 1) {
2443 if ((
ret =
avio_seek(
s->pb,
s->internal->data_offset, SEEK_SET)) < 0)
2450 }
while (read_status ==
AVERROR(EAGAIN));
2451 if (read_status < 0)
2459 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);
2472 if (
s->iformat->read_seek)
2473 if (
s->iformat->read_seek(
s, stream_index, timestamp,
flags) >= 0)
2484 int64_t timestamp,
int flags)
2496 if (stream_index < 0) {
2498 if (stream_index < 0)
2501 st =
s->streams[stream_index];
2508 if (
s->iformat->read_seek) {
2510 ret =
s->iformat->read_seek(
s, stream_index, timestamp,
flags);
2516 if (
s->iformat->read_timestamp &&
2528 int64_t timestamp,
int flags)
2532 if (
s->iformat->read_seek2 && !
s->iformat->read_seek) {
2533 int64_t min_ts = INT64_MIN, max_ts = INT64_MAX;
2551 int64_t ts, int64_t max_ts,
int flags)
2553 if (min_ts > ts || max_ts < ts)
2555 if (stream_index < -1 || stream_index >= (
int)
s->nb_streams)
2562 if (
s->iformat->read_seek2) {
2566 if (stream_index == -1 &&
s->nb_streams == 1) {
2578 ret =
s->iformat->read_seek2(
s, stream_index, min_ts,
2586 if (
s->iformat->read_timestamp) {
2592 if (
s->iformat->read_seek || 1) {
2595 if (
ret<0 && ts != min_ts && max_ts != ts) {
2642 int64_t
start_time, start_time1, start_time_text, end_time, end_time1, end_time_text;
2643 int64_t
duration, duration1, duration_text, filesize;
2648 start_time_text = INT64_MAX;
2649 end_time = INT64_MIN;
2650 end_time_text = INT64_MIN;
2652 duration_text = INT64_MIN;
2662 start_time_text =
FFMIN(start_time_text, start_time1);
2668 if (end_time1 !=
AV_NOPTS_VALUE && (end_time1 > 0 ? start_time1 <= INT64_MAX - end_time1 : start_time1 >= INT64_MIN - end_time1)) {
2669 end_time1 += start_time1;
2671 end_time_text =
FFMAX(end_time_text, end_time1);
2673 end_time =
FFMAX(end_time, end_time1);
2686 duration_text =
FFMAX(duration_text, duration1);
2696 if (end_time == INT64_MIN || (end_time < end_time_text && end_time_text - (uint64_t)end_time <
AV_TIME_BASE))
2697 end_time = end_time_text;
2698 else if (end_time < end_time_text)
2708 if (end_time != INT64_MIN) {
2756 int i, show_warning = 0;
2761 int64_t bit_rate = 0;
2803 "Estimating duration from bitrate, this may be inaccurate\n");
2806 #define DURATION_MAX_READ_SIZE 250000LL
2807 #define DURATION_MAX_RETRY 6
2814 int num, den, read_size,
i,
ret;
2815 int found_duration = 0;
2829 "start time for stream %d is not set in estimate_timings_from_pts\n",
i);
2838 av_log(ic,
AV_LOG_INFO,
"Skipping duration calculation in estimate_timings_from_pts\n");
2839 goto skip_duration_calc;
2847 is_end = found_duration;
2963 file_size =
FFMAX(0, file_size);
2993 if (st->time_base.den)
2999 "format: start_time: %s duration: %s (estimate from %s) bitrate=%"PRId64
" kb/s\n",
3011 #define FAIL(errmsg) do { \
3013 *errmsg_ptr = errmsg; \
3019 FAIL(
"unknown codec");
3023 FAIL(
"unspecified frame size");
3026 FAIL(
"unspecified sample format");
3028 FAIL(
"unspecified sample rate");
3030 FAIL(
"unspecified number of channels");
3032 FAIL(
"no decodable DTS frames");
3036 FAIL(
"unspecified size");
3038 FAIL(
"unspecified pixel format");
3041 FAIL(
"no frame in rv30/40 and no sar");
3045 FAIL(
"unspecified size");
3060 int got_picture = 1,
ret = 0;
3064 int do_skip_frame = 0;
3086 if (
s->codec_whitelist)
3130 &got_picture, &
pkt);
3143 if (!
pkt.
data && !got_picture)
3147 if (do_skip_frame) {
3179 if (bps <= 0 || bps > 64)
3194 if (sflags & (1 << (
bps - 1))) {
3238 for (
i = 0; tags && tags[
i];
i++) {
3241 if (codec_tags->
id ==
id) {
3254 for (
i = 0; tags && tags[
i];
i++) {
3265 int64_t max_time = 0;
3267 if (
s->duration > 0 &&
s->start_time < INT64_MAX -
s->duration)
3268 max_time =
s->duration +
3271 for (
i = 0;
i <
s->nb_chapters;
i++)
3278 for (j = 0; j <
s->nb_chapters; j++) {
3282 if (j !=
i && next_start > ch->
start && next_start <
end)
3292 return (
i + 1) * 1001;
3296 return (
i + 31) * 1001 * 12;
3300 return ((
const int[]) { 80, 120, 240})[
i] * 1001 * 12;
3304 return ((
const int[]) { 24, 30, 60, 12, 15, 48 })[
i] * 1000 * 12;
3315 if (
c->time_base.den >= 101LL *
c->time_base.num ||
3316 c->time_base.den < 5LL *
c->time_base.num ||
3368 && ts - (uint64_t)last < INT64_MAX) {
3383 for (j= 0; j<2; j++) {
3384 int64_t ticks =
llrint(sdts+j*0.5);
3385 double error= sdts - ticks + j*0.5;
3404 if (error0 > 0.04 && error1 > 0.04) {
3439 double best_error= 0.01;
3454 for (k= 0; k<2; k++) {
3459 if (error < best_error && best_error> 0.000000001) {
3468 if (num && (!ref_rate.
num || (
double)num/(12*1001) < 1.01 *
av_q2d(ref_rate)))
3617 memcpy(dst_data, sd_src->
data, sd_src->
size);
3624 int i, count = 0,
ret = 0, j;
3634 int64_t max_stream_analyze_duration;
3635 int64_t max_subtitle_analyze_duration;
3637 int eof_reached = 0;
3640 flush_codecs = probesize > 0;
3644 max_stream_analyze_duration = max_analyze_duration;
3645 max_subtitle_analyze_duration = max_analyze_duration;
3646 if (!max_analyze_duration) {
3647 max_stream_analyze_duration =
3657 av_log(ic,
AV_LOG_DEBUG,
"Before avformat_find_stream_info() pos: %"PRId64
" bytes read:%"PRId64
" seeks:%d nb_streams:%d\n",
3675 #if FF_API_LAVF_AVCTX
3695 "%s, packets or times may be invalid.\n",
3705 goto find_stream_info_err;
3720 && codec && !avctx->
codec) {
3723 "Failed to open codec in %s\n",__FUNCTION__);
3728 if (codec && !avctx->
codec)
3731 "Failed to open codec in %s\n",__FUNCTION__);
3738 #if FF_API_R_FRAME_RATE
3748 int analyzed_all_streams;
3757 int fps_analyze_framecount = 20;
3767 fps_analyze_framecount *= 2;
3769 fps_analyze_framecount = 0;
3773 fps_analyze_framecount = 0;
3780 if (count < fps_analyze_framecount)
3799 analyzed_all_streams = 0;
3800 if (!missing_streams || !*missing_streams)
3802 analyzed_all_streams = 1;
3814 if (read_size >= probesize) {
3817 "Probe buffer size limit of %"PRId64
" bytes reached\n", probesize);
3824 "Stream #%d: not enough frames to estimate rate; "
3825 "consider increasing probesize\n",
i);
3846 goto unref_then_goto_end;
3861 goto unref_then_goto_end;
3870 "Non-increasing DTS in stream %d: packet %d with DTS "
3871 "%"PRId64
", packet %d with DTS %"PRId64
"\n",
3887 "DTS discontinuity in stream %d: packet %d with DTS "
3888 "%"PRId64
", packet %d with DTS %"PRId64
"\n",
3919 if (analyzed_all_streams) limit = max_analyze_duration;
3921 else limit = max_stream_analyze_duration;
3924 av_log(ic,
AV_LOG_VERBOSE,
"max_analyze_duration %"PRId64
" reached at %"PRId64
" microseconds st:%d\n",
3940 #if FF_API_R_FRAME_RATE
3949 goto unref_then_goto_end;
3973 for (stream_index = 0; stream_index < ic->
nb_streams; stream_index++) {
3974 st = ic->
streams[stream_index];
3978 if (codec && !avctx->
codec) {
3984 "Failed to open codec in %s\n",__FUNCTION__);
4016 "decoding for stream %d failed\n", st->
index);
4039 double best_error = 0.01;
4057 if (
error < best_error) {
4059 best_fps = std_fps.
num;
4065 if (
error < best_error) {
4067 best_fps = std_fps.
num;
4073 best_fps, 12 * 1001, INT_MAX);
4135 goto find_stream_info_err;
4141 "Could not find codec parameters for stream %d (%s): %s\n"
4142 "Consider increasing the value for the 'analyzeduration' and 'probesize' options\n",
4160 goto find_stream_info_err;
4163 goto find_stream_info_err;
4173 #if FF_API_LAVF_AVCTX
4177 goto find_stream_info_err;
4189 if (st->codec->codec_tag !=
MKTAG(
't',
'm',
'c',
'd')) {
4197 if (!st->codec->subtitle_header)
4198 goto find_stream_info_err;
4201 st->codec->subtitle_header_size);
4214 find_stream_info_err:
4225 av_log(ic,
AV_LOG_DEBUG,
"After avformat_find_stream_info() pos: %"PRId64
" bytes read:%"PRId64
" seeks:%d frames:%d\n",