Go to the documentation of this file.
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",
4229 unref_then_goto_end:
4231 goto find_stream_info_err;
4252 int wanted_stream_nb,
int related_stream,
4257 int best_count = -1, best_multiframe = -1, best_disposition = -1;
4258 int count, multiframe, disposition;
4259 int64_t best_bitrate = -1;
4264 if (related_stream >= 0 && wanted_stream_nb < 0) {
4277 if (wanted_stream_nb >= 0 && real_stream_index != wanted_stream_nb)
4293 multiframe =
FFMIN(5, count);
4294 if ((best_disposition > disposition) ||
4295 (best_disposition == disposition && best_multiframe > multiframe) ||
4296 (best_disposition == disposition && best_multiframe == multiframe && best_bitrate >
bitrate) ||
4297 (best_disposition == disposition && best_multiframe == multiframe && best_bitrate ==
bitrate && best_count >= count))
4299 best_disposition = disposition;
4302 best_multiframe = multiframe;
4303 ret = real_stream_index;
4313 *decoder_ret = (
AVCodec*)best_decoder;
4321 if (
s->iformat->read_play)
4322 return s->iformat->read_play(
s);
4330 if (
s->iformat->read_pause)
4331 return s->iformat->read_pause(
s);
4365 if (
src->nb_side_data) {
4372 for (
i = 0;
i <
src->nb_side_data;
i++) {
4374 src->side_data[
i].size);
4383 #if FF_API_LAVF_FFSERVER
4385 av_freep(&dst->recommended_encoder_configuration);
4386 if (
src->recommended_encoder_configuration) {
4387 const char *conf_str =
src->recommended_encoder_configuration;
4388 dst->recommended_encoder_configuration =
av_strdup(conf_str);
4389 if (!dst->recommended_encoder_configuration)
4429 #if FF_API_LAVF_AVCTX
4438 #if FF_API_LAVF_FFSERVER
4440 av_freep(&st->recommended_encoder_configuration);
4462 if (
s->oformat &&
s->oformat->deinit &&
s->internal->initialized)
4463 s->oformat->deinit(
s);
4466 if (
s->iformat &&
s->iformat->priv_class &&
s->priv_data)
4468 if (
s->oformat &&
s->oformat->priv_class &&
s->priv_data)
4471 for (
i = 0;
i <
s->nb_streams;
i++)
4475 for (
i = 0;
i <
s->nb_programs;
i++) {
4484 while (
s->nb_chapters--) {
4509 if ((
s->iformat && strcmp(
s->iformat->name,
"image2") &&
s->iformat->flags &
AVFMT_NOFILE) ||
4516 if (
s->iformat->read_close)
4517 s->iformat->read_close(
s);
4532 if (
s->nb_streams >=
FFMIN(
s->max_streams, INT_MAX/
sizeof(*streams))) {
4533 if (
s->max_streams < INT_MAX/
sizeof(*streams))
4534 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);
4540 s->streams = streams;
4551 #if FF_API_LAVF_AVCTX
4575 #if FF_API_LAVF_AVCTX
4578 st->codec->bit_rate = 0;
4593 st->
index =
s->nb_streams;
4608 #if FF_API_R_FRAME_RATE
4618 s->streams[
s->nb_streams++] = st;
4655 int64_t start, int64_t
end,
const char *title)
4665 for (
i = 0;
i <
s->nb_chapters;
i++)
4666 if (
s->chapters[
i]->id ==
id)
4667 chapter =
s->chapters[
i];
4678 chapter->
start = start;
4699 for (j = 0; j <
program->nb_stream_indexes; j++)
4700 if (
program->stream_index[j] == idx)
4719 uint64_t ntp_ts, frac_part, sec;
4723 sec = ntp_time_us / 1000000;
4724 usec = ntp_time_us % 1000000;
4727 frac_part = usec * 0xFFFFFFFFULL;
4728 frac_part /= 1000000;
4730 if (sec > 0xFFFFFFFFULL)
4734 ntp_ts |= frac_part;
4742 char *q, buf1[20],
c;
4743 int nd,
len, percentd_found;
4756 if (nd >= INT_MAX / 10 - 255)
4758 nd = nd * 10 + *p++ -
'0';
4772 snprintf(buf1,
sizeof(buf1),
"%0*d", nd, number);
4774 if ((q - buf +
len) > buf_size - 1)
4776 memcpy(q, buf1,
len);
4784 if ((q - buf) < buf_size - 1)
4788 if (!percentd_found)
4803 char *authorization,
int authorization_size,
4804 char *hostname,
int hostname_size,
4805 int *port_ptr,
char *path,
int path_size,
const char *url)
4807 const char *p, *ls, *at, *at2, *col, *brk;
4813 if (authorization_size > 0)
4814 authorization[0] = 0;
4815 if (hostname_size > 0)
4821 if ((p = strchr(url,
':'))) {
4835 ls = p + strcspn(p,
"/?#");
4842 while ((at = strchr(p,
'@')) && at < ls) {
4844 FFMIN(authorization_size, at + 1 - at2));
4848 if (*p ==
'[' && (brk = strchr(p,
']')) && brk < ls) {
4851 FFMIN(hostname_size, brk - p));
4852 if (brk[1] ==
':' && port_ptr)
4853 *port_ptr = atoi(brk + 2);
4854 }
else if ((col = strchr(p,
':')) && col < ls) {
4856 FFMIN(col + 1 - p, hostname_size));
4858 *port_ptr = atoi(col + 1);
4861 FFMIN(ls + 1 - p, hostname_size));
4872 if (!path || !
temp) {
4882 for ( ; *
pos !=
'\0'; ++
pos) {
4883 if (*
pos ==
'/' || *
pos ==
'\\') {
4891 if ((*(
pos - 1) !=
'/') || (*(
pos - 1) !=
'\\')) {
4902 static const char hex_table_uc[16] = {
'0',
'1',
'2',
'3',
4905 'C',
'D',
'E',
'F' };
4906 static const char hex_table_lc[16] = {
'0',
'1',
'2',
'3',
4909 'c',
'd',
'e',
'f' };
4910 const char *hex_table =
lowercase ? hex_table_lc : hex_table_uc;
4912 for (
i = 0;
i <
s;
i++) {
4913 buff[
i * 2] = hex_table[
src[
i] >> 4];
4914 buff[
i * 2 + 1] = hex_table[
src[
i] & 0xF];
4931 if (
c >=
'0' &&
c <=
'9')
4933 else if (
c >=
'A' &&
c <=
'F')
4949 unsigned int pts_num,
unsigned int pts_den)
4953 if (new_tb.
num != pts_num)
4955 "st:%d removing common factor %d from timebase\n",
4956 s->index, pts_num / new_tb.
num);
4959 "st:%d has too large timebase, reducing\n",
s->index);
4961 if (new_tb.
num <= 0 || new_tb.
den <= 0) {
4963 "Ignoring attempt to set invalid timebase %d/%d for st:%d\n",
4968 s->time_base = new_tb;
4969 #if FF_API_LAVF_AVCTX
4971 s->codec->pkt_timebase = new_tb;
4974 s->internal->avctx->pkt_timebase = new_tb;
4975 s->pts_wrap_bits = pts_wrap_bits;
4981 const char *ptr =
str;
4986 char *dest =
NULL, *dest_end;
4987 int key_len, dest_len = 0;
4990 while (*ptr && (
av_isspace(*ptr) || *ptr ==
','))
4997 if (!(ptr = strchr(
key,
'=')))
5000 key_len = ptr -
key;
5002 callback_get_buf(
context,
key, key_len, &dest, &dest_len);
5003 dest_end = dest ? dest + dest_len - 1 :
NULL;
5007 while (*ptr && *ptr !=
'\"') {
5011 if (dest && dest < dest_end)
5015 if (dest && dest < dest_end)
5023 for (; *ptr && !(
av_isspace(*ptr) || *ptr ==
','); ptr++)
5024 if (dest && dest < dest_end)
5035 for (
i = 0;
i <
s->nb_streams;
i++)
5036 if (
s->streams[
i]->id ==
id)
5045 unsigned int codec_tag;
5093 if (channel_layout) {
5112 bytestream_put_le64(&
data, channel_layout);
5127 AVRational frame_sample_aspect_ratio =
frame ?
frame->sample_aspect_ratio : codec_sample_aspect_ratio;
5129 av_reduce(&stream_sample_aspect_ratio.
num, &stream_sample_aspect_ratio.
den,
5130 stream_sample_aspect_ratio.
num, stream_sample_aspect_ratio.
den, INT_MAX);
5131 if (stream_sample_aspect_ratio.
num <= 0 || stream_sample_aspect_ratio.
den <= 0)
5132 stream_sample_aspect_ratio = undef;
5134 av_reduce(&frame_sample_aspect_ratio.
num, &frame_sample_aspect_ratio.
den,
5135 frame_sample_aspect_ratio.
num, frame_sample_aspect_ratio.
den, INT_MAX);
5136 if (frame_sample_aspect_ratio.
num <= 0 || frame_sample_aspect_ratio.
den <= 0)
5137 frame_sample_aspect_ratio = undef;
5139 if (stream_sample_aspect_ratio.
num)
5140 return stream_sample_aspect_ratio;
5142 return frame_sample_aspect_ratio;
5151 if (avg_fr.
num > 0 && avg_fr.
den > 0 && fr.
num > 0 && fr.
den > 0 &&
5158 if ( codec_fr.
num > 0 && codec_fr.
den > 0 &&
5176 const char *spec,
const char **indexptr,
AVProgram **p)
5180 if (*spec <= '9' && *spec >=
'0') {
5184 }
else if (*spec ==
'v' || *spec ==
'a' || *spec ==
's' || *spec ==
'd' ||
5185 *spec ==
't' || *spec ==
'V') {
5198 if (*spec && *spec++ !=
':')
5201 #if FF_API_LAVF_AVCTX
5213 }
else if (*spec ==
'p' && *(spec + 1) ==
':') {
5218 prog_id = strtol(spec, &endptr, 0);
5220 if (spec == endptr || (*endptr && *endptr++ !=
':'))
5224 for (
i = 0;
i <
s->nb_programs;
i++) {
5225 if (
s->programs[
i]->id != prog_id)
5228 for (j = 0; j <
s->programs[
i]->nb_stream_indexes; j++) {
5229 if (st->
index ==
s->programs[
i]->stream_index[j]) {
5232 *p =
s->programs[
i];
5241 }
else if (*spec ==
'#' ||
5242 (*spec ==
'i' && *(spec + 1) ==
':')) {
5245 spec += 1 + (*spec ==
'i');
5246 stream_id = strtol(spec, &endptr, 0);
5247 if (spec == endptr || *endptr)
5249 return match && (stream_id == st->
id);
5250 }
else if (*spec ==
'm' && *(spec + 1) ==
':') {
5257 val = strchr(spec,
':');
5265 if (!
val || !strcmp(
tag->value,
val + 1))
5274 return match &&
ret;
5275 }
else if (*spec ==
'u' && *(spec + 1) ==
'\0') {
5277 #if FF_API_LAVF_AVCTX
5286 #if FF_API_LAVF_AVCTX
5287 val =
val || (codec->sample_rate && codec->channels);
5298 #if FF_API_LAVF_AVCTX
5299 val =
val || (codec->width && codec->height);
5315 #if FF_API_LAVF_AVCTX
5334 const char *indexptr =
NULL;
5345 index = strtol(indexptr, &endptr, 0);
5352 if (spec == indexptr)
5357 for (
int i = 0; i < nb_streams && index >= 0;
i++) {
5362 if (
ret > 0 &&
index-- == 0 && st == candidate)
5375 static const uint8_t avci100_1080p_extradata[] = {
5377 0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
5378 0xb6, 0xd4, 0x20, 0x22, 0x33, 0x19, 0xc6, 0x63,
5379 0x23, 0x21, 0x01, 0x11, 0x98, 0xce, 0x33, 0x19,
5380 0x18, 0x21, 0x02, 0x56, 0xb9, 0x3d, 0x7d, 0x7e,
5381 0x4f, 0xe3, 0x3f, 0x11, 0xf1, 0x9e, 0x08, 0xb8,
5382 0x8c, 0x54, 0x43, 0xc0, 0x78, 0x02, 0x27, 0xe2,
5383 0x70, 0x1e, 0x30, 0x10, 0x10, 0x14, 0x00, 0x00,
5384 0x03, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0xca,
5385 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5387 0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x33, 0x48,
5390 static const uint8_t avci100_1080i_extradata[] = {
5392 0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
5393 0xb6, 0xd4, 0x20, 0x22, 0x33, 0x19, 0xc6, 0x63,
5394 0x23, 0x21, 0x01, 0x11, 0x98, 0xce, 0x33, 0x19,
5395 0x18, 0x21, 0x03, 0x3a, 0x46, 0x65, 0x6a, 0x65,
5396 0x24, 0xad, 0xe9, 0x12, 0x32, 0x14, 0x1a, 0x26,
5397 0x34, 0xad, 0xa4, 0x41, 0x82, 0x23, 0x01, 0x50,
5398 0x2b, 0x1a, 0x24, 0x69, 0x48, 0x30, 0x40, 0x2e,
5399 0x11, 0x12, 0x08, 0xc6, 0x8c, 0x04, 0x41, 0x28,
5400 0x4c, 0x34, 0xf0, 0x1e, 0x01, 0x13, 0xf2, 0xe0,
5401 0x3c, 0x60, 0x20, 0x20, 0x28, 0x00, 0x00, 0x03,
5402 0x00, 0x08, 0x00, 0x00, 0x03, 0x01, 0x94, 0x20,
5404 0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x33, 0x48,
5407 static const uint8_t avci50_1080p_extradata[] = {
5409 0x00, 0x00, 0x00, 0x01, 0x67, 0x6e, 0x10, 0x28,
5410 0xa6, 0xd4, 0x20, 0x32, 0x33, 0x0c, 0x71, 0x18,
5411 0x88, 0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8c,
5412 0x44, 0x30, 0x21, 0x02, 0x56, 0x4e, 0x6f, 0x37,
5413 0xcd, 0xf9, 0xbf, 0x81, 0x6b, 0xf3, 0x7c, 0xde,
5414 0x6e, 0x6c, 0xd3, 0x3c, 0x05, 0xa0, 0x22, 0x7e,
5415 0x5f, 0xfc, 0x00, 0x0c, 0x00, 0x13, 0x8c, 0x04,
5416 0x04, 0x05, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00,
5417 0x00, 0x03, 0x00, 0x32, 0x84, 0x00, 0x00, 0x00,
5419 0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x31, 0x12,
5422 static const uint8_t avci50_1080i_extradata[] = {
5424 0x00, 0x00, 0x00, 0x01, 0x67, 0x6e, 0x10, 0x28,
5425 0xa6, 0xd4, 0x20, 0x32, 0x33, 0x0c, 0x71, 0x18,
5426 0x88, 0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8c,
5427 0x44, 0x30, 0x21, 0x02, 0x56, 0x4e, 0x6e, 0x61,
5428 0x87, 0x3e, 0x73, 0x4d, 0x98, 0x0c, 0x03, 0x06,
5429 0x9c, 0x0b, 0x73, 0xe6, 0xc0, 0xb5, 0x18, 0x63,
5430 0x0d, 0x39, 0xe0, 0x5b, 0x02, 0xd4, 0xc6, 0x19,
5431 0x1a, 0x79, 0x8c, 0x32, 0x34, 0x24, 0xf0, 0x16,
5432 0x81, 0x13, 0xf7, 0xff, 0x80, 0x02, 0x00, 0x01,
5433 0xf1, 0x80, 0x80, 0x80, 0xa0, 0x00, 0x00, 0x03,
5434 0x00, 0x20, 0x00, 0x00, 0x06, 0x50, 0x80, 0x00,
5436 0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x31, 0x12,
5439 static const uint8_t avci100_720p_extradata[] = {
5441 0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
5442 0xb6, 0xd4, 0x20, 0x2a, 0x33, 0x1d, 0xc7, 0x62,
5443 0xa1, 0x08, 0x40, 0x54, 0x66, 0x3b, 0x8e, 0xc5,
5444 0x42, 0x02, 0x10, 0x25, 0x64, 0x2c, 0x89, 0xe8,
5445 0x85, 0xe4, 0x21, 0x4b, 0x90, 0x83, 0x06, 0x95,
5446 0xd1, 0x06, 0x46, 0x97, 0x20, 0xc8, 0xd7, 0x43,
5447 0x08, 0x11, 0xc2, 0x1e, 0x4c, 0x91, 0x0f, 0x01,
5448 0x40, 0x16, 0xec, 0x07, 0x8c, 0x04, 0x04, 0x05,
5449 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x03,
5450 0x00, 0x64, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00,
5452 0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x31, 0x12,
5455 static const uint8_t avci50_720p_extradata[] = {
5457 0x00, 0x00, 0x00, 0x01, 0x67, 0x6e, 0x10, 0x20,
5458 0xa6, 0xd4, 0x20, 0x32, 0x33, 0x0c, 0x71, 0x18,
5459 0x88, 0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8c,
5460 0x44, 0x30, 0x21, 0x02, 0x56, 0x4e, 0x6f, 0x37,
5461 0xcd, 0xf9, 0xbf, 0x81, 0x6b, 0xf3, 0x7c, 0xde,
5462 0x6e, 0x6c, 0xd3, 0x3c, 0x0f, 0x01, 0x6e, 0xff,
5463 0xc0, 0x00, 0xc0, 0x01, 0x38, 0xc0, 0x40, 0x40,
5464 0x50, 0x00, 0x00, 0x03, 0x00, 0x10, 0x00, 0x00,
5465 0x06, 0x48, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
5467 0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x31, 0x12,
5476 data = avci100_1080p_extradata;
5477 size =
sizeof(avci100_1080p_extradata);
5479 data = avci100_1080i_extradata;
5480 size =
sizeof(avci100_1080i_extradata);
5484 data = avci50_1080p_extradata;
5485 size =
sizeof(avci50_1080p_extradata);
5487 data = avci50_1080i_extradata;
5488 size =
sizeof(avci50_1080i_extradata);
5491 data = avci100_720p_extradata;
5492 size =
sizeof(avci100_720p_extradata);
5494 data = avci50_720p_extradata;
5495 size =
sizeof(avci50_720p_extradata);
5603 const char * shorthand[2] = {
NULL};
5606 shorthand[0] = opt->
name;
5622 "Automatically inserted bitstream filter '%s'; args='%s'\n",
5623 name, args ? args :
"");
5641 memset(
pkt, 0,
sizeof(*
pkt));
5647 memcpy(t, new_pkt.
data, new_pkt.
size);
5670 "Failed to open bitstream filter %s for stream %d with codec %s",
5698 s->io_close(
s, *pb);
5710 int64_t parsed_timestamp;
5714 *timestamp = return_seconds ? parsed_timestamp / 1000000 : parsed_timestamp;
5795 if (!strcmp(ofmt->
name,
"avi")) {
5796 #if FF_API_R_FRAME_RATE
5802 ||
copy_tb == AVFMT_TBCF_R_FRAMERATE) {
5846 #if FF_API_LAVF_AVCTX
5860 #if FF_API_FORMAT_FILENAME
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
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 ...
static void error(const char *err)
av_cold int avcodec_close(AVCodecContext *avctx)
Close a given AVCodecContext and free all the data associated with it (but not the AVCodecContext its...
int frame_size
Number of samples per channel in an audio frame.
int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDictionary **out_val)
int id
unique ID to identify the chapter
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it be(in the first position) for now. Options ------- Then comes the options array. This is what will define the user accessible options. For example
#define FF_ENABLE_DEPRECATION_WARNINGS
AVCodecParameters * par_in
Parameters of the input stream.
#define AV_LOG_WARNING
Something somehow does not look correct.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
attribute_deprecated int64_t convergence_duration
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C program
int ffio_realloc_buf(AVIOContext *s, int buf_size)
Reallocate a given buffer for AVIOContext.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
enum AVMediaType codec_type
General type of the encoded data.
const struct PixelFormatTag * avpriv_get_raw_pix_fmt_tags(void)
enum AVAudioServiceType audio_service_type
Type of service that the audio stream conveys.
uint64_t channel_layout
Audio channel layout.
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
unsigned int nb_stream_indexes
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc)
Add a value to a timestamp.
int avio_close(AVIOContext *s)
Close the resource accessed by the AVIOContext s and free it.
int sample_rate
samples per second
#define FFSWAP(type, a, b)
AVCodecContext * avctx
The codec context used by avformat_find_stream_info, the parser, etc.
This struct describes the properties of an encoded stream.
@ AV_PKT_DATA_PARAM_CHANGE
An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
int seek_count
seek statistic This field is internal to libavformat and access from outside is not allowed.
void * av_opt_ptr(const AVClass *class, void *obj, const char *name)
Gets a pointer to the requested field in a struct.
#define AVERROR_EOF
End of file.
#define MKTAG(a, b, c, d)
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
AVProgram * av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s)
Find the programs which belong to a given stream.
AVRational av_div_q(AVRational b, AVRational c)
Divide one rational by another.
int avcodec_parameters_from_context(AVCodecParameters *par, const AVCodecContext *codec)
Fill the parameters struct based on the values from the supplied codec context.
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)
#define AV_PKT_FLAG_DISCARD
Flag is used to discard packets which are required to maintain valid decoder state but are not requir...
char * protocol_blacklist
',' separated list of disallowed protocols.
int duration
Duration of the current frame.
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
unsigned int avpriv_toupper4(unsigned int x)
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
AVPacketSideData * coded_side_data
Additional data associated with the entire coded stream.
int av_grow_packet(AVPacket *pkt, int grow_by)
Increase packet size, correctly zeroing padding.
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
struct AVPacketList * next
static av_const int av_isspace(int c)
Locale-independent conversion of ASCII isspace.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_bsf_init(AVBSFContext *ctx)
Prepare the filter for use, after all the parameters and options have been set.
static av_cold int end(AVCodecContext *avctx)
This structure describes decoded (raw) audio or video data.
AVStream ** streams
A list of all streams in the file.
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about which is also called distortion Distortion can be quantified by almost any quality measurement one chooses the sum of squared differences is used but more complex methods that consider psychovisual effects can be used as well It makes no difference in this discussion First step
int capabilities
Codec capabilities.
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt)
Decode a subtitle message.
@ AV_CODEC_ID_DVB_TELETEXT
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.
AVStreamInternal * internal
An opaque field for libavformat internal usage.
@ AV_PKT_DATA_PALETTE
An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE bytes worth of palette.
AVRational avg_frame_rate
Average framerate.
enum AVDurationEstimationMethod duration_estimation_method
The duration field can be estimated through various ways, and this field can be used to know how the ...
uint8_t * subtitle_header
Header containing style information for text subtitles.
const struct AVBitStreamFilter * filter
@ AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE
void * av_mallocz_array(size_t nmemb, size_t size)
#define AV_LOG_VERBOSE
Detailed information.
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.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
int buf_size
Size of buf except extra allocated bytes.
void ff_network_close(void)
int64_t probesize
Maximum size of the data read from input for determining the input container format.
int skip_to_keyframe
Indicates that everything up to the next keyframe should be discarded.
@ AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
Return the next frame of a stream.
int avcodec_is_open(AVCodecContext *s)
AVBSFContext * bsfc
bitstream filter to run on stream
@ AV_CODEC_ID_HDMV_PGS_SUBTITLE
int ff_id3v2_parse_chapters(AVFormatContext *s, ID3v2ExtraMeta *extra_meta)
Create chapters for all CHAP tags found in the ID3v2 header.
AVFormatInternal * internal
An opaque field for libavformat internal usage.
int av_get_frame_filename(char *buf, int buf_size, const char *path, int number)
int64_t avio_size(AVIOContext *s)
Get the filesize.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
The bitstream filter state.
int ff_network_init(void)
int av_demuxer_open(AVFormatContext *ic)
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,...
const AVBitStreamFilter * av_bsf_get_by_name(const char *name)
int64_t av_gcd(int64_t a, int64_t b)
Compute the greatest common divisor of two integer operands.
int av_filename_number_test(const char *filename)
Check whether filename actually is a numbered sequence generator.
void * av_memdup(const void *p, size_t size)
Duplicate a buffer with av_malloc().
static int ff_mutex_unlock(AVMutex *mutex)
int avformat_queue_attached_pictures(AVFormatContext *s)
void avformat_close_input(AVFormatContext **ps)
Close an opened input AVFormatContext.
int64_t offset
byte offset from starting packet start
AVIOInterruptCB interrupt_callback
Custom interrupt callbacks for the I/O layer.
AVCodec * avcodec_find_decoder_by_name(const char *name)
Find a registered decoder with the specified name.
int64_t pts_wrap_reference
Internal data to check for wrapping of the time stamp.
int key_frame
Set by parser to 1 for key frames and 0 for non-key frames.
static const chunk_decoder decoder[8]
ff_const59 struct AVInputFormat * iformat
The input container format.
const struct AVCodec * codec
enum AVDiscard skip_frame
Skip decoding for selected frames.
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding.
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.
#define MAKE_ACCESSORS(str, name, type, field)
unsigned avformat_version(void)
Return the LIBAVFORMAT_VERSION_INT constant.
int64_t codec_info_duration
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
@ AVDISCARD_NONE
discard nothing
static double val(void *priv, double ch)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
AVCodecParserContext * av_parser_init(int codec_id)
@ AV_ROUND_UP
Round toward +infinity.
struct AVBitStreamFilterContext * next
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
AVProgram * av_new_program(AVFormatContext *ac, int id)
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
int64_t duration
Decoding: duration of the stream, in stream time base.
int ff_check_interrupt(AVIOInterruptCB *cb)
Check if the user has requested to interrupt a blocking function associated with cb.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
int avformat_network_init(void)
Do global initialization of network libraries.
AVPacket attached_pic
For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet will contain the attached pictu...
void avsubtitle_free(AVSubtitle *sub)
Free all allocated data in the given subtitle struct.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
@ AV_CODEC_ID_DVB_SUBTITLE
int64_t bit_rate
Total stream bitrate in bit/s, 0 if not available.
int max_ts_probe
Maximum number of packets to read while waiting for the first timestamp.
char * format_whitelist
',' separated list of allowed demuxers.
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.
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int pts_wrap_behavior
Options for behavior, when a wrap is detected.
#define AV_CODEC_CAP_EXPERIMENTAL
Codec is experimental and is thus avoided in favor of non experimental encoders.
#define AV_PKT_FLAG_CORRUPT
The packet content is corrupted.
int ctx_flags
Flags signalling stream properties.
int64_t first_dts
Timestamp corresponding to the last dts sync point.
enum AVPixelFormat avpriv_find_pix_fmt(const PixelFormatTag *tags, unsigned int fourcc)
uint8_t * av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type, int size)
Allocate new information from stream.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
int av_opt_set_dict(void *obj, AVDictionary **options)
Set all the options from a given dictionary on an object.
int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance)
Test if the given container can store a codec.
int has_b_frames
Size of the frame reordering buffer in the decoder.
@ AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
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.
int64_t end
chapter start/end time in time_base units
This struct describes the properties of a single codec described by an AVCodecID.
int64_t codec_info_duration_fields
int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Seek to the keyframe at timestamp.
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
int flags
Flags modifying the (de)muxer behaviour.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample format(the sample packing is implied by the sample format) and sample rate. The lists are not just lists
AVRational sample_aspect_ratio
Video only.
@ AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
int ticks_per_frame
For some codecs, the time base is closer to the field rate than the frame rate.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
double(* duration_error)[2][MAX_STD_TIMEBASES]
int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, int search_flags)
void av_buffer_default_free(void *opaque, uint8_t *data)
Default free callback, which calls av_free() on the buffer data.
int avpriv_h264_has_num_reorder_frames(AVCodecContext *avctx)
int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Return decoded output data from a decoder.
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src)
Copy the contents of src to dst.
int64_t timestamp
Timestamp in AVStream.time_base units, preferably the time from which on correctly decoded frames are...
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define AVIO_FLAG_WRITE
write-only
int av_read_play(AVFormatContext *s)
Start playing a network-based stream (e.g.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
enum AVStreamParseType need_parsing
AVRational time_base_in
The timebase used for the timestamps of the input packets.
struct AVCodecParserContext * parser
int avformat_flush(AVFormatContext *s)
Discard all internally buffered data.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
int min_distance
Minimum distance between this and the previous keyframe, used to avoid unneeded searching.
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int size)
Allocate new information of a packet.
int64_t first_discard_sample
If not 0, the first audio sample that should be discarded from the stream.
int avctx_inited
1 if avctx has been initialized with the values from the codec parameters
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
int64_t max_analyze_duration
Maximum duration (in AV_TIME_BASE units) of the data read from input in avformat_find_stream_info().
int props
Codec properties, a combination of AV_CODEC_PROP_* flags.
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
int repeat_pict
This field is used for proper frame duration computation in lavf.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option keep it simple and lowercase description are in without and describe what they for example set the foo of the bar offset is the offset of the field in your context
@ AVDISCARD_ALL
discard all
int update_initial_durations_done
Internal data to prevent doing update_initial_durations() twice.
#define AV_CODEC_PROP_INTRA_ONLY
Codec uses only intra compression.
AVBufferRef * buf
A reference to the reference-counted buffer where the packet data is stored.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Describe the class of an AVClass context structure.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
static void flush(AVCodecContext *avctx)
int av_match_list(const char *name, const char *list, char separator)
Check if a name is in a list.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
int fps_probe_size
The number of frames used for determining the framerate in avformat_find_stream_info().
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer.
Rational number (pair of numerator and denominator).
char * protocol_whitelist
',' separated list of allowed protocols.
int64_t bit_rate
the average bitrate
enum AVPacketSideDataType type
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.
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.
@ AV_PICTURE_TYPE_I
Intra.
int ff_id3v2_parse_apic(AVFormatContext *s, ID3v2ExtraMeta *extra_meta)
Create a stream for each APIC (attached picture) extracted from the ID3v2 header.
AVIOContext * pb
I/O context.
#define AVERROR_BSF_NOT_FOUND
Bitstream filter not found.
This structure contains the data a format has to probe a file.
unsigned int * stream_index
const AVClass * priv_class
A class for the private data, used to declare bitstream filter private AVOptions.
@ AV_ROUND_NEAR_INF
Round to nearest and halfway cases away from zero.
int avio_pause(AVIOContext *h, int pause)
Pause and resume playing - only meaningful if using a network streaming protocol (e....
void av_opt_free(void *obj)
Free all allocated objects in obj.
int av_parse_time(int64_t *timeval, const char *timestr, int duration)
Parse timestr and return in *time a corresponding number of microseconds.
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
int skip_estimate_duration_from_pts
Skip duration calcuation in estimate_timings_from_pts.
int64_t pts_reorder_error[MAX_REORDER_DELAY+1]
Internal data to generate dts from pts.
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
Move every field in src to dst and reset src.
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
int sample_rate
Audio only.
AVCodecParameters * avcodec_parameters_alloc(void)
Allocate a new AVCodecParameters and set its fields to default values (unknown/invalid/0).
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
int64_t nb_frames
number of frames in this stream if known or 0
AVCodecID
Identify the syntax and semantics of the bitstream.
int extradata_size
Size of the extradata content in bytes.
@ AV_AUDIO_SERVICE_TYPE_KARAOKE
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
int av_strncasecmp(const char *a, const char *b, size_t n)
Locale-independent case-insensitive compare.
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)
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 lowres
low resolution decoding, 1-> 1/2 size, 2->1/4 size
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
const OptionDef options[]
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
Read packets of a media file to get stream information.
#define av_ts2timestr(ts, tb)
Convenience macro, the return value should be used only directly in function arguments but never stan...
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.
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
uint8_t * av_stream_get_side_data(const AVStream *st, enum AVPacketSideDataType type, int *size)
Get side information from stream.
static int64_t start_time
enum AVSampleFormat sample_fmt
audio sample format
#define AV_MUTEX_INITIALIZER
int probe_packets
Number of packets to buffer for codec probing.
int avpriv_codec_get_cap_skip_frame_fill_param(const AVCodec *codec)
int64_t pts_buffer[MAX_REORDER_DELAY+1]
#define ID3v2_DEFAULT_MAGIC
Default magic bytes for ID3v2 header: "ID3".
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.
#define AV_NOPTS_VALUE
Undefined timestamp value.
AVRational av_guess_frame_rate(AVFormatContext *format, AVStream *st, AVFrame *frame)
Guess the frame rate, based on both the container and codec information.
AVRational av_stream_get_codec_timebase(const AVStream *st)
Get the internal codec timebase from a stream.
int av_probe_input_buffer2(AVIOContext *pb, ff_const59 AVInputFormat **fmt, const char *url, void *logctx, unsigned int offset, unsigned int max_probe_size)
Probe a bytestream to determine the input format.
@ AVMEDIA_TYPE_UNKNOWN
Usually treated as AVMEDIA_TYPE_DATA.
@ AV_PICTURE_TYPE_NONE
Undefined.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
static av_const int av_isdigit(int c)
Locale-independent conversion of ASCII isdigit.
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
static int ff_mutex_lock(AVMutex *mutex)
int av_packet_make_refcounted(AVPacket *pkt)
Ensure the data described by a given packet is reference counted.
int flags
A combination of AV_PKT_FLAG values.
struct AVStreamInternal::@256 extract_extradata
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
#define AV_FRAME_FILENAME_FLAGS_MULTIPLE
Allow multiple d.
#define AV_LOG_INFO
Standard information.
int channels
number of audio channels
AVPacketSideData * side_data
An array of side data that applies to the whole stream (i.e.
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory.
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
uint8_t pts_reorder_error_count[MAX_REORDER_DELAY+1]
int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt)
Supply raw packet data as input to a decoder.
int avio_closep(AVIOContext **s)
Close the resource accessed by the AVIOContext *s, free it and set the pointer pointing to it to NULL...
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
int64_t bytes_read
Bytes read statistic This field is internal to libavformat and access from outside is not allowed.
int64_t pos
Byte position of currently parsed frame in stream.
#define PARSER_FLAG_COMPLETE_FRAMES
int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt)
Retrieve a filtered packet.
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
unsigned properties
Properties of the stream that gets decoded.
int avformat_open_input(AVFormatContext **ps, const char *filename, ff_const59 AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
int nb_decoded_frames
Number of internally decoded frames, used internally in libavformat, do not access its lifetime diffe...
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
int64_t last_dts_for_order_check
Internal data to analyze DTS and detect faulty mpeg streams.
int avcodec_parameters_to_context(AVCodecContext *codec, const AVCodecParameters *par)
Fill the codec context based on the values from the supplied codec parameters.
@ AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED
#define AV_TIME_BASE
Internal time base represented as integer.
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.
@ AV_AUDIO_SERVICE_TYPE_EFFECTS
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
char * codec_whitelist
',' separated list of allowed decoders.
@ AV_ROUND_DOWN
Round toward -infinity.
static av_const int av_toupper(int c)
Locale-independent conversion of ASCII characters to uppercase.
@ AVMEDIA_TYPE_ATTACHMENT
Opaque data information usually sparse.
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.
int av_find_default_stream_index(AVFormatContext *s)
int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
Return audio frame duration.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
New fields can be added to the end with minor version bumps.
const char * name
Name of the codec implementation.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
@ AV_PKT_DATA_SKIP_SAMPLES
Recommmends skipping the specified number of samples.
int av_read_pause(AVFormatContext *s)
Pause a network-based stream (e.g.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
const AVOption * av_opt_next(const void *obj, const AVOption *last)
Iterate over all AVOptions belonging to obj.
const AVCodec * av_codec_iterate(void **opaque)
Iterate over all registered codecs.
enum AVFieldOrder field_order
Video only.
int skip_samples
Number of samples to skip at the start of the frame decoded from the next packet.
void * priv_data
Opaque filter-specific private data.
int disposition
AV_DISPOSITION_* bit field.
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.
int id
Format-specific stream ID.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
int nb_side_data
The number of elements in the AVStream.side_data array.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option keep it simple and lowercase description are in lowercase
AVPacketSideData * side_data
Additional packet data that can be provided by the container.
#define AV_INPUT_BUFFER_PADDING_SIZE
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
Submit a packet for filtering.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
@ AV_AUDIO_SERVICE_TYPE_COMMENTARY
int inject_global_side_data
Internal data to inject global side data.
int avformat_network_deinit(void)
Undo the initialization done by avformat_network_init.
main external API structure.
int index
stream index in AVFormatContext
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.
int found_decoder
0 -> decoder has not been searched for yet.
struct AVStream::@240 * info
Stream information used internally by avformat_find_stream_info()
@ AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
#define AVERROR_STREAM_NOT_FOUND
Stream not found.
@ AV_PKT_DATA_NEW_EXTRADATA
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
int av_match_name(const char *name, const char *names)
Match instances of a name in a comma-separated list of names.
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
AVRational display_aspect_ratio
display aspect ratio (0 if unknown)
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
#define PARSER_FLAG_USE_CODEC_TS
static int ref[MAX_W *MAX_W]
AVRational r_frame_rate
Real base framerate of the stream.
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...
int64_t rfps_duration_sum
int request_probe
stream probing state -1 -> probing finished 0 -> no probing requested rest -> perform probing with re...
ff_const59 AVInputFormat * av_probe_input_format2(ff_const59 AVProbeData *pd, int is_opened, int *score_max)
Guess the file format.
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
const char * avformat_license(void)
Return the libavformat license.
int64_t av_gettime(void)
Get the current time in microseconds.
static int shift(int a, int b)
#define FF_DISABLE_DEPRECATION_WARNINGS
const struct AVBitStreamFilter * filter
The bitstream filter this context is an instance of.
#define AVERROR_DECODER_NOT_FOUND
Decoder not found.
#define AVIO_FLAG_READ
read-only
int coded_width
Bitstream width / height, may be different from width/height e.g.
enum AVMediaType codec_type
char * av_strdup(const char *s)
Duplicate a string.
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.
int need_context_update
Whether the internal avctx needs to be updated from codecpar (after a late change to codecpar)
enum AVCodecID orig_codec_id
const char * avformat_configuration(void)
Return the libavformat build-time configuration.
static av_always_inline int diff(const uint32_t a, const uint32_t b)
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
#define FF_MAX_EXTRADATA_SIZE
Maximum size in bytes of extradata.
@ AV_ROUND_PASS_MINMAX
Flag telling rescaling functions to pass INT64_MIN/MAX through unchanged, avoiding special cases for ...
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
void avcodec_parameters_free(AVCodecParameters **ppar)
Free an AVCodecParameters instance and everything associated with it and write NULL to the supplied p...
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
void ff_id3v2_free_extra_meta(ID3v2ExtraMeta **extra_meta)
Free memory allocated parsing special (non-text) metadata.
int64_t pos
byte position in stream, -1 if unknown
uint64_t channel_layout
Audio only.
void av_bsf_free(AVBSFContext **pctx)
Free a bitstream filter context and everything associated with it; write NULL into the supplied point...
const char * avio_find_protocol_name(const char *url)
Return the name of the protocol that will handle the passed URL.
int width
picture width / height.
static float distance(float x, float y, int band)
#define flags(name, subs,...)
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.
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
int ff_id3v2_parse_priv(AVFormatContext *s, ID3v2ExtraMeta *extra_meta)
Add metadata for all PRIV tags in the ID3v2 header.
int64_t start_time
Position of the first frame of the component, in AV_TIME_BASE fractional seconds.
#define AV_CODEC_CAP_AVOID_PROBING
Decoder is not a preferred choice for probing.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define av_ts2str(ts)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
char * av_strndup(const char *s, size_t len)
Duplicate a substring of a string.
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
@ AV_CODEC_ID_MPEG2VIDEO
preferred ID for MPEG-1/2 video decoding
int codec_info_nb_frames
Number of frames that have been demuxed during avformat_find_stream_info()
void * priv_data
Format private data.
int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp)
Set a dictionary value to an ISO-8601 compliant timestamp string.
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.
ff_const59 AVInputFormat * av_probe_input_format3(ff_const59 AVProbeData *pd, int is_opened, int *score_ret)
Guess the file format.
int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **pctx)
Allocate a context for a given bitstream filter.
unsigned int index_entries_allocated_size
int64_t fps_first_dts
Those are used for average framerate estimation.
static AVCodecContext * dec_ctx
void av_parser_close(AVCodecParserContext *s)
void av_init_packet(AVPacket *pkt)
Initialize optional fields of a packet with default values.
int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp, int flags)
Get the index for a specific timestamp.
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.