66 return FFMPEG_CONFIGURATION;
71 #define LICENSE_PREFIX "libavformat license: "
75 #define RELATIVE_TS_BASE (INT64_MAX - (1LL<<48))
93 timestamp < st->pts_wrap_reference)
109 if(f)
return f->
next;
115 if(f)
return f->
next;
145 ext = strrchr(filename,
'.');
151 while (*p !=
'\0' && *p !=
',' && q-ext1<
sizeof(ext1)-1)
172 namelen = strlen(name);
173 while ((p = strchr(names,
','))) {
174 len =
FFMAX(p - names, namelen);
183 const char *mime_type)
186 int score_max, score;
189 #if CONFIG_IMAGE2_MUXER
190 if (!short_name && filename &&
209 if (score > score_max) {
218 const char *filename,
const char *mime_type,
enum AVMediaType type){
222 #if CONFIG_IMAGE2_MUXER
223 if(!strcmp(fmt->
name,
"image2") || !strcmp(fmt->
name,
"image2pipe")){
252 if(remaining < size){
255 s->
maxsize= newsize - !newsize;
257 remaining=
FFMAX(remaining, 0);
260 if(s->
maxsize>=0 && remaining+1 < size){
271 int orig_size =
size;
286 if (pkt->
size < orig_size)
298 old_size = pkt->
size;
318 int score, nodat = 0, score_max=0;
322 lpd.
buf = zerobuffer;
347 if (score > score_max) {
350 }
else if (score == score_max)
353 *score_ret= score_max;
362 if(score_ret > *score_max){
363 *score_max= score_ret;
376 static const struct {
397 for (i = 0; fmt_id_type[i].name; i++) {
398 if (!strcmp(fmt->
name, fmt_id_type[i].name)) {
428 #define PROBE_BUF_MIN 2048
429 #define PROBE_BUF_MAX (1<<20)
432 const char *filename,
void *logctx,
433 unsigned int offset,
unsigned int max_probe_size)
436 unsigned char *buf =
NULL;
438 int ret = 0, probe_size, buf_offset = 0;
440 if (!max_probe_size) {
446 "Specified probe size value %u cannot be < %u\n", max_probe_size,
PROBE_BUF_MIN);
450 if (offset >= max_probe_size) {
462 probe_size =
FFMIN(probe_size<<1,
FFMAX(max_probe_size, probe_size+1))) {
466 if (probe_size < offset) {
477 if ((ret =
avio_read(pb, buf + buf_offset, probe_size - buf_offset)) < 0) {
495 av_log(logctx,
AV_LOG_WARNING,
"Format %s detected only with low score of %d, misdetection possible!\n", (*fmt)->name, score);
497 av_log(logctx,
AV_LOG_DEBUG,
"Format %s probed with size=%d and score=%d\n", (*fmt)->name, probe_size, score);
525 "will be ignored with AVFMT_NOFILE format.\n");
548 (*plast_pktl)->next = pktl;
550 *packet_buffer = pktl;
580 av_log(
NULL,
AV_LOG_ERROR,
"Input context has not been properly allocated by avformat_alloc_context() and is not NULL either\n");
592 if ((ret =
init_input(s, filename, &tmp)) < 0)
629 if (id3v2_extra_meta) {
748 if (!pktl || ret ==
AVERROR(EAGAIN))
763 "Dropped corrupted packet (stream = %d)\n",
797 #if FF_API_READ_PACKET
859 if (st->r_frame_rate.num && !pc) {
860 *pnum = st->r_frame_rate.den;
861 *pden = st->r_frame_rate.num;
883 if (frame_size <= 0 || st->codec->sample_rate <= 0)
914 #if CONFIG_H264_DECODER
951 if (!first_program) {
976 program = first_program;
1031 pts_buffer[0]= pktl->
pkt.
pts;
1032 for(i=0; i<delay && pts_buffer[i] > pts_buffer[i+1]; i++)
1033 FFSWAP(int64_t, pts_buffer[i], pts_buffer[i+1]);
1035 pktl->
pkt.
dts= pts_buffer[0];
1101 int num, den, presentation_delayed, delay, i;
1116 presentation_delayed = 0;
1122 presentation_delayed = 1;
1136 if(strcmp(s->
iformat->
name,
"mov,mp4,m4a,3gp,3g2,mj2"))
1181 presentation_delayed = 1;
1183 av_dlog(
NULL,
"IN delayed:%d pts:%s, dts:%s cur_dts:%s st:%d pc:%p duration:%d\n",
1188 if (presentation_delayed) {
1238 av_dlog(
NULL,
"OUTdelayed:%d/%d pts:%s, dts:%s cur_dts:%s\n",
1252 *pkt_buf = pktl->
next;
1256 *pkt_buf_end =
NULL;
1270 int ret = 0, got_output = 0;
1281 while (size > 0 || (pkt == &
flush_pkt && got_output)) {
1286 &out_pkt.
data, &out_pkt.
size, data, size,
1295 got_output = !!out_pkt.
size;
1369 *pkt_buffer = pktl->
next;
1371 *pkt_buffer_end =
NULL;
1378 int ret = 0, i, got_packet = 0;
1406 cur_pkt.
pts < cur_pkt.
dts) {
1414 av_log(s,
AV_LOG_DEBUG,
"ff_read_packet stream=%d, pts=%s, dts=%s, size=%d, duration=%d, flags=%d\n",
1426 "%s, packets or times may be invalid.\n",
1468 av_log(s,
AV_LOG_DEBUG,
"read_frame_internal stream=%d, pts=%s, dts=%s, size=%d, duration=%d, flags=%d\n",
1505 int64_t last_dts = next_pkt->
dts;
1514 last_dts = pktl->
pkt.
dts;
1541 if (pktl && ret !=
AVERROR(EAGAIN)) {
1591 int first_audio_index = -1;
1604 first_audio_index = i;
1606 return first_audio_index >= 0 ? first_audio_index : 0;
1666 int *nb_index_entries,
1667 unsigned int *index_entries_allocated_size,
1673 if((
unsigned)*nb_index_entries + 1 >= UINT_MAX /
sizeof(
AVIndexEntry))
1683 index_entries_allocated_size,
1684 (*nb_index_entries + 1) *
1689 *index_entries= entries;
1694 index= (*nb_index_entries)++;
1695 ie= &entries[
index];
1696 assert(index==0 || ie[-1].timestamp < timestamp);
1698 ie= &entries[
index];
1702 memmove(entries + index + 1, entries + index,
sizeof(
AVIndexEntry)*(*nb_index_entries - index));
1703 (*nb_index_entries)++;
1704 }
else if(ie->
pos == pos && distance < ie->min_distance)
1723 timestamp, size, distance, flags);
1727 int64_t wanted_timestamp,
int flags)
1736 if(b && entries[b-1].timestamp < wanted_timestamp)
1742 if(timestamp >= wanted_timestamp)
1744 if(timestamp <= wanted_timestamp)
1764 wanted_timestamp, flags);
1768 int64_t (*read_timestamp)(
struct AVFormatContext *,
int , int64_t *, int64_t ))
1770 int64_t ts = read_timestamp(s, stream_index, ppos, pos_limit);
1771 if (stream_index >= 0)
1780 int64_t ts_min, ts_max, ts;
1785 if (stream_index < 0)
1799 index=
FFMAX(index, 0);
1805 av_dlog(s,
"using cached pos_min=0x%"PRIx64
" dts_min=%s\n",
1812 assert(index < st->nb_index_entries);
1819 av_dlog(s,
"using cached pos_max=0x%"PRIx64
" pos_limit=0x%"PRIx64
" dts_max=%s\n",
1824 pos=
ff_gen_search(s, stream_index, target_ts, pos_min, pos_max, pos_limit, ts_min, ts_max, flags, &ts, avif->
read_timestamp);
1839 int64_t pos_min, int64_t pos_max, int64_t pos_limit,
1840 int64_t ts_min, int64_t ts_max,
int flags, int64_t *ts_ret,
1841 int64_t (*read_timestamp)(
struct AVFormatContext *,
int , int64_t *, int64_t ))
1844 int64_t start_pos, filesize;
1851 ts_min =
ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp);
1856 if(ts_min >= target_ts){
1864 pos_max = filesize - 1;
1866 pos_max =
FFMAX(0, pos_max - step);
1867 ts_max =
ff_read_timestamp(s, stream_index, &pos_max, pos_max + step, read_timestamp);
1874 int64_t tmp_pos= pos_max + 1;
1875 int64_t tmp_ts=
ff_read_timestamp(s, stream_index, &tmp_pos, INT64_MAX, read_timestamp);
1880 if(tmp_pos >= filesize)
1886 if(ts_max <= target_ts){
1891 if(ts_min > ts_max){
1893 }
else if(ts_min == ts_max){
1898 while (pos_min < pos_limit) {
1899 av_dlog(s,
"pos_min=0x%"PRIx64
" pos_max=0x%"PRIx64
" dts_min=%s dts_max=%s\n",
1901 assert(pos_limit <= pos_max);
1904 int64_t approximate_keyframe_distance= pos_max - pos_limit;
1906 pos =
av_rescale(target_ts - ts_min, pos_max - pos_min, ts_max - ts_min)
1907 + pos_min - approximate_keyframe_distance;
1908 }
else if(no_change==1){
1910 pos = (pos_min + pos_limit)>>1;
1918 else if(pos > pos_limit)
1927 av_dlog(s,
"%"PRId64
" %"PRId64
" %"PRId64
" / %s %s %s target:%s limit:%"PRId64
" start:%"PRId64
" noc:%d\n",
1928 pos_min, pos, pos_max,
1930 pos_limit, start_pos, no_change);
1936 if (target_ts <= ts) {
1937 pos_limit = start_pos - 1;
1941 if (target_ts >= ts) {
1951 ts_min =
ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp);
1953 ts_max =
ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp);
1954 av_dlog(s,
"pos=0x%"PRIx64
" %s<=%s<=%s\n",
1962 int64_t pos_min, pos_max;
1967 if (pos < pos_min) pos= pos_min;
1968 else if(pos > pos_max) pos= pos_max;
1976 int stream_index, int64_t timestamp,
int flags)
1983 st = s->
streams[stream_index];
1987 if(index < 0 && st->nb_index_entries && timestamp < st->index_entries[0].timestamp)
1990 if(index < 0 || index==st->nb_index_entries-1){
2008 }
while (read_status ==
AVERROR(EAGAIN));
2009 if (read_status < 0)
2016 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);
2040 int64_t timestamp,
int flags)
2052 if(stream_index < 0){
2054 if(stream_index < 0)
2095 if(min_ts > ts || max_ts < ts)
2105 if (stream_index == -1 && s->
nb_streams == 1) {
2112 time_base.
num * (int64_t)AV_TIME_BASE,
2132 if (ret<0 && ts != min_ts && max_ts != ts) {
2133 ret =
av_seek_frame(s, stream_index, dir ? max_ts : min_ts, flags | dir);
2173 int64_t
start_time, start_time1, start_time_text, end_time, end_time1;
2174 int64_t
duration, duration1, filesize;
2179 start_time = INT64_MAX;
2180 start_time_text = INT64_MAX;
2181 end_time = INT64_MIN;
2182 duration = INT64_MIN;
2188 if (start_time1 < start_time_text)
2189 start_time_text = start_time1;
2191 start_time =
FFMIN(start_time, start_time1);
2194 end_time1 = start_time1
2196 end_time =
FFMAX(end_time, end_time1);
2207 duration =
FFMAX(duration, duration1);
2210 if (start_time == INT64_MAX || (start_time > start_time_text && start_time - start_time_text <
AV_TIME_BASE))
2211 start_time = start_time_text;
2212 else if(start_time > start_time_text)
2215 if (start_time != INT64_MAX) {
2217 if (end_time != INT64_MIN) {
2225 duration =
FFMAX(duration, end_time - start_time);
2233 double bitrate = (double)filesize * 8.0 * AV_TIME_BASE /
2235 if (bitrate >= 0 && bitrate <= INT_MAX)
2289 #define DURATION_MAX_READ_SIZE 250000LL
2290 #define DURATION_MAX_RETRY 4
2297 int read_size, i, ret;
2333 }
while(ret ==
AVERROR(EAGAIN));
2336 read_size += pkt->
size;
2341 duration = end_time = pkt->
pts;
2379 file_size =
FFMAX(0, file_size);
2406 av_dlog(ic,
"%d: start_time: %0.3f duration: %0.3f\n", i,
2410 av_dlog(ic,
"stream: start_time: %0.3f duration: %0.3f bitrate=%d kb/s\n",
2421 #define FAIL(errmsg) do { \
2423 *errmsg_ptr = errmsg; \
2430 FAIL(
"unspecified frame size");
2432 FAIL(
"unspecified sample format");
2434 FAIL(
"unspecified sample rate");
2436 FAIL(
"unspecified number of channels");
2438 FAIL(
"no decodable DTS frames");
2442 FAIL(
"unspecified size");
2444 FAIL(
"unspecified pixel format");
2447 FAIL(
"no frame in rv30/40 and no sar");
2451 FAIL(
"unspecified size");
2458 FAIL(
"unknown codec");
2466 int got_picture = 1, ret = 0;
2488 av_dict_set(options ? options : &thread_opt,
"threads",
"1", 0);
2505 while ((pkt.
size > 0 || (!pkt.
data && got_picture)) &&
2515 &got_picture, &pkt);
2522 &got_picture, &pkt);
2537 if(!pkt.
data && !got_picture)
2559 if(tag == tags[i].tag)
2580 if (sflags & (1 << (bps - 1))) {
2612 for(i=0; tags && tags[i]; i++){
2615 if (codec_tags->
id ==
id) {
2616 *tag = codec_tags->
tag;
2628 for(i=0; tags && tags[i]; i++){
2649 if (j != i && next_start > ch->
start && next_start < end)
2652 ch->
end = (end == INT64_MAX) ? ch->
start : end;
2657 if(i<60*12)
return (i+1)*1001;
2658 else return ((
const int[]){24,30,60,12,15,48})[i-60*12]*1000*12;
2682 #if FF_API_FORMAT_PARAMETERS
2691 int i, count, ret, read_size, j;
2724 "%s, packets or times may be invalid.\n",
2733 av_dict_set(options ? &options[i] : &thread_opt,
"threads",
"1", 0);
2752 #if FF_API_R_FRAME_RATE
2770 int fps_analyze_framecount = 20;
2779 fps_analyze_framecount *= 2;
2783 fps_analyze_framecount = 0;
2813 if (!ic->
streams[i]->r_frame_rate.num &&
2816 "Stream #%d: not enough frames to estimate rate; "
2817 "consider increasing probesize\n", i);
2838 goto find_stream_info_err;
2841 read_size += pkt->
size;
2849 "packet %d with DTS %"PRId64
", packet %d with DTS "
2862 "packet %d with DTS %"PRId64
", packet %d with DTS "
2892 #if FF_API_R_FRAME_RATE
2897 && pkt->
dts - (uint64_t)last < INT64_MAX){
2908 double sdts= dts*framerate/(1001*12);
2910 int64_t ticks=
llrint(sdts+j*0.5);
2911 double error= sdts - ticks + j*0.5;
2967 (options && i < orig_nb_streams) ?
2968 &options[i] :
NULL);
2973 "decoding for stream %d failed\n", st->
index);
2981 "Could not find codec parameters for stream %d (%s): %s\n"
2982 "Consider increasing the value for the 'analyzeduration' and 'probesize' options\n",
3007 double best_error = 0.01;
3019 if (error < best_error) {
3021 best_fps = std_fps.
num;
3026 best_fps, 12*1001, INT_MAX);
3037 double best_error= 0.01;
3051 if(error < best_error && best_error> 0.000000001){
3060 if (num && (!st->r_frame_rate.num || (
double)num/(12*1001) < 1.01 *
av_q2d(st->r_frame_rate)))
3061 av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, num, 12*1001, INT_MAX);
3064 if (!st->r_frame_rate.num){
3098 find_stream_info_err:
3131 int wanted_stream_nb,
3137 int ret =
AVERROR_STREAM_NOT_FOUND, best_count = -1, best_bitrate = -1, best_multiframe = -1, count, bitrate, multiframe;
3138 unsigned *program =
NULL;
3141 if (related_stream >= 0 && wanted_stream_nb < 0) {
3148 for (i = 0; i < nb_streams; i++) {
3149 int real_stream_index = program ? program[i] : i;
3154 if (wanted_stream_nb >= 0 && real_stream_index != wanted_stream_nb)
3168 multiframe =
FFMIN(5, count);
3169 if ((best_multiframe > multiframe) ||
3170 (best_multiframe == multiframe && best_bitrate > bitrate) ||
3171 (best_multiframe == multiframe && best_bitrate == bitrate && best_count >= count))
3174 best_bitrate = bitrate;
3175 best_multiframe = multiframe;
3176 ret = real_stream_index;
3178 if (program && i == nb_streams - 1 && ret < 0) {
3185 *decoder_ret = best_decoder;
3262 #if FF_API_CLOSE_INPUT_FILE
3292 #if FF_API_NEW_STREAM
3308 if (s->
nb_streams >= INT_MAX/
sizeof(*streams))
3351 #if FF_API_R_FRAME_RATE
3366 av_dlog(ac,
"new_program: id=0x%04x\n",
id);
3407 chapter->
start = start;
3455 if(strcmp(
"language", tag->
key)){
3456 const char *p = tag->
value;
3460 size_t len = strcspn(p,
"\x8\xa\xb\xc\xd");
3501 display_aspect_ratio.
num, display_aspect_ratio.
den);
3506 #if FF_API_R_FRAME_RATE
3507 if(st->r_frame_rate.den && st->r_frame_rate.num)
3550 is_output ?
"Output" :
"Input",
3553 is_output ?
"to" :
"from", url);
3558 int hours, mins, secs, us;
3596 int j, k, total = 0;
3601 name ? name->
value :
"");
3609 if (total < ic->nb_streams)
3619 #if FF_API_AV_GETTIME && CONFIG_SHARED && HAVE_SYMVER
3620 FF_SYMVER(int64_t,
av_gettime, (
void),
"LIBAVFORMAT_54")
3632 const char *path,
int number)
3635 char *q, buf1[20],
c;
3636 int nd,
len, percentd_found;
3649 nd = nd * 10 + *p++ -
'0';
3661 snprintf(buf1,
sizeof(buf1),
"%0*d", nd, number);
3663 if ((q - buf + len) > buf_size - 1)
3665 memcpy(q, buf1, len);
3673 if ((q - buf) < buf_size - 1)
3677 if (!percentd_found)
3690 #define PRINT(...) do { if (!f) av_log(avcl, level, __VA_ARGS__); else fprintf(f, __VA_ARGS__); } while(0)
3692 for(i=0;i<
size;i+=16) {
3699 PRINT(
" %02x", buf[i+j]);
3704 for(j=0;j<
len;j++) {
3706 if (c < ' ' || c >
'~')
3727 #define PRINT(...) do { if (!f) av_log(avcl, level, __VA_ARGS__); else fprintf(f, __VA_ARGS__); } while(0)
3751 void av_pkt_dump(FILE *f,
AVPacket *
pkt,
int dump_payload)
3764 void av_pkt_dump_log(
void *avcl,
int level,
AVPacket *
pkt,
int dump_payload)
3778 char *authorization,
int authorization_size,
3779 char *hostname,
int hostname_size,
3781 char *path,
int path_size,
3784 const char *p, *ls, *ls2, *at, *at2, *col, *brk;
3786 if (port_ptr) *port_ptr = -1;
3787 if (proto_size > 0) proto[0] = 0;
3788 if (authorization_size > 0) authorization[0] = 0;
3789 if (hostname_size > 0) hostname[0] = 0;
3790 if (path_size > 0) path[0] = 0;
3793 if ((p = strchr(url,
':'))) {
3805 ls = strchr(p,
'/');
3806 ls2 = strchr(p,
'?');
3810 ls =
FFMIN(ls, ls2);
3820 while ((at = strchr(p,
'@')) && at < ls) {
3822 FFMIN(authorization_size, at + 1 - at2));
3826 if (*p ==
'[' && (brk = strchr(p,
']')) && brk < ls) {
3829 FFMIN(hostname_size, brk - p));
3830 if (brk[1] ==
':' && port_ptr)
3831 *port_ptr = atoi(brk + 2);
3832 }
else if ((col = strchr(p,
':')) && col < ls) {
3834 FFMIN(col + 1 - p, hostname_size));
3835 if (port_ptr) *port_ptr = atoi(col + 1);
3838 FFMIN(ls + 1 - p, hostname_size));
3845 static const char hex_table_uc[16] = {
'0',
'1',
'2',
'3',
3848 'C',
'D',
'E',
'F' };
3849 static const char hex_table_lc[16] = {
'0',
'1',
'2',
'3',
3852 'c',
'd',
'e',
'f' };
3853 const char *hex_table = lowercase ? hex_table_lc : hex_table_uc;
3855 for(i = 0; i < s; i++) {
3856 buff[i * 2] = hex_table[src[i] >> 4];
3857 buff[i * 2 + 1] = hex_table[src[i] & 0xF];
3874 if (c >=
'0' && c <=
'9')
3876 else if (c >=
'A' && c <=
'F')
3891 #if FF_API_SET_PTS_INFO
3892 void av_set_pts_info(
AVStream *s,
int pts_wrap_bits,
3893 unsigned int pts_num,
unsigned int pts_den)
3900 unsigned int pts_num,
unsigned int pts_den)
3904 if(new_tb.
num != pts_num)
3909 if(new_tb.
num <= 0 || new_tb.
den <= 0) {
3919 const char *authorization,
const char *hostname,
3920 int port,
const char *
fmt, ...)
3923 struct addrinfo hints = { 0 }, *ai;
3929 if (authorization && authorization[0])
3931 #if CONFIG_NETWORK && defined(AF_INET6)
3936 if (ai->ai_family == AF_INET6) {
3953 int len = strlen(str);
3956 vsnprintf(str + len, size > len ? size - len : 0, fmt, vl);
3987 const char *ptr = str;
3992 char *dest =
NULL, *dest_end;
3993 int key_len, dest_len = 0;
3996 while (*ptr && (
av_isspace(*ptr) || *ptr ==
','))
4003 if (!(ptr = strchr(key,
'=')))
4006 key_len = ptr - key;
4008 callback_get_buf(context, key, key_len, &dest, &dest_len);
4009 dest_end = dest + dest_len - 1;
4013 while (*ptr && *ptr !=
'\"') {
4017 if (dest && dest < dest_end)
4021 if (dest && dest < dest_end)
4029 for (; *ptr && !(
av_isspace(*ptr) || *ptr ==
','); ptr++)
4030 if (dest && dest < dest_end)
4051 char *sep, *path_query;
4053 if (base && strstr(base,
"://") && rel[0] ==
'/') {
4056 sep = strstr(buf,
"://");
4059 if (rel[1] ==
'/') {
4064 sep = strchr(sep,
'/');
4073 if (!base || strstr(rel,
"://") || rel[0] ==
'/') {
4081 path_query = strchr(buf,
'?');
4082 if (path_query !=
NULL)
4086 if (rel[0] ==
'?') {
4092 sep = strrchr(buf,
'/');
4100 sep = strrchr(buf,
'/');
4102 if (!strcmp(sep ? &sep[1] : buf,
"..")) {
4119 struct tm time1 = {0}, time2 = {0};
4133 return ofmt->
query_codec(codec_id, std_compliance);
4177 if (channel_layout) {
4185 if (width || height) {
4192 bytestream_put_le32(&data, flags);
4194 bytestream_put_le32(&data, channels);
4196 bytestream_put_le64(&data, channel_layout);
4198 bytestream_put_le32(&data, sample_rate);
4199 if (width || height) {
4200 bytestream_put_le32(&data, width);
4201 bytestream_put_le32(&data, height);
4222 av_reduce(&stream_sample_aspect_ratio.
num, &stream_sample_aspect_ratio.
den,
4223 stream_sample_aspect_ratio.
num, stream_sample_aspect_ratio.
den, INT_MAX);
4224 if (stream_sample_aspect_ratio.
num <= 0 || stream_sample_aspect_ratio.
den <= 0)
4225 stream_sample_aspect_ratio = undef;
4227 av_reduce(&frame_sample_aspect_ratio.
num, &frame_sample_aspect_ratio.
den,
4228 frame_sample_aspect_ratio.
num, frame_sample_aspect_ratio.
den, INT_MAX);
4229 if (frame_sample_aspect_ratio.
num <= 0 || frame_sample_aspect_ratio.
den <= 0)
4230 frame_sample_aspect_ratio = undef;
4232 if (stream_sample_aspect_ratio.
num)
4233 return stream_sample_aspect_ratio;
4235 return frame_sample_aspect_ratio;
4241 if (*spec <= '9' && *spec >=
'0')
4242 return strtol(spec,
NULL, 0) == st->
index;
4243 else if (*spec ==
'v' || *spec ==
'a' || *spec ==
's' || *spec ==
'd' ||
4257 if (*spec++ ==
':') {
4261 return i == st->
index;
4265 }
else if (*spec ==
'p' && *(spec + 1) ==
':') {
4269 prog_id = strtol(spec, &endptr, 0);
4274 if (*endptr++ ==
':') {
4275 int stream_idx = strtol(endptr,
NULL, 0);
4276 return stream_idx >= 0 &&
4286 }
else if (*spec ==
'#') {
4289 sid = strtol(spec + 1, &endptr, 0);
4291 return st->
id == sid;
4301 static const uint8_t avci100_1080p_extradata[] = {
4303 0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
4304 0xb6, 0xd4, 0x20, 0x22, 0x33, 0x19, 0xc6, 0x63,
4305 0x23, 0x21, 0x01, 0x11, 0x98, 0xce, 0x33, 0x19,
4306 0x18, 0x21, 0x02, 0x56, 0xb9, 0x3d, 0x7d, 0x7e,
4307 0x4f, 0xe3, 0x3f, 0x11, 0xf1, 0x9e, 0x08, 0xb8,
4308 0x8c, 0x54, 0x43, 0xc0, 0x78, 0x02, 0x27, 0xe2,
4309 0x70, 0x1e, 0x30, 0x10, 0x10, 0x14, 0x00, 0x00,
4310 0x03, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0xca,
4311 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4313 0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x33, 0x48,
4316 static const uint8_t avci100_1080i_extradata[] = {
4318 0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
4319 0xb6, 0xd4, 0x20, 0x22, 0x33, 0x19, 0xc6, 0x63,
4320 0x23, 0x21, 0x01, 0x11, 0x98, 0xce, 0x33, 0x19,
4321 0x18, 0x21, 0x03, 0x3a, 0x46, 0x65, 0x6a, 0x65,
4322 0x24, 0xad, 0xe9, 0x12, 0x32, 0x14, 0x1a, 0x26,
4323 0x34, 0xad, 0xa4, 0x41, 0x82, 0x23, 0x01, 0x50,
4324 0x2b, 0x1a, 0x24, 0x69, 0x48, 0x30, 0x40, 0x2e,
4325 0x11, 0x12, 0x08, 0xc6, 0x8c, 0x04, 0x41, 0x28,
4326 0x4c, 0x34, 0xf0, 0x1e, 0x01, 0x13, 0xf2, 0xe0,
4327 0x3c, 0x60, 0x20, 0x20, 0x28, 0x00, 0x00, 0x03,
4328 0x00, 0x08, 0x00, 0x00, 0x03, 0x01, 0x94, 0x00,
4330 0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x33, 0x48,
4333 static const uint8_t avci50_1080i_extradata[] = {
4335 0x00, 0x00, 0x00, 0x01, 0x67, 0x6e, 0x10, 0x28,
4336 0xa6, 0xd4, 0x20, 0x32, 0x33, 0x0c, 0x71, 0x18,
4337 0x88, 0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8c,
4338 0x44, 0x30, 0x21, 0x02, 0x56, 0x4e, 0x6e, 0x61,
4339 0x87, 0x3e, 0x73, 0x4d, 0x98, 0x0c, 0x03, 0x06,
4340 0x9c, 0x0b, 0x73, 0xe6, 0xc0, 0xb5, 0x18, 0x63,
4341 0x0d, 0x39, 0xe0, 0x5b, 0x02, 0xd4, 0xc6, 0x19,
4342 0x1a, 0x79, 0x8c, 0x32, 0x34, 0x24, 0xf0, 0x16,
4343 0x81, 0x13, 0xf7, 0xff, 0x80, 0x02, 0x00, 0x01,
4344 0xf1, 0x80, 0x80, 0x80, 0xa0, 0x00, 0x00, 0x03,
4345 0x00, 0x20, 0x00, 0x00, 0x06, 0x50, 0x80, 0x00,
4347 0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x31, 0x12,
4350 static const uint8_t avci100_720p_extradata[] = {
4352 0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
4353 0xb6, 0xd4, 0x20, 0x2a, 0x33, 0x1d, 0xc7, 0x62,
4354 0xa1, 0x08, 0x40, 0x54, 0x66, 0x3b, 0x8e, 0xc5,
4355 0x42, 0x02, 0x10, 0x25, 0x64, 0x2c, 0x89, 0xe8,
4356 0x85, 0xe4, 0x21, 0x4b, 0x90, 0x83, 0x06, 0x95,
4357 0xd1, 0x06, 0x46, 0x97, 0x20, 0xc8, 0xd7, 0x43,
4358 0x08, 0x11, 0xc2, 0x1e, 0x4c, 0x91, 0x0f, 0x01,
4359 0x40, 0x16, 0xec, 0x07, 0x8c, 0x04, 0x04, 0x05,
4360 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x03,
4361 0x00, 0x64, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00,
4363 0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x31, 0x12,
4370 data = avci100_1080p_extradata;
4371 size =
sizeof(avci100_1080p_extradata);
4373 data = avci100_1080i_extradata;
4374 size =
sizeof(avci100_1080i_extradata);
4377 data = avci50_1080i_extradata;
4378 size =
sizeof(avci50_1080i_extradata);
4380 data = avci100_720p_extradata;
4381 size =
sizeof(avci100_720p_extradata);
4397 if (!strcmp(pattern,
"*"))
4400 if (pattern[0] ==
'*')
4402 if (pattern[0] ==
'.')
4404 len_p = strlen(pattern);
4405 len_h = strlen(hostname);
4409 if (!strcmp(pattern, &hostname[len_h - len_p])) {
4412 if (hostname[len_h - len_p - 1] ==
'.')
4431 char *sep, *next =
NULL;
4432 start += strspn(start,
" ,");
4433 sep = start + strcspn(start,
" ,");