FFmpeg 5.1.6
|
Format I/O context. More...
#include <libavformat/avformat.h>
Data Fields | |
const AVClass * | av_class |
A class for logging and AVOptions. More... | |
const struct AVInputFormat * | iformat |
The input container format. More... | |
const struct AVOutputFormat * | oformat |
The output container format. More... | |
void * | priv_data |
Format private data. More... | |
AVIOContext * | pb |
I/O context. More... | |
int | ctx_flags |
Flags signalling stream properties. More... | |
unsigned int | nb_streams |
Number of elements in AVFormatContext.streams. More... | |
AVStream ** | streams |
A list of all streams in the file. More... | |
char * | url |
input or output URL. More... | |
int64_t | start_time |
Position of the first frame of the component, in AV_TIME_BASE fractional seconds. More... | |
int64_t | duration |
Duration of the stream, in AV_TIME_BASE fractional seconds. More... | |
int64_t | bit_rate |
Total stream bitrate in bit/s, 0 if not available. More... | |
unsigned int | packet_size |
int | max_delay |
int | flags |
Flags modifying the (de)muxer behaviour. More... | |
int64_t | probesize |
Maximum number of bytes read from input in order to determine stream properties. More... | |
int64_t | max_analyze_duration |
Maximum duration (in AV_TIME_BASE units) of the data read from input in avformat_find_stream_info(). More... | |
const uint8_t * | key |
int | keylen |
unsigned int | nb_programs |
AVProgram ** | programs |
enum AVCodecID | video_codec_id |
Forced video codec_id. More... | |
enum AVCodecID | audio_codec_id |
Forced audio codec_id. More... | |
enum AVCodecID | subtitle_codec_id |
Forced subtitle codec_id. More... | |
unsigned int | max_index_size |
Maximum amount of memory in bytes to use for the index of each stream. More... | |
unsigned int | max_picture_buffer |
Maximum amount of memory in bytes to use for buffering frames obtained from realtime capture devices. More... | |
unsigned int | nb_chapters |
Number of chapters in AVChapter array. More... | |
AVChapter ** | chapters |
AVDictionary * | metadata |
Metadata that applies to the whole file. More... | |
int64_t | start_time_realtime |
Start time of the stream in real world time, in microseconds since the Unix epoch (00:00 1st January 1970). More... | |
int | fps_probe_size |
The number of frames used for determining the framerate in avformat_find_stream_info(). More... | |
int | error_recognition |
Error recognition; higher values will detect more errors but may misdetect some more or less valid parts as errors. More... | |
AVIOInterruptCB | interrupt_callback |
Custom interrupt callbacks for the I/O layer. More... | |
int | debug |
Flags to enable debugging. More... | |
int64_t | max_interleave_delta |
Maximum buffering duration for interleaving. More... | |
int | strict_std_compliance |
Allow non-standard and experimental extension. More... | |
int | event_flags |
Flags indicating events happening on the file, a combination of AVFMT_EVENT_FLAG_*. More... | |
int | max_ts_probe |
Maximum number of packets to read while waiting for the first timestamp. More... | |
int | avoid_negative_ts |
Avoid negative timestamps during muxing. More... | |
int | ts_id |
Transport stream id. More... | |
int | audio_preload |
Audio preload in microseconds. More... | |
int | max_chunk_duration |
Max chunk time in microseconds. More... | |
int | max_chunk_size |
Max chunk size in bytes Note, not all formats support this and unpredictable things may happen if it is used when not supported. More... | |
int | use_wallclock_as_timestamps |
forces the use of wallclock timestamps as pts/dts of packets This has undefined results in the presence of B frames. More... | |
int | avio_flags |
avio flags, used to force AVIO_FLAG_DIRECT. More... | |
enum AVDurationEstimationMethod | duration_estimation_method |
The duration field can be estimated through various ways, and this field can be used to know how the duration was estimated. More... | |
int64_t | skip_initial_bytes |
Skip initial bytes when opening stream. More... | |
unsigned int | correct_ts_overflow |
Correct single timestamp overflows. More... | |
int | seek2any |
Force seeking to any (also non key) frames. More... | |
int | flush_packets |
Flush the I/O context after each packet. More... | |
int | probe_score |
format probing score. More... | |
int | format_probesize |
Maximum number of bytes read from input in order to identify the input format. More... | |
char * | codec_whitelist |
',' separated list of allowed decoders. More... | |
char * | format_whitelist |
',' separated list of allowed demuxers. More... | |
int | io_repositioned |
IO repositioned flag. More... | |
const AVCodec * | video_codec |
Forced video codec. More... | |
const AVCodec * | audio_codec |
Forced audio codec. More... | |
const AVCodec * | subtitle_codec |
Forced subtitle codec. More... | |
const AVCodec * | data_codec |
Forced data codec. More... | |
int | metadata_header_padding |
Number of bytes to be written as padding in a metadata header. More... | |
void * | opaque |
User data. More... | |
av_format_control_message | control_message_cb |
Callback used by devices to communicate with application. More... | |
int64_t | output_ts_offset |
Output timestamp offset, in microseconds. More... | |
uint8_t * | dump_separator |
dump format separator. More... | |
enum AVCodecID | data_codec_id |
Forced Data codec_id. More... | |
char * | protocol_whitelist |
',' separated list of allowed protocols. More... | |
int(* | io_open )(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, AVDictionary **options) |
A callback for opening new IO streams. More... | |
void(* | io_close )(struct AVFormatContext *s, AVIOContext *pb) |
A callback for closing the streams opened with AVFormatContext.io_open(). More... | |
char * | protocol_blacklist |
',' separated list of disallowed protocols. More... | |
int | max_streams |
The maximum number of streams. More... | |
int | skip_estimate_duration_from_pts |
Skip duration calcuation in estimate_timings_from_pts. More... | |
int | max_probe_packets |
Maximum number of packets that can be probed. More... | |
int(* | io_close2 )(struct AVFormatContext *s, AVIOContext *pb) |
A callback for closing the streams opened with AVFormatContext.io_open(). More... | |
Format I/O context.
New fields can be added to the end with minor version bumps. Removal, reordering and changes to existing fields require a major version bump. sizeof(AVFormatContext) must not be used outside libav*, use avformat_alloc_context() to create an AVFormatContext.
Fields can be accessed through AVOptions (av_opt*), the name string used matches the associated command line parameter name and can be found in libavformat/options_table.h. The AVOption/command line parameter names differ in some cases from the C structure field names for historic reasons or brevity.
Definition at line 1213 of file avformat.h.
const AVClass* AVFormatContext::av_class |
A class for logging and AVOptions.
Set by avformat_alloc_context(). Exports (de)muxer private options if they exist.
Definition at line 1218 of file avformat.h.
const struct AVInputFormat* AVFormatContext::iformat |
The input container format.
Demuxing only, set by avformat_open_input().
Definition at line 1225 of file avformat.h.
const struct AVOutputFormat* AVFormatContext::oformat |
The output container format.
Muxing only, must be set by the caller before avformat_write_header().
Definition at line 1232 of file avformat.h.
Referenced by add_stream(), main(), and open_output_file().
void* AVFormatContext::priv_data |
Format private data.
This is an AVOptions-enabled struct if and only if iformat/oformat.priv_class is not NULL.
Definition at line 1241 of file avformat.h.
AVIOContext* AVFormatContext::pb |
I/O context.
Do NOT set this field if AVFMT_NOFILE flag is set in iformat/oformat.flags. In such a case, the (de)muxer will handle I/O in some other way and this field will be NULL.
Definition at line 1255 of file avformat.h.
Referenced by main(), and open_output_file().
int AVFormatContext::ctx_flags |
Flags signalling stream properties.
A combination of AVFMTCTX_*. Set by libavformat.
Definition at line 1262 of file avformat.h.
unsigned int AVFormatContext::nb_streams |
Number of elements in AVFormatContext.streams.
Set by avformat_new_stream(), must not be modified by any other code.
Definition at line 1269 of file avformat.h.
Referenced by add_stream(), init_filters(), main(), open_input_file(), and open_output_file().
AVStream** AVFormatContext::streams |
A list of all streams in the file.
New streams are created with avformat_new_stream().
Freed by libavformat in avformat_free_context().
Definition at line 1281 of file avformat.h.
Referenced by encode_write(), encode_write_frame(), init_filters(), log_packet(), main(), open_codec_context(), open_input_file(), and open_output_file().
char* AVFormatContext::url |
input or output URL.
Unlike the old filename field, this field has no length restriction.
Freed by libavformat in avformat_free_context().
Definition at line 1296 of file avformat.h.
int64_t AVFormatContext::start_time |
Position of the first frame of the component, in AV_TIME_BASE fractional seconds.
NEVER set this value directly: It is deduced from the AVStream values.
Demuxing only, set by libavformat.
Definition at line 1305 of file avformat.h.
int64_t AVFormatContext::duration |
Duration of the stream, in AV_TIME_BASE fractional seconds.
Only set this value if you know none of the individual stream durations and also do not set any of them. This is deduced from the AVStream values if not set.
Demuxing only, set by libavformat.
Definition at line 1315 of file avformat.h.
int64_t AVFormatContext::bit_rate |
Total stream bitrate in bit/s, 0 if not available.
Never set it directly if the file_size and the duration are known as FFmpeg can compute it automatically.
Definition at line 1322 of file avformat.h.
unsigned int AVFormatContext::packet_size |
Definition at line 1324 of file avformat.h.
int AVFormatContext::max_delay |
Definition at line 1325 of file avformat.h.
int AVFormatContext::flags |
Flags modifying the (de)muxer behaviour.
A combination of AVFMT_FLAG_*. Set by the user before avformat_open_input() / avformat_write_header().
Definition at line 1331 of file avformat.h.
int64_t AVFormatContext::probesize |
Maximum number of bytes read from input in order to determine stream properties.
Used when reading the global header and in avformat_find_stream_info().
Demuxing only, set by the caller before avformat_open_input().
Definition at line 1368 of file avformat.h.
int64_t AVFormatContext::max_analyze_duration |
Maximum duration (in AV_TIME_BASE units) of the data read from input in avformat_find_stream_info().
Demuxing only, set by the caller before avformat_find_stream_info(). Can be set to 0 to let avformat choose using a heuristic.
Definition at line 1376 of file avformat.h.
const uint8_t* AVFormatContext::key |
Definition at line 1378 of file avformat.h.
int AVFormatContext::keylen |
Definition at line 1379 of file avformat.h.
unsigned int AVFormatContext::nb_programs |
Definition at line 1381 of file avformat.h.
AVProgram** AVFormatContext::programs |
Definition at line 1382 of file avformat.h.
enum AVCodecID AVFormatContext::video_codec_id |
enum AVCodecID AVFormatContext::audio_codec_id |
enum AVCodecID AVFormatContext::subtitle_codec_id |
unsigned int AVFormatContext::max_index_size |
Maximum amount of memory in bytes to use for the index of each stream.
If the index exceeds this size, entries will be discarded as needed to maintain a smaller size. This can lead to slower or less accurate seeking (depends on demuxer). Demuxers for which a full in-memory index is mandatory will ignore this.
Definition at line 1412 of file avformat.h.
unsigned int AVFormatContext::max_picture_buffer |
Maximum amount of memory in bytes to use for buffering frames obtained from realtime capture devices.
Definition at line 1418 of file avformat.h.
unsigned int AVFormatContext::nb_chapters |
Number of chapters in AVChapter array.
When muxing, chapters are normally written in the file header, so nb_chapters should normally be initialized before write_header is called. Some muxers (e.g. mov and mkv) can also write chapters in the trailer. To write chapters in the trailer, nb_chapters must be zero when write_header is called and non-zero when write_trailer is called.
Definition at line 1431 of file avformat.h.
AVChapter** AVFormatContext::chapters |
Definition at line 1432 of file avformat.h.
AVDictionary* AVFormatContext::metadata |
Metadata that applies to the whole file.
Freed by libavformat in avformat_free_context().
Definition at line 1442 of file avformat.h.
Referenced by main().
int64_t AVFormatContext::start_time_realtime |
Start time of the stream in real world time, in microseconds since the Unix epoch (00:00 1st January 1970).
That is, pts=0 in the stream was captured at this real world time.
Definition at line 1455 of file avformat.h.
int AVFormatContext::fps_probe_size |
The number of frames used for determining the framerate in avformat_find_stream_info().
Demuxing only, set by the caller before avformat_find_stream_info().
Definition at line 1462 of file avformat.h.
int AVFormatContext::error_recognition |
Error recognition; higher values will detect more errors but may misdetect some more or less valid parts as errors.
Demuxing only, set by the caller before avformat_open_input().
Definition at line 1469 of file avformat.h.
AVIOInterruptCB AVFormatContext::interrupt_callback |
Custom interrupt callbacks for the I/O layer.
demuxing: set by the user before avformat_open_input(). muxing: set by the user before avformat_write_header() (mainly useful for AVFMT_NOFILE formats). The callback should also be passed to avio_open2() if it's used to open the file.
Definition at line 1480 of file avformat.h.
int AVFormatContext::debug |
Flags to enable debugging.
Definition at line 1485 of file avformat.h.
int64_t AVFormatContext::max_interleave_delta |
Maximum buffering duration for interleaving.
To ensure all the streams are interleaved correctly, av_interleaved_write_frame() will wait until it has at least one packet for each stream before actually writing any packets to the output file. When some streams are "sparse" (i.e. there are large gaps between successive packets), this can result in excessive buffering.
This field specifies the maximum difference between the timestamps of the first and the last packet in the muxing queue, above which libavformat will output a packet regardless of whether it has queued a packet for all the streams.
Muxing only, set by the caller before avformat_write_header().
Definition at line 1504 of file avformat.h.
int AVFormatContext::strict_std_compliance |
Allow non-standard and experimental extension.
Definition at line 1510 of file avformat.h.
int AVFormatContext::event_flags |
Flags indicating events happening on the file, a combination of AVFMT_EVENT_FLAG_*.
Definition at line 1523 of file avformat.h.
int AVFormatContext::max_ts_probe |
Maximum number of packets to read while waiting for the first timestamp.
Decoding only.
Definition at line 1536 of file avformat.h.
int AVFormatContext::avoid_negative_ts |
Avoid negative timestamps during muxing.
Any value of the AVFMT_AVOID_NEG_TS_* constants. Note, this works better when using av_interleaved_write_frame().
Definition at line 1545 of file avformat.h.
int AVFormatContext::ts_id |
Transport stream id.
This will be moved into demuxer private options. Thus no API/ABI compatibility
Definition at line 1555 of file avformat.h.
int AVFormatContext::audio_preload |
Audio preload in microseconds.
Note, not all formats support this and unpredictable things may happen if it is used when not supported.
Definition at line 1563 of file avformat.h.
int AVFormatContext::max_chunk_duration |
Max chunk time in microseconds.
Note, not all formats support this and unpredictable things may happen if it is used when not supported.
Definition at line 1571 of file avformat.h.
int AVFormatContext::max_chunk_size |
Max chunk size in bytes Note, not all formats support this and unpredictable things may happen if it is used when not supported.
Definition at line 1579 of file avformat.h.
int AVFormatContext::use_wallclock_as_timestamps |
forces the use of wallclock timestamps as pts/dts of packets This has undefined results in the presence of B frames.
Definition at line 1587 of file avformat.h.
int AVFormatContext::avio_flags |
avio flags, used to force AVIO_FLAG_DIRECT.
Definition at line 1594 of file avformat.h.
enum AVDurationEstimationMethod AVFormatContext::duration_estimation_method |
The duration field can be estimated through various ways, and this field can be used to know how the duration was estimated.
Definition at line 1602 of file avformat.h.
int64_t AVFormatContext::skip_initial_bytes |
Skip initial bytes when opening stream.
Definition at line 1609 of file avformat.h.
unsigned int AVFormatContext::correct_ts_overflow |
Correct single timestamp overflows.
Definition at line 1616 of file avformat.h.
int AVFormatContext::seek2any |
Force seeking to any (also non key) frames.
Definition at line 1623 of file avformat.h.
int AVFormatContext::flush_packets |
Flush the I/O context after each packet.
Definition at line 1630 of file avformat.h.
int AVFormatContext::probe_score |
format probing score.
The maximal score is AVPROBE_SCORE_MAX, its set when the demuxer probes the format.
Definition at line 1639 of file avformat.h.
int AVFormatContext::format_probesize |
Maximum number of bytes read from input in order to identify the input format.
Only used when the format is not set explicitly by the caller.
Demuxing only, set by the caller before avformat_open_input().
Definition at line 1650 of file avformat.h.
char* AVFormatContext::codec_whitelist |
',' separated list of allowed decoders.
If NULL then all are allowed
Definition at line 1658 of file avformat.h.
char* AVFormatContext::format_whitelist |
',' separated list of allowed demuxers.
If NULL then all are allowed
Definition at line 1666 of file avformat.h.
int AVFormatContext::io_repositioned |
IO repositioned flag.
This is set by avformat when the underlaying IO context read pointer is repositioned, for example when doing byte based seeking. Demuxers can use the flag to detect such changes.
Definition at line 1674 of file avformat.h.
const AVCodec* AVFormatContext::video_codec |
Forced video codec.
This allows forcing a specific decoder, even when there are multiple with the same codec_id. Demuxing: Set by user
Definition at line 1682 of file avformat.h.
const AVCodec* AVFormatContext::audio_codec |
Forced audio codec.
This allows forcing a specific decoder, even when there are multiple with the same codec_id. Demuxing: Set by user
Definition at line 1690 of file avformat.h.
const AVCodec* AVFormatContext::subtitle_codec |
Forced subtitle codec.
This allows forcing a specific decoder, even when there are multiple with the same codec_id. Demuxing: Set by user
Definition at line 1698 of file avformat.h.
const AVCodec* AVFormatContext::data_codec |
Forced data codec.
This allows forcing a specific decoder, even when there are multiple with the same codec_id. Demuxing: Set by user
Definition at line 1706 of file avformat.h.
int AVFormatContext::metadata_header_padding |
Number of bytes to be written as padding in a metadata header.
Demuxing: Unused. Muxing: Set by user via av_format_set_metadata_header_padding.
Definition at line 1713 of file avformat.h.
void* AVFormatContext::opaque |
User data.
This is a place for some private data of the user.
Definition at line 1719 of file avformat.h.
av_format_control_message AVFormatContext::control_message_cb |
Callback used by devices to communicate with application.
Definition at line 1724 of file avformat.h.
int64_t AVFormatContext::output_ts_offset |
Output timestamp offset, in microseconds.
Muxing: set by user
Definition at line 1730 of file avformat.h.
uint8_t* AVFormatContext::dump_separator |
dump format separator.
can be ", " or "\n " or anything else
Definition at line 1738 of file avformat.h.
enum AVCodecID AVFormatContext::data_codec_id |
char* AVFormatContext::protocol_whitelist |
',' separated list of allowed protocols.
Definition at line 1751 of file avformat.h.
int(* AVFormatContext::io_open) (struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, AVDictionary **options) |
A callback for opening new IO streams.
Whenever a muxer or a demuxer needs to open an IO stream (typically from avformat_open_input() for demuxers, but for certain formats can happen at other times as well), it will call this callback to obtain an IO context.
s | the format context |
pb | on success, the newly opened IO context should be returned here |
url | the url to open |
flags | a combination of AVIO_FLAG_* |
options | a dictionary of additional options, with the same semantics as in avio_open2() |
Definition at line 1773 of file avformat.h.
void(* AVFormatContext::io_close) (struct AVFormatContext *s, AVIOContext *pb) |
A callback for closing the streams opened with AVFormatContext.io_open().
Definition at line 1779 of file avformat.h.
char* AVFormatContext::protocol_blacklist |
',' separated list of disallowed protocols.
Definition at line 1786 of file avformat.h.
int AVFormatContext::max_streams |
The maximum number of streams.
Definition at line 1793 of file avformat.h.
int AVFormatContext::skip_estimate_duration_from_pts |
Skip duration calcuation in estimate_timings_from_pts.
Definition at line 1800 of file avformat.h.
int AVFormatContext::max_probe_packets |
Maximum number of packets that can be probed.
Definition at line 1807 of file avformat.h.
int(* AVFormatContext::io_close2) (struct AVFormatContext *s, AVIOContext *pb) |
A callback for closing the streams opened with AVFormatContext.io_open().
Using this is preferred over io_close, because this can return an error. Therefore this callback is used instead of io_close by the generic libavformat code if io_close is NULL or the default.
s | the format context |
pb | IO context to be closed and freed |
Definition at line 1820 of file avformat.h.