Loading...
Searching...
No Matches
AVFormatContext Struct Reference

Format I/O context. More...

`#include <libavformat/avformat.h>`

## Data Fields

const AVClass * | av_class
| A class for logging and AVOptions.
const struct AVInputFormat * | iformat
| The input container format.
const struct AVOutputFormat * | oformat
| The output container format.
void * | priv_data
| Format private data.
AVIOContext * | pb
| I/O context.
int | ctx_flags
| Flags signalling stream properties.
unsigned int | nb_streams
| Number of elements in AVFormatContext.streams.
AVStream ** | streams
| A list of all streams in the file.
unsigned int | nb_stream_groups
| Number of elements in AVFormatContext.stream_groups.
AVStreamGroup ** | stream_groups
| A list of all stream groups in the file.
unsigned int | nb_chapters
| Number of chapters in AVChapter array.
AVChapter ** | chapters
char * | url
| input or output URL.
int64_t | start_time
| Position of the first frame of the component, in AV_TIME_BASE fractional seconds.
int64_t | duration
| Duration of the stream, in AV_TIME_BASE fractional seconds.
int64_t | bit_rate
| Total stream bitrate in bit/s, 0 if not available.
unsigned int | packet_size
int | max_delay
int | flags
| Flags modifying the (de)muxer behaviour.
int64_t | probesize
| Maximum number of bytes read from input in order to determine stream properties.
int64_t | max_analyze_duration
| Maximum duration (in AV_TIME_BASE units) of the data read from input in avformat_find_stream_info().
const uint8_t * | key
int | keylen
unsigned int | nb_programs
AVProgram ** | programs
enum AVCodecID | video_codec_id
| Forced video codec_id.
enum AVCodecID | audio_codec_id
| Forced audio codec_id.
enum AVCodecID | subtitle_codec_id
| Forced subtitle codec_id.
enum AVCodecID | data_codec_id
| Forced Data codec_id.
AVDictionary * | metadata
| Metadata that applies to the whole file.
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).
int | fps_probe_size
| The number of frames used for determining the framerate in avformat_find_stream_info().
int | error_recognition
| Error recognition; higher values will detect more errors but may misdetect some more or less valid parts as errors.
AVIOInterruptCB | interrupt_callback
| Custom interrupt callbacks for the I/O layer.
int | debug
| Flags to enable debugging.
int | max_streams
| The maximum number of streams.
unsigned int | max_index_size
| Maximum amount of memory in bytes to use for the index of each stream.
unsigned int | max_picture_buffer
| Maximum amount of memory in bytes to use for buffering frames obtained from realtime capture devices.
int64_t | max_interleave_delta
| Maximum buffering duration for interleaving.
int | max_ts_probe
| Maximum number of packets to read while waiting for the first timestamp.
int | max_chunk_duration
| Max chunk time in microseconds.
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.
int | max_probe_packets
| Maximum number of packets that can be probed.
int | strict_std_compliance
| Allow non-standard and experimental extension.
int | event_flags
| Flags indicating events happening on the file, a combination of AVFMT_EVENT_FLAG_*.
int | avoid_negative_ts
| Avoid negative timestamps during muxing.
int | audio_preload
| Audio preload in microseconds.
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.
int | skip_estimate_duration_from_pts
| Skip duration calcuation in estimate_timings_from_pts.
int | avio_flags
| avio flags, used to force AVIO_FLAG_DIRECT.
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.
int64_t | skip_initial_bytes
| Skip initial bytes when opening stream.
unsigned int | correct_ts_overflow
| Correct single timestamp overflows.
int | seek2any
| Force seeking to any (also non key) frames.
int | flush_packets
| Flush the I/O context after each packet.
int | probe_score
| format probing score.
int | format_probesize
| Maximum number of bytes read from input in order to identify the input format.
char * | codec_whitelist
| ',' separated list of allowed decoders.
char * | format_whitelist
| ',' separated list of allowed demuxers.
char * | protocol_whitelist
| ',' separated list of allowed protocols.
char * | protocol_blacklist
| ',' separated list of disallowed protocols.
int | io_repositioned
| IO repositioned flag.
const struct AVCodec * | video_codec
| Forced video codec.
const struct AVCodec * | audio_codec
| Forced audio codec.
const struct AVCodec * | subtitle_codec
| Forced subtitle codec.
const struct AVCodec * | data_codec
| Forced data codec.
int | metadata_header_padding
| Number of bytes to be written as padding in a metadata header.
void * | opaque
| User data.
av_format_control_message | control_message_cb
| Callback used by devices to communicate with application.
int64_t | output_ts_offset
| Output timestamp offset, in microseconds.
uint8_t * | dump_separator
| dump format separator.
int(* | io_open )(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, AVDictionary **options)
| A callback for opening new IO streams.
int(* | io_close2 )(struct AVFormatContext *s, AVIOContext *pb)
| A callback for closing the streams opened with AVFormatContext.io_open().
int64_t | duration_probesize
| Maximum number of bytes read from input in order to determine stream durations when using estimate_timings_from_pts in avformat_find_stream_info().

## Detailed Description

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.

Examples
  avio_read_callback.c, decode_filter_audio.c, decode_filter_video.c, demux_decode.c, extract_mvs.c, hw_decode.c, mux.c, qsv_decode.c, qsv_transcode.c, remux.c, show_metadata.c, transcode.c, transcode_aac.c, and vaapi_transcode.c.

Definition at line 1287 of file avformat.h.

## Field Documentation

## av_class

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 1292 of file avformat.h.

## iformat

const struct AVInputFormat* AVFormatContext::iformat

The input container format.

Demuxing only, set by avformat_open_input().

Definition at line 1299 of file avformat.h.

## oformat

const struct AVOutputFormat* AVFormatContext::oformat

The output container format.

Muxing only, must be set by the caller before avformat_write_header().

Examples
  mux.c, remux.c, and transcode.c.

Definition at line 1306 of file avformat.h.

Referenced by add_stream(), main(), and open_output_file().

## priv_data

void* AVFormatContext::priv_data

Format private data.

This is an AVOptions-enabled struct if and only if iformat/oformat.priv_class is not NULL.

- muxing: set by avformat_write_header()
- demuxing: set by avformat_open_input()

Definition at line 1315 of file avformat.h.

## pb

AVIOContext* AVFormatContext::pb

I/O context.

- demuxing: either set by the user before avformat_open_input() (then the user must close it manually) or set by avformat_open_input().
- muxing: set by the user before avformat_write_header(). The caller must take care of closing / freeing the IO 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.

Examples
  avio_read_callback.c, mux.c, qsv_transcode.c, remux.c, transcode.c, and vaapi_transcode.c.

Definition at line 1329 of file avformat.h.

Referenced by main(), main(), and open_output_file().

## ctx_flags

int AVFormatContext::ctx_flags

Flags signalling stream properties.

A combination of AVFMTCTX_*. Set by libavformat.

Definition at line 1336 of file avformat.h.

## nb_streams

unsigned int AVFormatContext::nb_streams

Number of elements in AVFormatContext.streams.

Set by avformat_new_stream(), must not be modified by any other code.

Examples
  mux.c, qsv_decode.c, remux.c, and transcode.c.

Definition at line 1343 of file avformat.h.

Referenced by add_stream(), init_filters(), main(), open_input_file(), and open_output_file().

## streams

AVStream** AVFormatContext::streams

A list of all streams in the file.

New streams are created with avformat_new_stream().

- demuxing: streams are created by libavformat in avformat_open_input(). If AVFMTCTX_NOHEADER is set in ctx_flags, then new streams may also appear in av_read_frame().
- muxing: streams are created by the user before avformat_write_header().

Freed by libavformat in avformat_free_context().

Examples
  decode_filter_audio.c, decode_filter_video.c, demux_decode.c, extract_mvs.c, hw_decode.c, mux.c, qsv_decode.c, qsv_transcode.c, remux.c, transcode.c, and vaapi_transcode.c.

Definition at line 1355 of file avformat.h.

Referenced by encode_write(), encode_write(), encode_write_frame(), init_filters(), init_filters(), init_filters(), log_packet(), log_packet(), main(), main(), open_codec_context(), open_codec_context(), open_input_file(), open_input_file(), open_input_file(), open_input_file(), open_input_file(), and open_output_file().

## nb_stream_groups

unsigned int AVFormatContext::nb_stream_groups

Number of elements in AVFormatContext.stream_groups.

Set by avformat_stream_group_create(), must not be modified by any other code.

Definition at line 1362 of file avformat.h.

## stream_groups

AVStreamGroup** AVFormatContext::stream_groups

A list of all stream groups in the file.

New groups are created with avformat_stream_group_create(), and filled with avformat_stream_group_add_stream().

- demuxing: groups may be created by libavformat in avformat_open_input(). If AVFMTCTX_NOHEADER is set in ctx_flags, then new groups may also appear in av_read_frame().
- muxing: groups may be created by the user before avformat_write_header().

Freed by libavformat in avformat_free_context().

Definition at line 1374 of file avformat.h.

## nb_chapters

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.

- muxing: set by user
- demuxing: set by libavformat

Definition at line 1387 of file avformat.h.

## chapters

AVChapter** AVFormatContext::chapters

Definition at line 1388 of file avformat.h.

## url

char* AVFormatContext::url

input or output URL.

Unlike the old filename field, this field has no length restriction.

- demuxing: set by avformat_open_input(), initialized to an empty string if url parameter was NULL in avformat_open_input().
- muxing: may be set by the caller before calling avformat_write_header() (or avformat_init_output() if that is called first) to a string which is freeable by av_free(). Set to an empty string if it was NULL in avformat_init_output().

Freed by libavformat in avformat_free_context().

Definition at line 1403 of file avformat.h.

## start_time

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 1412 of file avformat.h.

## duration

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 1422 of file avformat.h.

## bit_rate

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 1429 of file avformat.h.

## packet_size

unsigned int AVFormatContext::packet_size

Definition at line 1431 of file avformat.h.

## max_delay

int AVFormatContext::max_delay

Definition at line 1432 of file avformat.h.

## flags

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 1438 of file avformat.h.

## probesize

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().

Note
  this is not used for determining the input format

See also
  format_probesize

Definition at line 1474 of file avformat.h.

## max_analyze_duration

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 1482 of file avformat.h.

## key

const uint8_t* AVFormatContext::key

Definition at line 1484 of file avformat.h.

## keylen

int AVFormatContext::keylen

Definition at line 1485 of file avformat.h.

## nb_programs

unsigned int AVFormatContext::nb_programs

Definition at line 1487 of file avformat.h.

## programs

AVProgram** AVFormatContext::programs

Definition at line 1488 of file avformat.h.

## video_codec_id

enum AVCodecID AVFormatContext::video_codec_id

Forced video codec_id.

Demuxing: Set by user.

Definition at line 1494 of file avformat.h.

## audio_codec_id

enum AVCodecID AVFormatContext::audio_codec_id

Forced audio codec_id.

Demuxing: Set by user.

Definition at line 1500 of file avformat.h.

## subtitle_codec_id

enum AVCodecID AVFormatContext::subtitle_codec_id

Forced subtitle codec_id.

Demuxing: Set by user.

Definition at line 1506 of file avformat.h.

## data_codec_id

enum AVCodecID AVFormatContext::data_codec_id

Forced Data codec_id.

Demuxing: Set by user.

Definition at line 1512 of file avformat.h.

## metadata

AVDictionary* AVFormatContext::metadata

Metadata that applies to the whole file.

- demuxing: set by libavformat in avformat_open_input()
- muxing: may be set by the caller before avformat_write_header()

Freed by libavformat in avformat_free_context().

Examples
  show_metadata.c.

Definition at line 1522 of file avformat.h.

Referenced by main().

## start_time_realtime

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.

- muxing: Set by the caller before avformat_write_header(). If set to either 0 or AV_NOPTS_VALUE, then the current wall-time will be used.
- demuxing: Set by libavformat. AV_NOPTS_VALUE if unknown. Note that the value may become known after some number of frames have been received.

Definition at line 1535 of file avformat.h.

## fps_probe_size

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 1542 of file avformat.h.

## error_recognition

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 1549 of file avformat.h.

## interrupt_callback

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 1560 of file avformat.h.

## debug

int AVFormatContext::debug

Flags to enable debugging.

Definition at line 1565 of file avformat.h.

## max_streams

int AVFormatContext::max_streams

The maximum number of streams.

- encoding: unused
- decoding: set by user

Definition at line 1573 of file avformat.h.

## max_index_size

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.

- muxing: unused
- demuxing: set by user

Definition at line 1585 of file avformat.h.

## max_picture_buffer

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 1591 of file avformat.h.

## max_interleave_delta

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 1609 of file avformat.h.

## max_ts_probe

int AVFormatContext::max_ts_probe

Maximum number of packets to read while waiting for the first timestamp.

Decoding only.

Definition at line 1615 of file avformat.h.

## max_chunk_duration

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.

- encoding: Set by user
- decoding: unused

Definition at line 1623 of file avformat.h.

## max_chunk_size

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.

- encoding: Set by user
- decoding: unused

Definition at line 1631 of file avformat.h.

## max_probe_packets

int AVFormatContext::max_probe_packets

Maximum number of packets that can be probed.

- encoding: unused
- decoding: set by user

Definition at line 1638 of file avformat.h.

## strict_std_compliance

int AVFormatContext::strict_std_compliance

Allow non-standard and experimental extension.

See also
  AVCodecContext.strict_std_compliance

Definition at line 1644 of file avformat.h.

## event_flags

int AVFormatContext::event_flags

Flags indicating events happening on the file, a combination of AVFMT_EVENT_FLAG_*.

- demuxing: may be set by the demuxer in avformat_open_input(), avformat_find_stream_info() and av_read_frame(). Flags must be cleared by the user once the event has been handled.
- muxing: may be set by the user after avformat_write_header() to indicate a user-triggered event. The muxer will clear the flags for events it has handled in av_[interleaved]_write_frame().

Definition at line 1657 of file avformat.h.

## avoid_negative_ts

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().

- muxing: Set by user
- demuxing: unused

Definition at line 1674 of file avformat.h.

## audio_preload

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.

- encoding: Set by user
- decoding: unused

Definition at line 1686 of file avformat.h.

## use_wallclock_as_timestamps

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.

- encoding: unused
- decoding: Set by user

Definition at line 1694 of file avformat.h.

## skip_estimate_duration_from_pts

int AVFormatContext::skip_estimate_duration_from_pts

Skip duration calcuation in estimate_timings_from_pts.

- encoding: unused
- decoding: set by user

See also
  duration_probesize

Definition at line 1703 of file avformat.h.

## avio_flags

int AVFormatContext::avio_flags

avio flags, used to force AVIO_FLAG_DIRECT.

- encoding: unused
- decoding: Set by user

Definition at line 1710 of file avformat.h.

## duration_estimation_method

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.

- encoding: unused
- decoding: Read by user

Definition at line 1718 of file avformat.h.

## skip_initial_bytes

int64_t AVFormatContext::skip_initial_bytes

Skip initial bytes when opening stream.

- encoding: unused
- decoding: Set by user

Definition at line 1725 of file avformat.h.

## correct_ts_overflow

unsigned int AVFormatContext::correct_ts_overflow

Correct single timestamp overflows.

- encoding: unused
- decoding: Set by user

Definition at line 1732 of file avformat.h.

## seek2any

int AVFormatContext::seek2any

Force seeking to any (also non key) frames.

- encoding: unused
- decoding: Set by user

Definition at line 1739 of file avformat.h.

## flush_packets

int AVFormatContext::flush_packets

Flush the I/O context after each packet.

- encoding: Set by user
- decoding: unused

Definition at line 1746 of file avformat.h.

## probe_score

int AVFormatContext::probe_score

format probing score.

The maximal score is AVPROBE_SCORE_MAX, its set when the demuxer probes the format.

- encoding: unused
- decoding: set by avformat, read by user

Definition at line 1755 of file avformat.h.

## format_probesize

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().

See also
  probesize

Definition at line 1766 of file avformat.h.

## codec_whitelist

char* AVFormatContext::codec_whitelist

',' separated list of allowed decoders.

If NULL then all are allowed

- encoding: unused
- decoding: set by user

Definition at line 1774 of file avformat.h.

## format_whitelist

char* AVFormatContext::format_whitelist

',' separated list of allowed demuxers.

If NULL then all are allowed

- encoding: unused
- decoding: set by user

Definition at line 1782 of file avformat.h.

## protocol_whitelist

char* AVFormatContext::protocol_whitelist

',' separated list of allowed protocols.

- encoding: unused
- decoding: set by user

Definition at line 1789 of file avformat.h.

## protocol_blacklist

char* AVFormatContext::protocol_blacklist

',' separated list of disallowed protocols.

- encoding: unused
- decoding: set by user

Definition at line 1796 of file avformat.h.

## io_repositioned

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 1804 of file avformat.h.

## video_codec

const struct 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 1812 of file avformat.h.

## audio_codec

const struct 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 1820 of file avformat.h.

## subtitle_codec

const struct 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 1828 of file avformat.h.

## data_codec

const struct 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 1836 of file avformat.h.

## metadata_header_padding

int AVFormatContext::metadata_header_padding

Number of bytes to be written as padding in a metadata header.

Demuxing: Unused. Muxing: Set by user.

Definition at line 1843 of file avformat.h.

## opaque

void* AVFormatContext::opaque

User data.

This is a place for some private data of the user.

Definition at line 1849 of file avformat.h.

## control_message_cb

av_format_control_message AVFormatContext::control_message_cb

Callback used by devices to communicate with application.

Definition at line 1854 of file avformat.h.

## output_ts_offset

int64_t AVFormatContext::output_ts_offset

Output timestamp offset, in microseconds.

Muxing: set by user

Definition at line 1860 of file avformat.h.

## dump_separator

uint8_t* AVFormatContext::dump_separator

dump format separator.

can be ", " or "\n " or anything else

- muxing: Set by user.
- demuxing: Set by user.

Definition at line 1868 of file avformat.h.

## io_open

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.

Parameters

  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()

Returns
  0 on success, a negative AVERROR code on failure

Note
  Certain muxers and demuxers do nesting, i.e. they open one or more additional internal format contexts. Thus the AVFormatContext pointer passed to this callback may be different from the one facing the caller. It will, however, have the same 'opaque' field.

Definition at line 1890 of file avformat.h.

## io_close2

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.

Parameters

  s | the format context
  pb | IO context to be closed and freed

Returns
  0 on success, a negative AVERROR code on failure

Definition at line 1904 of file avformat.h.

## duration_probesize

int64_t AVFormatContext::duration_probesize

Maximum number of bytes read from input in order to determine stream durations when using estimate_timings_from_pts 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.

See also
  skip_estimate_duration_from_pts

Definition at line 1914 of file avformat.h.

The documentation for this struct was generated from the following file:

- libavformat/avformat.h