Go to the documentation of this file.
22 #include "config_components.h"
90 #define MAX_ODML_DEPTH 1000
110 {
'R',
'I',
'F',
'F',
'A',
'V',
'I',
' ' },
111 {
'R',
'I',
'F',
'F',
'A',
'V',
'I',
'X' },
112 {
'R',
'I',
'F',
'F',
'A',
'V',
'I', 0x19 },
113 {
'O',
'N',
'2',
' ',
'O',
'N',
'2',
'f' },
114 {
'R',
'I',
'F',
'F',
'A',
'M',
'V',
' ' },
120 {
"isbj",
"subject" },
122 {
"iart",
"artist" },
123 {
"icop",
"copyright" },
124 {
"icmt",
"comment" },
126 {
"iprd",
"product" },
127 {
"isft",
"software" },
135 #define print_tag(s, str, tag, size) \
136 av_log(s, AV_LOG_TRACE, "pos:%"PRIX64" %s: tag=%s size=0x%x\n", \
137 avio_tell(pb), str, av_fourcc2str(tag), size) \
169 "This file has been generated by a totally broken muxer.\n");
179 int index_sub_type =
avio_r8(pb);
184 int stream_id = ((chunk_id & 0xFF) -
'0') * 10 +
185 ((chunk_id >> 8 & 0xFF) -
'0');
193 "longs_per_entry:%d index_type:%d entries_in_use:%d "
194 "chunk_id:%X base:%16"PRIX64
" frame_num:%"PRId64
"\n",
202 if (stream_id >=
s->nb_streams || stream_id < 0)
204 st =
s->streams[stream_id];
207 if (index_sub_type || entries_in_use < 0)
212 if (index_type && longs_per_entry != 2)
219 if (
base >> 32 == (
base & 0xFFFFFFFF) &&
227 for (
i = 0;
i < entries_in_use;
i++) {
248 if (last_pos !=
pos &&
len)
298 for (
i = 0;
i <
s->nb_streams;
i++) {
316 for (j = 0; j <
size; j +=
max)
331 if (
size == UINT_MAX)
348 static const char months[12][4] = {
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
349 "Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec" };
353 char month[4], time[9],
buffer[64];
356 if (sscanf(date,
"%*3s%*[ ]%3s%*[ ]%2d%*[ ]%8s%*[ ]%4d",
357 month, &day, time, &year) == 4) {
358 for (
i = 0;
i < 12;
i++)
361 year,
i + 1, day, time);
364 }
else if (date[4] ==
'/' && date[7] ==
'/') {
365 date[4] = date[7] =
'-';
376 case MKTAG(
'n',
'c',
't',
'g'):
384 uint64_t remaining = tag_end -
avio_tell(
s->pb);
396 name =
"creation_time";
421 if (!
data || data_size < 8) {
427 tag = bytestream2_get_le32(&gb);
430 case MKTAG(
'A',
'V',
'I',
'F'): {
445 case MKTAG(
'C',
'A',
'S',
'I'):
448 case MKTAG(
'Z',
'o',
'r',
'a'):
465 for (
i = 0;
i<
s->nb_streams;
i++) {
479 if (lensum*9/10 > maxpos || lensum < maxpos*9/10)
482 for (
i = 0;
i<
s->nb_streams;
i++) {
518 int avih_width = 0, avih_height = 0;
519 int amv_file_format = 0;
520 uint64_t list_end = 0;
550 case MKTAG(
'L',
'I',
'S',
'T'):
557 if (tag1 ==
MKTAG(
'm',
'o',
'v',
'i')) {
565 }
else if (tag1 ==
MKTAG(
'I',
'N',
'F',
'O'))
567 else if (tag1 ==
MKTAG(
'n',
'c',
'd',
't'))
571 case MKTAG(
'I',
'D',
'I',
'T'):
573 unsigned char date[64] = { 0 };
580 case MKTAG(
'd',
'm',
'l',
'h'):
584 case MKTAG(
'a',
'm',
'v',
'h'):
586 case MKTAG(
'a',
'v',
'i',
'h'):
602 case MKTAG(
's',
't',
'r',
'h'):
608 if (tag1 ==
MKTAG(
'p',
'a',
'd',
's')) {
617 st->
id = stream_index;
624 tag1 = stream_index ?
MKTAG(
'a',
'u',
'd',
's')
625 :
MKTAG(
'v',
'i',
'd',
's');
629 if (tag1 ==
MKTAG(
'i',
'a',
'v',
's') ||
630 tag1 ==
MKTAG(
'i',
'v',
'a',
's')) {
635 if (
s->nb_streams != 1)
643 if (!CONFIG_DV_DEMUXER)
646 ast =
s->streams[0]->priv_data;
656 s->streams[0]->priv_data = ast;
663 if (ast->
scale > 0 && ast->
rate > 0 && dv_dur > 0) {
670 stream_index =
s->nb_streams - 1;
686 "scale/rate is %"PRIu32
"/%"PRIu32
" which is invalid. "
687 "(This file has been generated by broken software.)\n",
692 ast->
scale = frame_period;
716 case MKTAG(
'v',
'i',
'd',
's'):
722 case MKTAG(
'a',
'u',
'd',
's'):
725 case MKTAG(
't',
'x',
't',
's'):
728 case MKTAG(
'd',
'a',
't',
's'):
738 "Invalid sample_size %d at stream %d\n",
744 "Invalid sample_size %d at stream %d "
761 case MKTAG(
's',
't',
'r',
'f'):
766 if (stream_index >= (
unsigned)
s->nb_streams || avi->
dv_demux) {
772 if (cur_pos < list_end)
774 st =
s->streams[stream_index];
782 if (amv_file_format) {
792 if (tag1 ==
MKTAG(
'D',
'X',
'S',
'B') ||
793 tag1 ==
MKTAG(
'D',
'X',
'S',
'A')) {
800 if (
size > 10 * 4 &&
size < (1 << 30) && size < avi->
fsize) {
801 if (esize ==
size-1 && (esize&1)) {
825 const uint8_t *pal_src;
834 for (
i = 0;
i < pal_size / 4;
i++)
851 "mov tag found in avi (fourcc %s)\n",
906 "sample size (%d) != block align (%d)\n",
934 if (amv_file_format) {
966 case MKTAG(
's',
't',
'r',
'd'):
967 if (stream_index >= (
unsigned)
s->nb_streams
968 ||
s->streams[stream_index]->codecpar->extradata_size
969 ||
s->streams[stream_index]->codecpar->codec_tag ==
MKTAG(
'H',
'2',
'6',
'4')) {
973 if (cur_pos < list_end)
975 st =
s->streams[stream_index];
994 case MKTAG(
'i',
'n',
'd',
'x'):
1003 case MKTAG(
'v',
'p',
'r',
'p'):
1004 if (stream_index < (
unsigned)
s->nb_streams &&
size > 9 * 4) {
1007 st =
s->streams[stream_index];
1020 if (active_aspect.
num && active_aspect.
den &&
1021 active.
num && active.
den) {
1024 active_aspect.
num, active_aspect.
den,
1031 case MKTAG(
's',
't',
'r',
'n'):
1032 case MKTAG(
'i',
's',
'b',
'j'):
1033 case MKTAG(
'i',
'n',
'a',
'm'):
1034 case MKTAG(
'i',
'a',
'r',
't'):
1035 case MKTAG(
'i',
'c',
'o',
'p'):
1036 case MKTAG(
'i',
'c',
'm',
't'):
1037 case MKTAG(
'i',
'g',
'n',
'r'):
1038 case MKTAG(
'i',
'p',
'o',
'd'):
1039 case MKTAG(
'i',
's',
'o',
'f'):
1040 if (
s->nb_streams) {
1047 if (
size > 1000000) {
1049 "Something went wrong during header parsing, "
1050 "tag %s has size %u, "
1051 "I will ignore it and try to continue anyway.\n",
1060 case MKTAG(
'i',
'd',
'x',
'1'):
1070 if (stream_index !=
s->nb_streams - 1)
1084 if (dict_entry && !strcmp(dict_entry->
value,
"PotEncoder"))
1085 for (
i = 0;
i <
s->nb_streams;
i++) {
1092 for (
i = 0;
i <
s->nb_streams;
i++) {
1094 if (
ffstream(st)->nb_index_entries)
1103 "Non-interleaved AVI without index, switching to interleaved\n");
1130 unsigned int desc_len;
1165 if (strcmp(sub_demuxer->
name,
"srt") && strcmp(sub_demuxer->
name,
"ass"))
1204 int64_t ts, next_ts, ts_min = INT64_MAX;
1211 for (
i = 0;
i <
s->nb_streams;
i++) {
1216 if (ts <= next_ts && ts < ts_min) {
1236 if (d[0] >=
'0' && d[0] <=
'9' &&
1237 d[1] >=
'0' && d[1] <=
'9') {
1238 return (d[0] -
'0') * 10 + (d[1] -
'0');
1258 memset(d, -1,
sizeof(d));
1262 for (j = 0; j < 7; j++)
1266 size = d[4] + (d[5] << 8) + (d[6] << 16) + (d[7] << 24);
1269 ff_tlog(
s,
"%X %X %X %X %X %X %X %X %"PRId64
" %u %d\n",
1270 d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7],
i,
size, n);
1275 if ((d[0] ==
'i' && d[1] ==
'x' && n < s->
nb_streams) ||
1277 (d[0] ==
'J' && d[1] ==
'U' && d[2] ==
'N' && d[3] ==
'K') ||
1278 (d[0] ==
'i' && d[1] ==
'd' && d[2] ==
'x' && d[3] ==
'1') ||
1279 (d[0] ==
'i' && d[1] ==
'n' && d[2] ==
'd' && d[3] ==
'x')) {
1285 if (d[0] ==
'L' && d[1] ==
'I' && d[2] ==
'S' && d[3] ==
'T') {
1297 if (d[2] ==
'i' && d[3] ==
'x' && n < s->
nb_streams) {
1302 if (d[2] ==
'w' && d[3] ==
'c' && n < s->
nb_streams) {
1322 if (
s->nb_streams >= 2) {
1326 if (ast1 && d[2] ==
'w' && d[3] ==
'b'
1330 && ast->
prefix ==
'd'*256+
'c'
1337 "Invalid stream + prefix combination, assuming audio.\n");
1341 if (d[2] ==
'p' && d[3] ==
'c' &&
size <= 4 * 256 + 4) {
1343 int last = (k +
avio_r8(pb) - 1) & 0xFF;
1348 for (; k <= last; k++)
1354 d[2] < 128 && d[3] < 128) ||
1355 d[2] * 256 + d[3] == ast->
prefix
1360 if (d[2] * 256 + d[3] == ast->
prefix)
1363 ast->
prefix = d[2] * 256 + d[3];
1405 int best_stream_index = 0;
1412 for (
i = 0;
i <
s->nb_streams;
i++) {
1435 best_stream_index =
i;
1480 if (CONFIG_DV_DEMUXER && avi->
dv_demux) {
1499 int dv_demux = CONFIG_DV_DEMUXER && avi->
dv_demux;
1522 if (ast->
has_pal &&
pkt->
size < (
unsigned)INT_MAX / 2 && !dv_demux) {
1529 "Failed to allocate data for palette\n");
1536 if (CONFIG_DV_DEMUXER && dv_demux) {
1571 if (
state == 0x1B6 && ptr < end) {
1572 key = !(*ptr & 0xC0);
1625 int nb_index_entries,
i;
1631 unsigned last_idx = -1;
1632 int64_t idx1_pos, first_packet_pos = 0, data_offset = 0;
1635 nb_index_entries =
size / 16;
1636 if (nb_index_entries <= 0)
1646 if (
s->nb_streams == 1 &&
s->streams[0]->codecpar->codec_tag ==
AV_RL32(
"MMES")) {
1647 first_packet_pos = 0;
1652 for (
i = 0;
i < nb_index_entries;
i++) {
1665 if (
index >=
s->nb_streams)
1672 if ((
tag >> 16 & 0xff) ==
'p' && (
tag >> 24 & 0xff) ==
'c')
1675 if (first_packet && first_packet_pos) {
1677 data_offset = first_packet_pos -
pos;
1686 if (last_pos ==
pos)
1688 if (last_idx !=
pos &&
len) {
1713 int *idx =
av_calloc(
s->nb_streams,
sizeof(*idx));
1716 for (min_pos =
pos = 0; min_pos != INT64_MAX;
pos = min_pos + 1ULL) {
1717 int64_t max_dts = INT64_MIN / 2;
1718 int64_t min_dts = INT64_MAX / 2;
1721 min_pos = INT64_MAX;
1723 for (
i = 0;
i <
s->nb_streams;
i++) {
1735 min_dts =
FFMIN(min_dts, dts);
1739 for (
i = 0;
i <
s->nb_streams;
i++) {
1744 if (idx[
i] && min_dts != INT64_MAX / 2) {
1750 max_dts =
FFMAX(max_dts, dts);
1751 max_buffer =
FFMAX(max_buffer,
1758 max_buffer > 1024 * 1024 * 8 * 8) {
1771 int64_t first_end = INT64_MAX;
1774 for (
i = 0;
i <
s->nb_streams;
i++) {
1792 last_start = INT64_MAX;
1794 last_start = INT64_MAX;
1804 if (last_start > first_end)
1828 if (next < 0 || next > INT64_MAX -
size - (
size & 1))
1832 if (
tag ==
MKTAG(
'i',
'd',
'x',
'1') &&
1836 }
else if (
tag ==
MKTAG(
'L',
'I',
'S',
'T')) {
1839 if (tag1 ==
MKTAG(
'I',
'N',
'F',
'O'))
1886 st =
s->streams[stream_index];
1901 av_log(
s,
AV_LOG_DEBUG,
"Failed to find timestamp %"PRId64
" in index %"PRId64
" .. %"PRId64
"\n",
1915 if (CONFIG_DV_DEMUXER && avi->
dv_demux) {
1935 for (
i = 0;
i <
s->nb_streams;
i++) {
1965 for (
i = 0;
i <
s->nb_streams;
i++) {
1985 if (
avio_seek(
s->pb, pos_min, SEEK_SET) < 0) {
1999 for (
i = 0;
i <
s->nb_streams;
i++) {
2033 .p.extensions =
"avi",
static void error(const char *err)
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
#define AV_LOG_WARNING
Something somehow does not look correct.
const FFInputFormat ff_avi_demuxer
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
#define AV_EF_EXPLODE
abort decoding on minor error detection
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
static const AVOption options[]
static int ni_prepare_read(AVFormatContext *s)
enum AVMediaType codec_type
General type of the encoded data.
int av_exif_parse_buffer(void *logctx, const uint8_t *buf, size_t size, AVExifMetadata *ifd, enum AVExifHeaderMode header_mode)
Decodes the EXIF data provided in the buffer and writes it into the struct *ifd.
AVFormatContext * sub_ctx
static int avi_read_idx1(AVFormatContext *s, int size)
static const AVClass demuxer_class
static av_always_inline int bytestream2_tell(const GetByteContext *g)
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
#define AVERROR_EOF
End of file.
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
AVRational av_div_q(AVRational b, AVRational c)
Divide one rational by another.
void avio_context_free(AVIOContext **s)
Free the supplied IO context and everything associated with it.
int av_exif_ifd_to_dict(void *logctx, const AVExifMetadata *ifd, AVDictionary **metadata)
Recursively reads all tags from the IFD and stores them in the provided metadata dictionary.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
AVStream ** streams
A list of all streams in the file.
AVIOContext * avio_alloc_context(unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int(*read_packet)(void *opaque, uint8_t *buf, int buf_size), int(*write_packet)(void *opaque, const uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence))
Allocate and initialize an AVIOContext for buffered I/O.
static int avi_read_close(AVFormatContext *s)
AVRational avg_frame_rate
Average framerate.
int error
contains the error code or 0 if no error happened
static void avi_read_nikon(AVFormatContext *s, uint64_t end)
const AVCodecTag ff_codec_bmp_tags_unofficial[]
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
static void avi_metadata_creation_time(AVDictionary **metadata, char *date)
static int read_gab2_sub(AVFormatContext *s, AVStream *st, AVPacket *pkt)
int64_t av_i2int(AVInteger a)
Convert the given AVInteger to an int64_t.
enum AVMediaType codec_type
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.
int ff_get_extradata(void *logctx, AVCodecParameters *par, AVIOContext *pb, int size)
Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end which is always set to 0 and f...
static int check_stream_max_drift(AVFormatContext *s)
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
#define AVIF_MUSTUSEINDEX
static int calculate_bitrate(AVFormatContext *s)
int ff_get_bmp_header(AVIOContext *pb, AVStream *st, uint32_t *size)
Read BITMAPINFOHEADER structure and set AVStream codec width, height and bits_per_encoded_sample fiel...
@ AV_PKT_DATA_PALETTE
An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE bytes worth of palette.
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
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.
static void clean_index(AVFormatContext *s)
static av_cold int read_close(AVFormatContext *ctx)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
void av_exif_free(AVExifMetadata *ifd)
Frees all resources associated with the given EXIF metadata struct.
static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
@ 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.
unsigned int avio_rl16(AVIOContext *s)
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
static void seek_subtitle(AVStream *st, AVStream *st2, int64_t timestamp)
static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t size)
unsigned int avio_rb32(AVIOContext *s)
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int avformat_open_input(AVFormatContext **ps, const char *url, const AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
static int avi_sync(AVFormatContext *s, int exit_early)
int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen)
Read a UTF-16 string from pb and convert it to UTF-8.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
AVInteger av_int2i(int64_t a)
Convert the given int64_t to an AVInteger.
int av_cmp_i(AVInteger a, AVInteger b)
Return 0 if a==b, 1 if a>b and -1 if a<b.
#define print_tag(s, str, tag, size)
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
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 AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
int ff_read_riff_info(AVFormatContext *s, int64_t size)
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
static int64_t fsize(FILE *f)
static void handler(vbi_event *ev, void *user_data)
AVInteger av_add_i(AVInteger a, AVInteger b)
@ AV_CLASS_CATEGORY_DEMUXER
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
const AVInputFormat * av_probe_input_format2(const AVProbeData *pd, int is_opened, int *score_max)
Guess the file format.
#define AVERROR_DEMUXER_NOT_FOUND
Demuxer not found.
#define FF_INFMT_FLAG_INIT_CLEANUP
For an FFInputFormat with this flag set read_close() needs to be called by the caller upon read_heade...
enum AVStreamParseType need_parsing
@ AVDISCARD_ALL
discard all
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.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
static const AVMetadataConv avi_metadata_conv[]
static int get_stream_idx(const unsigned *d)
Rational number (pair of numerator and denominator).
static int get_riff(AVFormatContext *s, AVIOContext *pb)
const char * av_default_item_name(void *ptr)
Return the context name.
AVIOContext * pb
I/O context.
static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
This structure contains the data a format has to probe a file.
const uint8_t * avpriv_find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *state)
@ AV_CODEC_ID_ADPCM_IMA_AMV
const AVCodecTag ff_codec_movvideo_tags[]
static int get_duration(AVIStream *ast, int len)
@ AV_EXIF_ASSUME_LE
skip the TIFF header, assume little endian
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
Move every field in src to dst and reset src.
static int guess_ni_flag(AVFormatContext *s)
int64_t nb_frames
number of frames in this stream if known or 0
int extradata_size
Size of the extradata content in bytes.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
unsigned int avio_rl32(AVIOContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
@ AVDISCARD_DEFAULT
discard useless packets like 0 size packets in avi
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
unsigned char * buf_end
End of the data, may be less than buffer+buffer_size if the read function returned less data than req...
static const char months[12][4]
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
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.
AVInteger av_mul_i(AVInteger a, AVInteger b)
const AVMetadataConv ff_riff_info_conv[]
@ AVMEDIA_TYPE_UNKNOWN
Usually treated as AVMEDIA_TYPE_DATA.
static int avi_probe(const AVProbeData *p)
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
static const uint8_t header[24]
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
int avio_r8(AVIOContext *s)
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
int flags
A combination of AV_PKT_FLAG values.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
static int read_header(FFV1Context *f, RangeCoder *c)
static int read_odml_index(AVFormatContext *s, int64_t frame_num)
AVInteger av_shr_i(AVInteger a, int s)
bitwise shift
#define AV_LOG_INFO
Standard information.
static int64_t filesize(AVIOContext *pb)
static AVStream * get_subtitle_pkt(AVFormatContext *s, AVStream *next_st, AVPacket *pkt)
static int avi_extract_stream_metadata(AVFormatContext *s, AVStream *st)
#define i(width, name, range_min, range_max)
int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
Read a transport packet from a media file.
#define AV_TIME_BASE
Internal time base represented as integer.
int block_align
Audio only.
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 value
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par, int size, int big_endian)
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
static int avi_load_index(AVFormatContext *s)
void * av_calloc(size_t nmemb, size_t size)
int id
Format-specific stream ID.
DVDemuxContext * dv_demux
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...
AVInteger av_div_i(AVInteger a, AVInteger b)
Return a/b.
#define AV_INPUT_BUFFER_PADDING_SIZE
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
int index
stream index in AVFormatContext
const AVCodecTag ff_codec_bmp_tags[]
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, size_t size)
Allocate new information of a packet.
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
static int read_probe(const AVProbeData *p)
int bits_per_coded_sample
The number of bits per sample in the codedwords.
A reference to a data buffer.
#define avpriv_request_sample(...)
static int avi_read_header(AVFormatContext *s)
int request_probe
stream probing state -1 -> probing finished 0 -> no probing requested rest -> perform probing with re...
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
int64_t pos
byte position in stream, -1 if unknown
uint64_t avio_rl64(AVIOContext *s)
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define MKTAG(a, b, c, d)
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
unsigned char * buf_ptr
Current position in the buffer.
@ AV_CODEC_ID_MPEG2VIDEO
preferred ID for MPEG-1/2 video decoding
static const char avi_headers[][8]
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src)
Copy the contents of src to dst.
#define av_fourcc2str(fourcc)
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.