69 return FFMPEG_CONFIGURATION;
74 #define LICENSE_PREFIX "libavformat license: "
78 #define RELATIVE_TS_BASE (INT64_MAX - (1LL<<48))
96 timestamp < st->pts_wrap_reference)
109 MAKE_ACCESSORS(AVFormatContext, format, AVCodec *, subtitle_codec)
110 MAKE_ACCESSORS(AVFormatContext, format,
int, metadata_header_padding)
139 if ( (src-> codec_whitelist && !dst-> codec_whitelist)
173 #define SANE_CHUNK_SIZE (50000000)
179 if (remaining < size) {
182 s->
maxsize = newsize - !newsize;
184 remaining=
FFMAX(remaining, 0);
187 if (s->
maxsize>= 0 && remaining+1 < size) {
199 int64_t orig_pos = pkt->
pos;
200 int orig_size = pkt->
size;
204 int prev_size = pkt->
size;
222 if (ret != read_size) {
235 return pkt->
size > orig_size ? pkt->
size - orig_size :
ret;
265 static const struct {
288 "Probe with size=%d, packets=%d detected %s with score=%d\n",
291 for (i = 0; fmt_id_type[i].name; i++) {
292 if (!strcmp(fmt->
name, fmt_id_type[i].name)) {
340 "will be ignored with AVFMT_NOFILE format.\n");
365 (*plast_pktl)->next = pktl;
367 *packet_buffer = pktl;
382 if (copy.
size <= 0) {
384 "Attached picture on stream %d has invalid size, "
409 av_log(NULL,
AV_LOG_ERROR,
"Input context has not been properly allocated by avformat_alloc_context() and is not NULL either\n");
421 if ((ret =
init_input(s, filename, &tmp)) < 0)
466 if (id3v2_extra_meta) {
533 "Failed to reallocate probe buffer for stream %d\n",
546 "nothing to probe for stream %d\n", st->
index);
573 int64_t ref = pkt->
dts;
574 int i, pts_wrap_behavior;
575 int64_t pts_wrap_reference;
593 if (!first_program) {
618 program = first_program;
662 if (!pktl || ret ==
AVERROR(EAGAIN))
677 "Dropped corrupted packet (stream = %d)\n",
746 switch (st->codec->codec_type) {
748 if (st->r_frame_rate.num && !pc) {
749 *pnum = st->r_frame_rate.den;
750 *pden = st->r_frame_rate.num;
751 }
else if (st->time_base.num * 1000LL > st->time_base.den) {
752 *pnum = st->time_base.num;
753 *pden = st->time_base.den;
754 }
else if (codec_framerate.den * 1000LL > codec_framerate.num) {
758 codec_framerate.num * (int64_t)st->codec->ticks_per_frame,
761 if (pc && pc->repeat_pict) {
764 (*pnum) * (1LL + pc->repeat_pict),
771 if (st->codec->ticks_per_frame > 1 && !pc)
777 if (frame_size <= 0 || st->codec->sample_rate <= 0)
780 *pden = st->codec->sample_rate;
808 #if CONFIG_H264_DECODER
839 int64_t best_score = INT64_MAX;
840 for (i = 0; i<delay; i++) {
843 if (score < best_score) {
850 for (i = 0; i<delay; i++) {
852 int64_t diff =
FFABS(pts_buffer[i] - dts)
911 pts_buffer[0] = pktl->
pkt.
pts;
912 for (i = 0; i<delay && pts_buffer[i] > pts_buffer[i + 1]; i++)
913 FFSWAP(int64_t, pts_buffer[i], pts_buffer[i + 1]);
944 av_log(s,
AV_LOG_DEBUG,
"first_dts %s not matching first dts %s (pts %s, duration %d) in the queue\n",
979 int num, den, presentation_delayed, delay, i;
994 "DTS %"PRIi64
" < %"PRIi64
" out of order\n",
1020 presentation_delayed = 0;
1026 presentation_delayed = 1;
1041 if (delay == 1 && pkt->
dts == pkt->
pts &&
1044 if ( strcmp(s->
iformat->
name,
"mov,mp4,m4a,3gp,3g2,mj2")
1079 presentation_delayed = 1;
1082 "IN delayed:%d pts:%s, dts:%s cur_dts:%s st:%d pc:%p duration:%d delay:%d onein_oneout:%d\n",
1087 if ((delay == 0 || (delay == 1 && pc)) &&
1089 if (presentation_delayed) {
1139 av_dlog(NULL,
"OUTdelayed:%d/%d pts:%s, dts:%s cur_dts:%s\n",
1153 *pkt_buf = pktl->
next;
1157 *pkt_buf_end = NULL;
1171 int ret = 0, got_output = 0;
1182 while (size > 0 || (pkt == &
flush_pkt && got_output)) {
1187 &out_pkt.
data, &out_pkt.
size, data, size,
1196 got_output = !!out_pkt.
size;
1241 #if FF_API_DESTRUCT_PACKET
1277 *pkt_buffer = pktl->
next;
1279 *pkt_buffer_end = NULL;
1291 int ret = 0, i, got_packet = 0;
1320 cur_pkt.
pts < cur_pkt.
dts) {
1322 "Invalid timestamps stream=%d, pts=%s, dts=%s, size=%d\n",
1330 "ff_read_packet stream=%d, pts=%s, dts=%s, size=%d, duration=%d, flags=%d\n",
1340 "%s, packets or times may be invalid.\n",
1386 int discard_padding = 0;
1391 int64_t end_sample = sample +
duration;
1393 sample < st->last_discard_sample)
1400 AV_WL32(p + 4, discard_padding);
1420 memcpy(dst_data, src_sd->
data, src_sd->
size);
1439 "read_frame_internal stream=%d, pts=%s, dts=%s, "
1440 "size=%d, duration=%d, flags=%d\n",
1476 int64_t last_dts = next_pkt->
dts;
1486 last_dts = pktl->
pkt.
dts;
1514 if (pktl && ret !=
AVERROR(EAGAIN)) {
1559 int best_stream = 0;
1560 int best_score = -1;
1581 if (score > best_score) {
1651 int *nb_index_entries,
1652 unsigned int *index_entries_allocated_size,
1653 int64_t pos, int64_t timestamp,
1659 if ((
unsigned) *nb_index_entries + 1 >= UINT_MAX /
sizeof(
AVIndexEntry))
1672 index_entries_allocated_size,
1673 (*nb_index_entries + 1) *
1678 *index_entries = entries;
1684 index = (*nb_index_entries)++;
1685 ie = &entries[
index];
1686 av_assert0(index == 0 || ie[-1].timestamp < timestamp);
1688 ie = &entries[
index];
1692 memmove(entries + index + 1, entries + index,
1694 (*nb_index_entries)++;
1695 }
else if (ie->
pos == pos && distance < ie->min_distance)
1715 timestamp, size, distance, flags);
1719 int64_t wanted_timestamp,
int flags)
1728 if (b && entries[b - 1].timestamp < wanted_timestamp)
1734 if (timestamp >= wanted_timestamp)
1736 if (timestamp <= wanted_timestamp)
1742 while (m >= 0 && m < nb_entries &&
1746 if (m == nb_entries)
1754 wanted_timestamp, flags);
1758 int64_t (*read_timestamp)(
struct AVFormatContext *,
int , int64_t *, int64_t ))
1760 int64_t ts = read_timestamp(s, stream_index, ppos, pos_limit);
1761 if (stream_index >= 0)
1767 int64_t target_ts,
int flags)
1771 int64_t ts_min, ts_max, ts;
1776 if (stream_index < 0)
1785 st = s->
streams[stream_index];
1793 index =
FFMAX(index, 0);
1799 av_dlog(s,
"using cached pos_min=0x%"PRIx64
" dts_min=%s\n",
1814 av_dlog(s,
"using cached pos_max=0x%"PRIx64
" pos_limit=0x%"PRIx64
1815 " dts_max=%s\n", pos_max, pos_limit,
av_ts2str(ts_max));
1819 pos =
ff_gen_search(s, stream_index, target_ts, pos_min, pos_max, pos_limit,
1835 int64_t (*read_timestamp)(
struct AVFormatContext *,
int , int64_t *, int64_t ))
1837 int64_t step = 1024;
1838 int64_t limit, ts_max;
1840 int64_t pos_max = filesize - 1;
1843 pos_max =
FFMAX(0, (pos_max) - step);
1845 &pos_max, limit, read_timestamp);
1852 int64_t tmp_pos = pos_max + 1;
1854 &tmp_pos, INT64_MAX, read_timestamp);
1860 if (tmp_pos >= filesize)
1873 int64_t pos_min, int64_t pos_max, int64_t pos_limit,
1874 int64_t ts_min, int64_t ts_max,
1875 int flags, int64_t *ts_ret,
1877 int64_t *, int64_t))
1888 ts_min =
ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp);
1893 if (ts_min >= target_ts) {
1899 if ((ret =
ff_find_last_ts(s, stream_index, &ts_max, &pos_max, read_timestamp)) < 0)
1901 pos_limit = pos_max;
1904 if (ts_max <= target_ts) {
1909 if (ts_min > ts_max)
1911 else if (ts_min == ts_max)
1912 pos_limit = pos_min;
1915 while (pos_min < pos_limit) {
1917 "pos_min=0x%"PRIx64
" pos_max=0x%"PRIx64
" dts_min=%s dts_max=%s\n",
1919 assert(pos_limit <= pos_max);
1921 if (no_change == 0) {
1922 int64_t approximate_keyframe_distance = pos_max - pos_limit;
1924 pos =
av_rescale(target_ts - ts_min, pos_max - pos_min,
1926 pos_min - approximate_keyframe_distance;
1927 }
else if (no_change == 1) {
1929 pos = (pos_min + pos_limit) >> 1;
1937 else if (pos > pos_limit)
1947 av_dlog(s,
"%"PRId64
" %"PRId64
" %"PRId64
" / %s %s %s"
1948 " target:%s limit:%"PRId64
" start:%"PRId64
" noc:%d\n",
1949 pos_min, pos, pos_max,
1951 pos_limit, start_pos, no_change);
1956 if (target_ts <= ts) {
1957 pos_limit = start_pos - 1;
1961 if (target_ts >= ts) {
1971 ts_min =
ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp);
1973 ts_max =
ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp);
1974 av_dlog(s,
"pos=0x%"PRIx64
" %s<=%s<=%s\n",
1982 int64_t pos,
int flags)
1984 int64_t pos_min, pos_max;
1991 else if (pos > pos_max)
2002 int64_t timestamp,
int flags)
2009 st = s->
streams[stream_index];
2013 if (index < 0 && st->nb_index_entries &&
2014 timestamp < st->index_entries[0].timestamp)
2017 if (index < 0 || index == st->nb_index_entries - 1) {
2035 }
while (read_status ==
AVERROR(EAGAIN));
2036 if (read_status < 0)
2043 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);
2066 int64_t timestamp,
int flags)
2078 if (stream_index < 0) {
2080 if (stream_index < 0)
2083 st = s->
streams[stream_index];
2110 int64_t timestamp,
int flags)
2115 int64_t min_ts = INT64_MIN, max_ts = INT64_MAX;
2121 flags & ~AVSEEK_FLAG_BACKWARD);
2133 int64_t ts, int64_t max_ts,
int flags)
2135 if (min_ts > ts || max_ts < ts)
2137 if (stream_index < -1 || stream_index >= (
int)s->
nb_streams)
2148 if (stream_index == -1 && s->
nb_streams == 1) {
2155 time_base.
num * (int64_t)AV_TIME_BASE,
2176 if (ret<0 && ts != min_ts && max_ts != ts) {
2177 ret =
av_seek_frame(s, stream_index, dir ? max_ts : min_ts, flags | dir);
2217 int64_t
start_time, start_time1, start_time_text, end_time, end_time1;
2218 int64_t
duration, duration1, filesize;
2223 start_time = INT64_MAX;
2224 start_time_text = INT64_MAX;
2225 end_time = INT64_MIN;
2226 duration = INT64_MIN;
2233 if (start_time1 < start_time_text)
2234 start_time_text = start_time1;
2236 start_time =
FFMIN(start_time, start_time1);
2239 end_time1 = start_time1 +
2242 end_time =
FFMAX(end_time, end_time1);
2254 duration =
FFMAX(duration, duration1);
2257 if (start_time == INT64_MAX || (start_time > start_time_text && start_time - start_time_text <
AV_TIME_BASE))
2258 start_time = start_time_text;
2259 else if (start_time > start_time_text)
2262 if (start_time != INT64_MAX) {
2264 if (end_time != INT64_MIN) {
2272 duration =
FFMAX(duration, end_time - start_time);
2280 double bitrate = (double) filesize * 8.0 * AV_TIME_BASE /
2282 if (bitrate >= 0 && bitrate <= INT_MAX)
2309 int i, show_warning = 0;
2349 "Estimating duration from bitrate, this may be inaccurate\n");
2352 #define DURATION_MAX_READ_SIZE 250000LL
2353 #define DURATION_MAX_RETRY 4
2360 int num, den, read_size, i,
ret;
2361 int found_duration = 0;
2375 "start time for stream %d is not set in estimate_timings_from_pts\n", i);
2388 is_end = found_duration;
2401 }
while (ret ==
AVERROR(EAGAIN));
2404 read_size += pkt->
size;
2461 av_log(ic,
AV_LOG_DEBUG,
"stream %d : no PTS found at end of file, duration not set\n", i);
2463 av_log(ic,
AV_LOG_DEBUG,
"stream %d : no TS found at start of file, duration not set\n", i);
2491 file_size =
FFMAX(0, file_size);
2517 av_dlog(ic,
"%d: start_time: %0.3f duration: %0.3f\n", i,
2522 "stream: start_time: %0.3f duration: %0.3f bitrate=%d kb/s\n",
2533 #define FAIL(errmsg) do { \
2535 *errmsg_ptr = errmsg; \
2541 FAIL(
"unknown codec");
2545 FAIL(
"unspecified frame size");
2548 FAIL(
"unspecified sample format");
2550 FAIL(
"unspecified sample rate");
2552 FAIL(
"unspecified number of channels");
2554 FAIL(
"no decodable DTS frames");
2558 FAIL(
"unspecified size");
2560 FAIL(
"unspecified pixel format");
2563 FAIL(
"no frame in rv30/40 and no sar");
2567 FAIL(
"unspecified size");
2581 int got_picture = 1,
ret = 0;
2604 av_dict_set(options ? options : &thread_opt,
"threads",
"1", 0);
2623 while ((pkt.
size > 0 || (!pkt.
data && got_picture)) &&
2632 &got_picture, &pkt);
2639 &got_picture, &pkt);
2654 if (!pkt.
data && !got_picture)
2676 if (tag == tags[i].tag)
2698 if (sflags & (1 << (bps - 1))) {
2740 for (i = 0; tags && tags[i]; i++) {
2743 if (codec_tags->
id ==
id) {
2744 *tag = codec_tags->
tag;
2756 for (i = 0; tags && tags[i]; i++) {
2781 if (j != i && next_start > ch->
start && next_start < end)
2784 ch->
end = (end == INT64_MAX) ? ch->
start : end;
2791 return (i + 1) * 1001;
2795 return ((
const int[]) { 40, 48, 50, 60, 80, 120, 240})[i] * 1001 * 12;
2799 return ((
const int[]) { 24, 30, 60, 12, 15, 48 })[i] * 1000 * 12;
2864 && ts - (uint64_t)last < INT64_MAX) {
2878 double sdts = dts*framerate/(1001*12);
2879 for (j= 0; j<2; j++) {
2880 int64_t ticks =
llrint(sdts+j*0.5);
2881 double error= sdts - ticks + j*0.5;
2898 if (error0 > 0.04 && error1 > 0.04) {
2933 double best_error= 0.01;
2947 for (k= 0; k<2; k++) {
2952 if (error < best_error && best_error> 0.000000001) {
2961 if (num && (!ref_rate.
num || (
double)num/(12*1001) < 1.01 *
av_q2d(ref_rate)))
2992 int64_t max_stream_analyze_duration;
2995 if (!max_analyze_duration)
2999 flush_codecs = probesize > 0;
3003 max_stream_analyze_duration = max_analyze_duration;
3004 if (!max_analyze_duration) {
3005 max_stream_analyze_duration =
3012 av_log(ic,
AV_LOG_DEBUG,
"Before avformat_find_stream_info() pos: %"PRId64
" bytes read:%"PRId64
" seeks:%d\n",
3038 "%s, packets or times may be invalid.\n",
3046 av_dict_set(options ? &options[i] : &thread_opt,
"threads",
"1", 0);
3056 "Failed to open codec in av_find_stream_info\n");
3064 "Failed to open codec in av_find_stream_info\n");
3071 #if FF_API_R_FRAME_RATE
3081 int analyzed_all_streams;
3090 int fps_analyze_framecount = 20;
3099 fps_analyze_framecount *= 2;
3101 fps_analyze_framecount = 0;
3105 fps_analyze_framecount = 0;
3121 analyzed_all_streams = 0;
3123 analyzed_all_streams = 1;
3135 if (read_size >= probesize) {
3138 "Probe buffer size limit of %"PRId64
" bytes reached\n", probesize);
3145 "Stream #%d: not enough frames to estimate rate; "
3146 "consider increasing probesize\n", i);
3168 goto find_stream_info_err;
3171 goto find_stream_info_err;
3176 read_size += pkt->
size;
3183 "Non-increasing DTS in stream %d: packet %d with DTS "
3184 "%"PRId64
", packet %d with DTS %"PRId64
"\n",
3200 "DTS discontinuity in stream %d: packet %d with DTS "
3201 "%"PRId64
", packet %d with DTS %"PRId64
"\n",
3231 if (t >= (analyzed_all_streams ? max_analyze_duration : max_stream_analyze_duration)) {
3232 av_log(ic,
AV_LOG_VERBOSE,
"max_analyze_duration %"PRId64
" reached at %"PRId64
" microseconds\n",
3233 max_analyze_duration,
3244 #if FF_API_R_FRAME_RATE
3268 (options && i < orig_nb_streams) ? &options[i] : NULL);
3290 (options && i < orig_nb_streams)
3291 ? &options[i] : NULL);
3296 "decoding for stream %d failed\n", st->
index);
3324 double best_error = 0.01;
3341 if (error < best_error) {
3343 best_fps = std_fps.
num;
3348 best_fps, 12 * 1001, INT_MAX);
3406 "Could not find codec parameters for stream %d (%s): %s\n"
3407 "Consider increasing the value for the 'analyzeduration' and 'probesize' options\n",
3416 find_stream_info_err:
3426 av_log(ic,
AV_LOG_DEBUG,
"After avformat_find_stream_info() pos: %"PRId64
" bytes read:%"PRId64
" seeks:%d frames:%d\n",
3449 int wanted_stream_nb,
int related_stream,
3450 AVCodec **decoder_ret,
int flags)
3454 unsigned *program = NULL;
3457 if (related_stream >= 0 && wanted_stream_nb < 0) {
3465 int real_stream_index = program ? program[i] : i;
3470 if (wanted_stream_nb >= 0 && real_stream_index != wanted_stream_nb)
3472 if (wanted_stream_nb != real_stream_index &&
3491 if ((best_multiframe > multiframe) ||
3492 (best_multiframe == multiframe && best_bitrate > bitrate) ||
3493 (best_multiframe == multiframe && best_bitrate == bitrate && best_count >=
count))
3496 best_bitrate = bitrate;
3497 best_multiframe = multiframe;
3498 ret = real_stream_index;
3500 if (program && i == nb_streams - 1 && ret < 0) {
3508 *decoder_ret = (
AVCodec*)best_decoder;
3630 if (s->
nb_streams >= INT_MAX/
sizeof(*streams))
3675 #if FF_API_R_FRAME_RATE
3692 av_dlog(ac,
"new_program: id=0x%04x\n",
id);
3716 int64_t
start, int64_t
end,
const char *title)
3722 av_log(s,
AV_LOG_ERROR,
"Chapter end time %"PRId64
" before start %"PRId64
"\n", end, start);
3781 char *q, buf1[20],
c;
3782 int nd,
len, percentd_found;
3795 nd = nd * 10 + *p++ -
'0';
3806 snprintf(buf1,
sizeof(buf1),
"%0*d", nd, number);
3808 if ((q - buf + len) > buf_size - 1)
3810 memcpy(q, buf1, len);
3818 if ((q - buf) < buf_size - 1)
3822 if (!percentd_found)
3832 char *authorization,
int authorization_size,
3833 char *hostname,
int hostname_size,
3834 int *port_ptr,
char *path,
int path_size,
const char *url)
3836 const char *p, *ls, *ls2, *at, *at2, *col, *brk;
3842 if (authorization_size > 0)
3843 authorization[0] = 0;
3844 if (hostname_size > 0)
3850 if ((p = strchr(url,
':'))) {
3864 ls = strchr(p,
'/');
3865 ls2 = strchr(p,
'?');
3869 ls =
FFMIN(ls, ls2);
3879 while ((at = strchr(p,
'@')) && at < ls) {
3881 FFMIN(authorization_size, at + 1 - at2));
3885 if (*p ==
'[' && (brk = strchr(p,
']')) && brk < ls) {
3888 FFMIN(hostname_size, brk - p));
3889 if (brk[1] ==
':' && port_ptr)
3890 *port_ptr = atoi(brk + 2);
3891 }
else if ((col = strchr(p,
':')) && col < ls) {
3893 FFMIN(col + 1 - p, hostname_size));
3895 *port_ptr = atoi(col + 1);
3898 FFMIN(ls + 1 - p, hostname_size));
3905 static const char hex_table_uc[16] = {
'0',
'1',
'2',
'3',
3908 'C',
'D',
'E',
'F' };
3909 static const char hex_table_lc[16] = {
'0',
'1',
'2',
'3',
3912 'c',
'd',
'e',
'f' };
3913 const char *hex_table = lowercase ? hex_table_lc : hex_table_uc;
3915 for (i = 0; i <
s; i++) {
3916 buff[i * 2] = hex_table[src[i] >> 4];
3917 buff[i * 2 + 1] = hex_table[src[i] & 0xF];
3934 if (c >=
'0' && c <=
'9')
3936 else if (c >=
'A' && c <=
'F')
3952 unsigned int pts_num,
unsigned int pts_den)
3956 if (new_tb.
num != pts_num)
3958 "st:%d removing common factor %d from timebase\n",
3962 "st:%d has too large timebase, reducing\n", s->
index);
3964 if (new_tb.
num <= 0 || new_tb.
den <= 0) {
3966 "Ignoring attempt to set invalid timebase %d/%d for st:%d\n",
3979 const char *ptr = str;
3984 char *dest = NULL, *dest_end;
3985 int key_len, dest_len = 0;
3988 while (*ptr && (
av_isspace(*ptr) || *ptr ==
','))
3995 if (!(ptr = strchr(key,
'=')))
3998 key_len = ptr - key;
4000 callback_get_buf(context, key, key_len, &dest, &dest_len);
4001 dest_end = dest + dest_len - 1;
4005 while (*ptr && *ptr !=
'\"') {
4009 if (dest && dest < dest_end)
4013 if (dest && dest < dest_end)
4021 for (; *ptr && !(
av_isspace(*ptr) || *ptr ==
','); ptr++)
4022 if (dest && dest < dest_end)
4041 struct tm time1 = { 0 }, time2 = { 0 };
4056 return ofmt->
query_codec(codec_id, std_compliance);
4101 if (channel_layout) {
4109 if (width || height) {
4116 bytestream_put_le32(&data, flags);
4118 bytestream_put_le32(&data, channels);
4120 bytestream_put_le64(&data, channel_layout);
4122 bytestream_put_le32(&data, sample_rate);
4123 if (width || height) {
4124 bytestream_put_le32(&data, width);
4125 bytestream_put_le32(&data, height);
4137 av_reduce(&stream_sample_aspect_ratio.
num, &stream_sample_aspect_ratio.
den,
4138 stream_sample_aspect_ratio.
num, stream_sample_aspect_ratio.
den, INT_MAX);
4139 if (stream_sample_aspect_ratio.
num <= 0 || stream_sample_aspect_ratio.
den <= 0)
4140 stream_sample_aspect_ratio = undef;
4142 av_reduce(&frame_sample_aspect_ratio.
num, &frame_sample_aspect_ratio.
den,
4143 frame_sample_aspect_ratio.
num, frame_sample_aspect_ratio.
den, INT_MAX);
4144 if (frame_sample_aspect_ratio.
num <= 0 || frame_sample_aspect_ratio.
den <= 0)
4145 frame_sample_aspect_ratio = undef;
4147 if (stream_sample_aspect_ratio.
num)
4148 return stream_sample_aspect_ratio;
4150 return frame_sample_aspect_ratio;
4159 if (avg_fr.
num > 0 && avg_fr.
den > 0 && fr.
num > 0 && fr.
den > 0 &&
4177 if (*spec <= '9' && *spec >=
'0')
4178 return strtol(spec, NULL, 0) == st->
index;
4179 else if (*spec ==
'v' || *spec ==
'a' || *spec ==
's' || *spec ==
'd' ||
4193 if (*spec++ ==
':') {
4194 int i,
index = strtol(spec, NULL, 0);
4197 return i == st->
index;
4201 }
else if (*spec ==
'p' && *(spec + 1) ==
':') {
4205 prog_id = strtol(spec, &endptr, 0);
4210 if (*endptr++ ==
':') {
4211 int stream_idx = strtol(endptr, NULL, 0);
4212 return stream_idx >= 0 &&
4222 }
else if (*spec ==
'#' ||
4223 (*spec ==
'i' && *(spec + 1) ==
':')) {
4226 spec += 1 + (*spec ==
'i');
4227 stream_id = strtol(spec, &endptr, 0);
4229 return stream_id == st->
id;
4230 }
else if (*spec ==
'm' && *(spec + 1) ==
':') {
4236 val = strchr(spec,
':');
4244 if (!val || !strcmp(tag->
value, val + 1))
4262 static const uint8_t avci100_1080p_extradata[] = {
4264 0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
4265 0xb6, 0xd4, 0x20, 0x22, 0x33, 0x19, 0xc6, 0x63,
4266 0x23, 0x21, 0x01, 0x11, 0x98, 0xce, 0x33, 0x19,
4267 0x18, 0x21, 0x02, 0x56, 0xb9, 0x3d, 0x7d, 0x7e,
4268 0x4f, 0xe3, 0x3f, 0x11, 0xf1, 0x9e, 0x08, 0xb8,
4269 0x8c, 0x54, 0x43, 0xc0, 0x78, 0x02, 0x27, 0xe2,
4270 0x70, 0x1e, 0x30, 0x10, 0x10, 0x14, 0x00, 0x00,
4271 0x03, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0xca,
4272 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4274 0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x33, 0x48,
4277 static const uint8_t avci100_1080i_extradata[] = {
4279 0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
4280 0xb6, 0xd4, 0x20, 0x22, 0x33, 0x19, 0xc6, 0x63,
4281 0x23, 0x21, 0x01, 0x11, 0x98, 0xce, 0x33, 0x19,
4282 0x18, 0x21, 0x03, 0x3a, 0x46, 0x65, 0x6a, 0x65,
4283 0x24, 0xad, 0xe9, 0x12, 0x32, 0x14, 0x1a, 0x26,
4284 0x34, 0xad, 0xa4, 0x41, 0x82, 0x23, 0x01, 0x50,
4285 0x2b, 0x1a, 0x24, 0x69, 0x48, 0x30, 0x40, 0x2e,
4286 0x11, 0x12, 0x08, 0xc6, 0x8c, 0x04, 0x41, 0x28,
4287 0x4c, 0x34, 0xf0, 0x1e, 0x01, 0x13, 0xf2, 0xe0,
4288 0x3c, 0x60, 0x20, 0x20, 0x28, 0x00, 0x00, 0x03,
4289 0x00, 0x08, 0x00, 0x00, 0x03, 0x01, 0x94, 0x00,
4291 0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x33, 0x48,
4294 static const uint8_t avci50_1080p_extradata[] = {
4296 0x00, 0x00, 0x00, 0x01, 0x67, 0x6e, 0x10, 0x28,
4297 0xa6, 0xd4, 0x20, 0x32, 0x33, 0x0c, 0x71, 0x18,
4298 0x88, 0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8c,
4299 0x44, 0x30, 0x21, 0x02, 0x56, 0x4e, 0x6f, 0x37,
4300 0xcd, 0xf9, 0xbf, 0x81, 0x6b, 0xf3, 0x7c, 0xde,
4301 0x6e, 0x6c, 0xd3, 0x3c, 0x05, 0xa0, 0x22, 0x7e,
4302 0x5f, 0xfc, 0x00, 0x0c, 0x00, 0x13, 0x8c, 0x04,
4303 0x04, 0x05, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00,
4304 0x00, 0x03, 0x00, 0x32, 0x84, 0x00, 0x00, 0x00,
4306 0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x31, 0x12,
4309 static const uint8_t avci50_1080i_extradata[] = {
4311 0x00, 0x00, 0x00, 0x01, 0x67, 0x6e, 0x10, 0x28,
4312 0xa6, 0xd4, 0x20, 0x32, 0x33, 0x0c, 0x71, 0x18,
4313 0x88, 0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8c,
4314 0x44, 0x30, 0x21, 0x02, 0x56, 0x4e, 0x6e, 0x61,
4315 0x87, 0x3e, 0x73, 0x4d, 0x98, 0x0c, 0x03, 0x06,
4316 0x9c, 0x0b, 0x73, 0xe6, 0xc0, 0xb5, 0x18, 0x63,
4317 0x0d, 0x39, 0xe0, 0x5b, 0x02, 0xd4, 0xc6, 0x19,
4318 0x1a, 0x79, 0x8c, 0x32, 0x34, 0x24, 0xf0, 0x16,
4319 0x81, 0x13, 0xf7, 0xff, 0x80, 0x02, 0x00, 0x01,
4320 0xf1, 0x80, 0x80, 0x80, 0xa0, 0x00, 0x00, 0x03,
4321 0x00, 0x20, 0x00, 0x00, 0x06, 0x50, 0x80, 0x00,
4323 0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x31, 0x12,
4326 static const uint8_t avci100_720p_extradata[] = {
4328 0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
4329 0xb6, 0xd4, 0x20, 0x2a, 0x33, 0x1d, 0xc7, 0x62,
4330 0xa1, 0x08, 0x40, 0x54, 0x66, 0x3b, 0x8e, 0xc5,
4331 0x42, 0x02, 0x10, 0x25, 0x64, 0x2c, 0x89, 0xe8,
4332 0x85, 0xe4, 0x21, 0x4b, 0x90, 0x83, 0x06, 0x95,
4333 0xd1, 0x06, 0x46, 0x97, 0x20, 0xc8, 0xd7, 0x43,
4334 0x08, 0x11, 0xc2, 0x1e, 0x4c, 0x91, 0x0f, 0x01,
4335 0x40, 0x16, 0xec, 0x07, 0x8c, 0x04, 0x04, 0x05,
4336 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x03,
4337 0x00, 0x64, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00,
4339 0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x31, 0x12,
4342 static const uint8_t avci50_720p_extradata[] = {
4344 0x00, 0x00, 0x00, 0x01, 0x67, 0x6e, 0x10, 0x20,
4345 0xa6, 0xd4, 0x20, 0x32, 0x33, 0x0c, 0x71, 0x18,
4346 0x88, 0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8c,
4347 0x44, 0x30, 0x21, 0x02, 0x56, 0x4e, 0x6f, 0x37,
4348 0xcd, 0xf9, 0xbf, 0x81, 0x6b, 0xf3, 0x7c, 0xde,
4349 0x6e, 0x6c, 0xd3, 0x3c, 0x0f, 0x01, 0x6e, 0xff,
4350 0xc0, 0x00, 0xc0, 0x01, 0x38, 0xc0, 0x40, 0x40,
4351 0x50, 0x00, 0x00, 0x03, 0x00, 0x10, 0x00, 0x00,
4352 0x06, 0x48, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
4354 0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x31, 0x12,
4363 data = avci100_1080p_extradata;
4364 size =
sizeof(avci100_1080p_extradata);
4366 data = avci100_1080i_extradata;
4367 size =
sizeof(avci100_1080i_extradata);
4371 data = avci50_1080p_extradata;
4372 size =
sizeof(avci50_1080p_extradata);
4374 data = avci50_1080i_extradata;
4375 size =
sizeof(avci50_1080i_extradata);
4378 data = avci100_720p_extradata;
4379 size =
sizeof(avci100_720p_extradata);
4381 data = avci50_720p_extradata;
4382 size =
sizeof(avci50_720p_extradata);