Go to the documentation of this file.
50 #include "libavutil/ffversion.h"
68 return FFMPEG_CONFIGURATION;
73 #define LICENSE_PREFIX "libavformat license: "
109 for (
unsigned i = 0;
i <
s->nb_streams;
i++) {
121 dst-> codec_whitelist =
av_strdup(
src->codec_whitelist);
125 if ( (
src-> codec_whitelist && !dst-> codec_whitelist)
126 || (
src-> format_whitelist && !dst-> format_whitelist)
140 if (
s->video_codec)
return s->video_codec;
143 if (
s->audio_codec)
return s->audio_codec;
146 if (
s->subtitle_codec)
return s->subtitle_codec;
154 #define SANE_CHUNK_SIZE (50000000)
182 if (
ret != read_size) {
199 #if FF_API_INIT_PACKET
231 for (
unsigned i = 0;
i <
s->nb_streams;
i++)
234 if (
s->streams[
i]->attached_pic.size <= 0) {
236 "Attached picture on stream %d has invalid size, "
242 &
s->streams[
i]->attached_pic,
312 int best_score = INT_MIN;
314 if (
s->nb_streams <= 0)
316 for (
unsigned i = 0;
i <
s->nb_streams;
i++) {
337 if (score > best_score) {
370 if (bps <= 0 || bps > 64)
385 if (sflags & (1 << (
bps - 1))) {
428 for (
int i = 0; tags && tags[
i];
i++) {
431 if (codec_tags->
id ==
id) {
443 for (
int i = 0; tags && tags[
i];
i++) {
501 int wanted_stream_nb,
int related_stream,
506 int best_count = -1, best_multiframe = -1, best_disposition = -1;
507 int count, multiframe, disposition;
508 int64_t best_bitrate = -1;
513 if (related_stream >= 0 && wanted_stream_nb < 0) {
526 if (wanted_stream_nb >= 0 && real_stream_index != wanted_stream_nb)
542 multiframe =
FFMIN(5, count);
543 if ((best_disposition > disposition) ||
544 (best_disposition == disposition && best_multiframe > multiframe) ||
545 (best_disposition == disposition && best_multiframe == multiframe && best_bitrate >
bitrate) ||
546 (best_disposition == disposition && best_multiframe == multiframe && best_bitrate ==
bitrate && best_count >= count))
548 best_disposition = disposition;
551 best_multiframe = multiframe;
552 ret = real_stream_index;
562 *decoder_ret = best_decoder;
570 if (
s->iformat->read_play)
571 return s->iformat->read_play(
s);
579 if (
s->iformat->read_pause)
580 return s->iformat->read_pause(
s);
623 if (
src->nb_side_data) {
630 for (
int i = 0;
i <
src->nb_side_data;
i++) {
632 src->side_data[
i].size);
697 s->oformat->deinit(
s);
700 if (
s->iformat &&
s->iformat->priv_class &&
s->priv_data)
702 if (
s->oformat &&
s->oformat->priv_class &&
s->priv_data)
705 for (
unsigned i = 0;
i <
s->nb_streams;
i++)
709 for (
unsigned i = 0;
i <
s->nb_programs;
i++) {
718 while (
s->nb_chapters--) {
775 if (
s->nb_streams >=
s->max_streams) {
777 " (%d), see the documentation if you wish to increase it\n",
784 s->streams = streams;
792 #if FF_API_AVSTREAM_CLASS
809 #if FF_API_R_FRAME_RATE
826 st->
index =
s->nb_streams;
845 s->streams[
s->nb_streams++] = st;
884 int64_t start, int64_t end,
const char *title)
891 av_log(
s,
AV_LOG_ERROR,
"Chapter end time %"PRId64
" before start %"PRId64
"\n", end, start);
895 if (!
s->nb_chapters) {
898 for (
unsigned i = 0;
i <
s->nb_chapters;
i++)
899 if (
s->chapters[
i]->id ==
id)
900 chapter =
s->chapters[
i];
918 chapter->
start = start;
938 for (
unsigned j = 0; j <
program->nb_stream_indexes; j++)
939 if (
program->stream_index[j] == idx)
958 uint64_t ntp_ts, frac_part, sec;
962 sec = ntp_time_us / 1000000;
963 usec = ntp_time_us % 1000000;
966 frac_part = usec * 0xFFFFFFFFULL;
967 frac_part /= 1000000;
969 if (sec > 0xFFFFFFFFULL)
980 uint64_t sec = ntp_ts >> 32;
981 uint64_t frac_part = ntp_ts & 0xFFFFFFFFULL;
982 uint64_t usec = (frac_part * 1000000) / 0xFFFFFFFFULL;
984 return (sec * 1000000) + usec;
990 char *q, buf1[20],
c;
991 int nd,
len, percentd_found;
1004 if (nd >= INT_MAX / 10 - 255)
1006 nd = nd * 10 + *p++ -
'0';
1020 snprintf(buf1,
sizeof(buf1),
"%0*d", nd, number);
1022 if ((q - buf +
len) > buf_size - 1)
1024 memcpy(q, buf1,
len);
1032 if ((q - buf) < buf_size - 1)
1036 if (!percentd_found)
1051 char *authorization,
int authorization_size,
1052 char *hostname,
int hostname_size,
1053 int *port_ptr,
char *path,
int path_size,
const char *url)
1055 const char *p, *ls, *at, *at2, *col, *brk;
1061 if (authorization_size > 0)
1062 authorization[0] = 0;
1063 if (hostname_size > 0)
1069 if ((p = strchr(url,
':'))) {
1083 ls = p + strcspn(p,
"/?#");
1090 while ((at = strchr(p,
'@')) && at < ls) {
1092 FFMIN(authorization_size, at + 1 - at2));
1096 if (*p ==
'[' && (brk = strchr(p,
']')) && brk < ls) {
1099 FFMIN(hostname_size, brk - p));
1100 if (brk[1] ==
':' && port_ptr)
1101 *port_ptr = atoi(brk + 2);
1102 }
else if ((col = strchr(p,
':')) && col < ls) {
1104 FFMIN(col + 1 - p, hostname_size));
1106 *port_ptr = atoi(col + 1);
1109 FFMIN(ls + 1 - p, hostname_size));
1120 if (!path || !
temp) {
1130 for ( ; *
pos !=
'\0'; ++
pos) {
1131 if (*
pos ==
'/' || *
pos ==
'\\') {
1139 if ((*(
pos - 1) !=
'/') || (*(
pos - 1) !=
'\\')) {
1149 static const char hex_table_uc[16] = {
'0',
'1',
'2',
'3',
1152 'C',
'D',
'E',
'F' };
1153 static const char hex_table_lc[16] = {
'0',
'1',
'2',
'3',
1156 'c',
'd',
'e',
'f' };
1157 const char *hex_table =
lowercase ? hex_table_lc : hex_table_uc;
1159 for (
int i = 0;
i <
s;
i++) {
1160 buff[
i * 2] = hex_table[
src[
i] >> 4];
1161 buff[
i * 2 + 1] = hex_table[
src[
i] & 0xF];
1179 if (
c >=
'0' &&
c <=
'9')
1181 else if (
c >=
'A' &&
c <=
'F')
1197 unsigned int pts_num,
unsigned int pts_den)
1202 if (new_tb.
num != pts_num)
1204 "st:%d removing common factor %d from timebase\n",
1208 "st:%d has too large timebase, reducing\n", st->
index);
1210 if (new_tb.
num <= 0 || new_tb.
den <= 0) {
1212 "Ignoring attempt to set invalid timebase %d/%d for st:%d\n",
1225 const char *ptr =
str;
1230 char *dest =
NULL, *dest_end;
1231 int key_len, dest_len = 0;
1234 while (*ptr && (
av_isspace(*ptr) || *ptr ==
','))
1241 if (!(ptr = strchr(
key,
'=')))
1244 key_len = ptr -
key;
1246 callback_get_buf(
context,
key, key_len, &dest, &dest_len);
1247 dest_end = dest ? dest + dest_len - 1 :
NULL;
1251 while (*ptr && *ptr !=
'\"') {
1255 if (dest && dest < dest_end)
1259 if (dest && dest < dest_end)
1267 for (; *ptr && !(
av_isspace(*ptr) || *ptr ==
','); ptr++)
1268 if (dest && dest < dest_end)
1278 for (
unsigned i = 0;
i <
s->nb_streams;
i++)
1279 if (
s->streams[
i]->id ==
id)
1288 unsigned int codec_tag;
1336 if (channel_layout) {
1355 bytestream_put_le64(&
data, channel_layout);
1370 AVRational frame_sample_aspect_ratio =
frame ?
frame->sample_aspect_ratio : codec_sample_aspect_ratio;
1372 av_reduce(&stream_sample_aspect_ratio.
num, &stream_sample_aspect_ratio.
den,
1373 stream_sample_aspect_ratio.
num, stream_sample_aspect_ratio.
den, INT_MAX);
1374 if (stream_sample_aspect_ratio.
num <= 0 || stream_sample_aspect_ratio.
den <= 0)
1375 stream_sample_aspect_ratio = undef;
1377 av_reduce(&frame_sample_aspect_ratio.
num, &frame_sample_aspect_ratio.
den,
1378 frame_sample_aspect_ratio.
num, frame_sample_aspect_ratio.
den, INT_MAX);
1379 if (frame_sample_aspect_ratio.
num <= 0 || frame_sample_aspect_ratio.
den <= 0)
1380 frame_sample_aspect_ratio = undef;
1382 if (stream_sample_aspect_ratio.
num)
1383 return stream_sample_aspect_ratio;
1385 return frame_sample_aspect_ratio;
1395 if (avg_fr.
num > 0 && avg_fr.
den > 0 && fr.
num > 0 && fr.
den > 0 &&
1402 if ( codec_fr.
num > 0 && codec_fr.
den > 0 &&
1420 const char *spec,
const char **indexptr,
1425 if (*spec <= '9' && *spec >=
'0') {
1429 }
else if (*spec ==
'v' || *spec ==
'a' || *spec ==
's' || *spec ==
'd' ||
1430 *spec ==
't' || *spec ==
'V') {
1443 if (*spec && *spec++ !=
':')
1450 }
else if (*spec ==
'p' && *(spec + 1) ==
':') {
1455 prog_id = strtol(spec, &endptr, 0);
1457 if (spec == endptr || (*endptr && *endptr++ !=
':'))
1461 for (
unsigned i = 0;
i <
s->nb_programs;
i++) {
1462 if (
s->programs[
i]->id != prog_id)
1465 for (
unsigned j = 0; j <
s->programs[
i]->nb_stream_indexes; j++) {
1466 if (st->
index ==
s->programs[
i]->stream_index[j]) {
1469 *p =
s->programs[
i];
1478 }
else if (*spec ==
'#' ||
1479 (*spec ==
'i' && *(spec + 1) ==
':')) {
1482 spec += 1 + (*spec ==
'i');
1483 stream_id = strtol(spec, &endptr, 0);
1484 if (spec == endptr || *endptr)
1486 return match && (stream_id == st->
id);
1487 }
else if (*spec ==
'm' && *(spec + 1) ==
':') {
1494 val = strchr(spec,
':');
1502 if (!
val || !strcmp(
tag->value,
val + 1))
1511 return match &&
ret;
1512 }
else if (*spec ==
'u' && *(spec + 1) ==
'\0') {
1548 const char *indexptr =
NULL;
1559 index = strtol(indexptr, &endptr, 0);
1566 if (spec == indexptr)
1571 for (
int i = 0; i < nb_streams && index >= 0;
i++) {
1576 if (
ret > 0 &&
index-- == 0 && st == candidate)
1589 static const uint8_t avci100_1080p_extradata[] = {
1591 0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
1592 0xb6, 0xd4, 0x20, 0x22, 0x33, 0x19, 0xc6, 0x63,
1593 0x23, 0x21, 0x01, 0x11, 0x98, 0xce, 0x33, 0x19,
1594 0x18, 0x21, 0x02, 0x56, 0xb9, 0x3d, 0x7d, 0x7e,
1595 0x4f, 0xe3, 0x3f, 0x11, 0xf1, 0x9e, 0x08, 0xb8,
1596 0x8c, 0x54, 0x43, 0xc0, 0x78, 0x02, 0x27, 0xe2,
1597 0x70, 0x1e, 0x30, 0x10, 0x10, 0x14, 0x00, 0x00,
1598 0x03, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0xca,
1599 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1601 0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x33, 0x48,
1604 static const uint8_t avci100_1080i_extradata[] = {
1606 0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
1607 0xb6, 0xd4, 0x20, 0x22, 0x33, 0x19, 0xc6, 0x63,
1608 0x23, 0x21, 0x01, 0x11, 0x98, 0xce, 0x33, 0x19,
1609 0x18, 0x21, 0x03, 0x3a, 0x46, 0x65, 0x6a, 0x65,
1610 0x24, 0xad, 0xe9, 0x12, 0x32, 0x14, 0x1a, 0x26,
1611 0x34, 0xad, 0xa4, 0x41, 0x82, 0x23, 0x01, 0x50,
1612 0x2b, 0x1a, 0x24, 0x69, 0x48, 0x30, 0x40, 0x2e,
1613 0x11, 0x12, 0x08, 0xc6, 0x8c, 0x04, 0x41, 0x28,
1614 0x4c, 0x34, 0xf0, 0x1e, 0x01, 0x13, 0xf2, 0xe0,
1615 0x3c, 0x60, 0x20, 0x20, 0x28, 0x00, 0x00, 0x03,
1616 0x00, 0x08, 0x00, 0x00, 0x03, 0x01, 0x94, 0x20,
1618 0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x33, 0x48,
1621 static const uint8_t avci50_1080p_extradata[] = {
1623 0x00, 0x00, 0x00, 0x01, 0x67, 0x6e, 0x10, 0x28,
1624 0xa6, 0xd4, 0x20, 0x32, 0x33, 0x0c, 0x71, 0x18,
1625 0x88, 0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8c,
1626 0x44, 0x30, 0x21, 0x02, 0x56, 0x4e, 0x6f, 0x37,
1627 0xcd, 0xf9, 0xbf, 0x81, 0x6b, 0xf3, 0x7c, 0xde,
1628 0x6e, 0x6c, 0xd3, 0x3c, 0x05, 0xa0, 0x22, 0x7e,
1629 0x5f, 0xfc, 0x00, 0x0c, 0x00, 0x13, 0x8c, 0x04,
1630 0x04, 0x05, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00,
1631 0x00, 0x03, 0x00, 0x32, 0x84, 0x00, 0x00, 0x00,
1633 0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x31, 0x12,
1636 static const uint8_t avci50_1080i_extradata[] = {
1638 0x00, 0x00, 0x00, 0x01, 0x67, 0x6e, 0x10, 0x28,
1639 0xa6, 0xd4, 0x20, 0x32, 0x33, 0x0c, 0x71, 0x18,
1640 0x88, 0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8c,
1641 0x44, 0x30, 0x21, 0x02, 0x56, 0x4e, 0x6e, 0x61,
1642 0x87, 0x3e, 0x73, 0x4d, 0x98, 0x0c, 0x03, 0x06,
1643 0x9c, 0x0b, 0x73, 0xe6, 0xc0, 0xb5, 0x18, 0x63,
1644 0x0d, 0x39, 0xe0, 0x5b, 0x02, 0xd4, 0xc6, 0x19,
1645 0x1a, 0x79, 0x8c, 0x32, 0x34, 0x24, 0xf0, 0x16,
1646 0x81, 0x13, 0xf7, 0xff, 0x80, 0x02, 0x00, 0x01,
1647 0xf1, 0x80, 0x80, 0x80, 0xa0, 0x00, 0x00, 0x03,
1648 0x00, 0x20, 0x00, 0x00, 0x06, 0x50, 0x80, 0x00,
1650 0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x31, 0x12,
1653 static const uint8_t avci100_720p_extradata[] = {
1655 0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
1656 0xb6, 0xd4, 0x20, 0x2a, 0x33, 0x1d, 0xc7, 0x62,
1657 0xa1, 0x08, 0x40, 0x54, 0x66, 0x3b, 0x8e, 0xc5,
1658 0x42, 0x02, 0x10, 0x25, 0x64, 0x2c, 0x89, 0xe8,
1659 0x85, 0xe4, 0x21, 0x4b, 0x90, 0x83, 0x06, 0x95,
1660 0xd1, 0x06, 0x46, 0x97, 0x20, 0xc8, 0xd7, 0x43,
1661 0x08, 0x11, 0xc2, 0x1e, 0x4c, 0x91, 0x0f, 0x01,
1662 0x40, 0x16, 0xec, 0x07, 0x8c, 0x04, 0x04, 0x05,
1663 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x03,
1664 0x00, 0x64, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00,
1666 0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x31, 0x12,
1669 static const uint8_t avci50_720p_extradata[] = {
1671 0x00, 0x00, 0x00, 0x01, 0x67, 0x6e, 0x10, 0x20,
1672 0xa6, 0xd4, 0x20, 0x32, 0x33, 0x0c, 0x71, 0x18,
1673 0x88, 0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8c,
1674 0x44, 0x30, 0x21, 0x02, 0x56, 0x4e, 0x6f, 0x37,
1675 0xcd, 0xf9, 0xbf, 0x81, 0x6b, 0xf3, 0x7c, 0xde,
1676 0x6e, 0x6c, 0xd3, 0x3c, 0x0f, 0x01, 0x6e, 0xff,
1677 0xc0, 0x00, 0xc0, 0x01, 0x38, 0xc0, 0x40, 0x40,
1678 0x50, 0x00, 0x00, 0x03, 0x00, 0x10, 0x00, 0x00,
1679 0x06, 0x48, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
1681 0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x31, 0x12,
1690 data = avci100_1080p_extradata;
1691 size =
sizeof(avci100_1080p_extradata);
1693 data = avci100_1080i_extradata;
1694 size =
sizeof(avci100_1080i_extradata);
1698 data = avci50_1080p_extradata;
1699 size =
sizeof(avci50_1080p_extradata);
1701 data = avci50_1080i_extradata;
1702 size =
sizeof(avci50_1080i_extradata);
1705 data = avci100_720p_extradata;
1706 size =
sizeof(avci100_720p_extradata);
1708 data = avci50_720p_extradata;
1709 size =
sizeof(avci50_720p_extradata);
1828 "Automatically inserted bitstream filter '%s'; args='%s'\n",
1829 name, args ? args :
"");
1853 ret =
s->io_close2(
s, *pb);
1855 s->io_close(
s, *pb);
1869 int64_t parsed_timestamp;
1873 *timestamp = return_seconds ? parsed_timestamp / 1000000 : parsed_timestamp;
1952 if (!strcmp(ofmt->
name,
"avi")) {
1953 #if FF_API_R_FRAME_RATE
1959 ||
copy_tb == AVFMT_TBCF_R_FRAMERATE) {
2013 opt->
unit && !strcmp(opt->
unit,
"disposition");
2020 return opt->default_val.i64;
2028 if (disposition <= 0)
2042 int64_t
pos, pos_end;
2043 uint8_t *buf, *read_buf[2];
2044 int read_buf_id = 0;
2052 read_buf[1] = buf + shift_size;
2067 avio_seek(
s->pb, read_start + shift_size, SEEK_SET);
2069 avio_seek(read_pb, read_start, SEEK_SET);
2072 #define READ_BLOCK do { \
2073 read_size[read_buf_id] = avio_read(read_pb, read_buf[read_buf_id], shift_size); \
2082 n = read_size[read_buf_id];
2087 }
while (
pos < pos_end);
static void error(const char *err)
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.
int avpriv_packet_list_put(PacketList *packet_buffer, AVPacket *pkt, int(*copy)(AVPacket *dst, const AVPacket *src), int flags)
Append an AVPacket to the list.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
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
int inject_global_side_data
Internal data to inject global side data.
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
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.
unsigned int nb_stream_indexes
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
int avio_close(AVIOContext *s)
Close the resource accessed by the AVIOContext s and free it.
int64_t first_dts
Timestamp corresponding to the last dts sync point.
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:
static av_always_inline FFIOContext * ffiocontext(AVIOContext *ctx)
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.
char * protocol_blacklist
',' separated list of disallowed protocols.
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.
static av_const int av_isspace(int c)
Locale-independent conversion of ASCII isspace.
int av_bsf_init(AVBSFContext *ctx)
Prepare the filter for use, after all the parameters and options have been set.
This structure describes decoded (raw) audio or video data.
AVStream ** streams
A list of all streams in the file.
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.
@ 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.
int initialized
Whether or not avformat_init_output has already been called.
void avcodec_parameters_free(AVCodecParameters **ppar)
Free an AVCodecParameters instance and everything associated with it and write NULL to the supplied p...
@ AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE
unsigned int ff_toupper4(unsigned int x)
#define AV_LOG_VERBOSE
Detailed information.
AVBSFContext * bsfc
bitstream filter to run on stream
struct FFStream::@259 extract_extradata
void ff_network_close(void)
@ AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT
int64_t last_dts_for_order_check
Internal data to analyze DTS and detect faulty mpeg streams.
int av_get_frame_filename(char *buf, int buf_size, const char *path, int number)
#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)
const AVBitStreamFilter * av_bsf_get_by_name(const char *name)
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 av_find_best_stream(AVFormatContext *ic, enum AVMediaType type, int wanted_stream_nb, int related_stream, const AVCodec **decoder_ret, int flags)
Find the "best" stream in the file.
int avformat_queue_attached_pictures(AVFormatContext *s)
int av_set_options_string(void *ctx, const char *opts, const char *key_val_sep, const char *pairs_sep)
Parse the key/value pairs list in opts.
static const chunk_decoder decoder[8]
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding.
unsigned avformat_version(void)
Return the LIBAVFORMAT_VERSION_INT constant.
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
AVProgram * av_new_program(AVFormatContext *ac, int id)
int64_t duration
Decoding: duration of the stream, in stream time base.
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 av_init_packet(AVPacket *pkt)
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.
#define AV_PKT_FLAG_CORRUPT
The packet content is corrupted.
struct FFStream::@260 * info
Stream information used internally by avformat_find_stream_info()
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance)
Test if the given container can store a codec.
@ AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS
PacketList parse_queue
Packets split by the parser get queued here.
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
int64_t end
chapter start/end time in time_base units
This struct describes the properties of a single codec described by an AVCodecID.
double(* duration_error)[2][MAX_STD_TIMEBASES]
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
PacketList packet_buffer
This buffer is only needed when packets were already buffered but not decoded, for example to get the...
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
AVRational sample_aspect_ratio
Video only.
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.
#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.
int codec_info_nb_frames
Number of frames that have been demuxed during avformat_find_stream_info()
AVRational time_base_in
The timebase used for the timestamps of the input packets.
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
void avio_flush(AVIOContext *s)
Force flushing of buffered data.
enum AVStreamParseType need_parsing
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
AVStream pub
The public context.
#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.
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
static __device__ float fabs(float a)
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory.
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.
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.
const char * av_default_item_name(void *ptr)
Return the context name.
#define AVERROR_BSF_NOT_FOUND
Bitstream filter not found.
unsigned int * stream_index
const AVClass * priv_class
A class for the private data, used to declare bitstream filter private AVOptions.
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 av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
int inject_global_side_data
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.
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.
const AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
int extradata_size
Size of the extradata content in bytes.
int64_t fps_first_dts
Those are used for average framerate estimation.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
AVDictionary * id3v2_meta
ID3v2 tag useful for MP3 demuxing.
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.
const OptionDef options[]
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.
AVPacket * parse_pkt
The generic code uses this as a temporary packet to parse packets or for muxing, especially flushing.
void avpriv_packet_list_free(PacketList *pkt_buf)
Wipe the list and unref all the packets in it.
AVRational pkt_timebase
Timebase in which pkt_dts/pts and AVPacket.dts/pts are.
#define AV_MUTEX_INITIALIZER
#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.
@ AVMEDIA_TYPE_UNKNOWN
Usually treated as AVMEDIA_TYPE_DATA.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
static av_const int av_isdigit(int c)
Locale-independent conversion of ASCII isdigit.
int pts_wrap_behavior
Options for behavior, when a wrap is detected.
int raw_packet_buffer_size
Sum of the size of packets in raw_packet_buffer, in bytes.
static int ff_mutex_lock(AVMutex *mutex)
int flags
A combination of AV_PKT_FLAG values.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
int probe_packets
Number of packets to buffer for codec probing.
#define AV_FRAME_FILENAME_FLAGS_MULTIPLE
Allow multiple d.
AVPacketSideData * side_data
An array of side data that applies to the whole stream (i.e.
int ffio_limit(AVIOContext *s, int size)
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src)
Copy the contents of src to dst.
PacketList raw_packet_buffer
Raw packets from the demuxer, prior to parsing and decoding.
#define i(width, name, range_min, range_max)
int64_t id
unique ID to identify the chapter
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, size_t *size)
Get side information from packet.
#define av_malloc_array(a, b)
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
char * codec_whitelist
',' separated list of allowed decoders.
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.
int64_t pts_buffer[MAX_REORDER_DELAY+1]
int av_find_default_stream_index(AVFormatContext *s)
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.
AVCodecParameters * avcodec_parameters_alloc(void)
Allocate a new AVCodecParameters and set its fields to default values (unknown/invalid/0).
int av_read_pause(AVFormatContext *s)
Pause a network-based stream (e.g.
void * av_calloc(size_t nmemb, size_t size)
enum AVFieldOrder field_order
Video only.
void * priv_data
Opaque filter-specific private data.
int disposition
Stream disposition - a combination of AV_DISPOSITION_* flags.
int id
Format-specific stream ID.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
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
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
uint8_t * av_stream_get_side_data(const AVStream *st, enum AVPacketSideDataType type, size_t *size)
Get side information from stream.
#define AV_INPUT_BUFFER_PADDING_SIZE
int chapter_ids_monotonic
Set if chapter ids are strictly monotonic.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
int avformat_network_deinit(void)
Undo the initialization done by avformat_network_init.
int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem)
Add an element to a dynamic array.
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.
@ AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, size_t size)
Allocate new information of a packet.
#define AVERROR_STREAM_NOT_FOUND
Stream not found.
AVCodecContext * avctx
The codec context used by avformat_find_stream_info, the parser, etc.
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.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
AVRational r_frame_rate
Real base framerate of the stream.
const char * avformat_license(void)
Return the libavformat license.
int64_t av_gettime(void)
Get the current time in microseconds.
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
#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
char * av_strdup(const char *s)
Duplicate a string.
A reference to a data buffer.
const char * unit
The logical unit to which the option belongs.
AVPacket * pkt
Used to hold temporary packets for the generic demuxing code.
const char * avformat_configuration(void)
Return the libavformat build-time configuration.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
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.
int64_t pos
byte position in stream, -1 if unknown
void av_bsf_free(AVBSFContext **pctx)
Free a bitstream filter context and everything associated with it; write NULL into the supplied point...
uint8_t * av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type, size_t size)
Allocate new information from stream.
const char * avio_find_protocol_name(const char *url)
Return the name of the protocol that will handle the passed URL.
int need_context_update
Whether the internal avctx needs to be updated from codecpar (after a late change to codecpar)
#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).
struct AVCodecParserContext * parser
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int ffio_read_size(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
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.
const AVClass * av_stream_get_class(void)
Get the AVClass for AVStream.
char * av_strndup(const char *s, size_t len)
Duplicate a substring of a string.
int pts_wrap_bits
Number of bits in timestamps.
AVRational time_base
time base in which the start/end timestamps are specified
int64_t pts_wrap_reference
Internal data to check for wrapping of the time stamp.
int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp)
Set a dictionary value to an ISO-8601 compliant timestamp string.
int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **pctx)
Allocate a context for a given bitstream filter.
static AVCodecContext * dec_ctx
void av_parser_close(AVCodecParserContext *s)