Struct rsmpeg::ffi::AVFormatContext[][src]

#[repr(C)]
pub struct AVFormatContext {
Show fields pub av_class: *const AVClass, pub iformat: *mut AVInputFormat, pub oformat: *mut AVOutputFormat, pub priv_data: *mut c_void, pub pb: *mut AVIOContext, pub ctx_flags: i32, pub nb_streams: u32, pub streams: *mut *mut AVStream, pub filename: [i8; 1024], pub url: *mut i8, pub start_time: i64, pub duration: i64, pub bit_rate: i64, pub packet_size: u32, pub max_delay: i32, pub flags: i32, pub probesize: i64, pub max_analyze_duration: i64, pub key: *const u8, pub keylen: i32, pub nb_programs: u32, pub programs: *mut *mut AVProgram, pub video_codec_id: u32, pub audio_codec_id: u32, pub subtitle_codec_id: u32, pub max_index_size: u32, pub max_picture_buffer: u32, pub nb_chapters: u32, pub chapters: *mut *mut AVChapter, pub metadata: *mut AVDictionary, pub start_time_realtime: i64, pub fps_probe_size: i32, pub error_recognition: i32, pub interrupt_callback: AVIOInterruptCB, pub debug: i32, pub max_interleave_delta: i64, pub strict_std_compliance: i32, pub event_flags: i32, pub max_ts_probe: i32, pub avoid_negative_ts: i32, pub ts_id: i32, pub audio_preload: i32, pub max_chunk_duration: i32, pub max_chunk_size: i32, pub use_wallclock_as_timestamps: i32, pub avio_flags: i32, pub duration_estimation_method: u32, pub skip_initial_bytes: i64, pub correct_ts_overflow: u32, pub seek2any: i32, pub flush_packets: i32, pub probe_score: i32, pub format_probesize: i32, pub codec_whitelist: *mut i8, pub format_whitelist: *mut i8, pub internal: *mut AVFormatInternal, pub io_repositioned: i32, pub video_codec: *mut AVCodec, pub audio_codec: *mut AVCodec, pub subtitle_codec: *mut AVCodec, pub data_codec: *mut AVCodec, pub metadata_header_padding: i32, pub opaque: *mut c_void, pub control_message_cb: Option<unsafe extern "C" fn(*mut AVFormatContext, i32, *mut c_void, u32) -> i32>, pub output_ts_offset: i64, pub dump_separator: *mut u8, pub data_codec_id: u32, pub open_cb: Option<unsafe extern "C" fn(*mut AVFormatContext, *mut *mut AVIOContext, *const i8, i32, *const AVIOInterruptCB, *mut *mut AVDictionary) -> i32>, pub protocol_whitelist: *mut i8, pub io_open: Option<unsafe extern "C" fn(*mut AVFormatContext, *mut *mut AVIOContext, *const i8, i32, *mut *mut AVDictionary) -> i32>, pub io_close: Option<unsafe extern "C" fn(*mut AVFormatContext, *mut AVIOContext)>, pub protocol_blacklist: *mut i8, pub max_streams: i32, pub skip_estimate_duration_from_pts: i32, pub max_probe_packets: i32,
}
Expand 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.

Fields

av_class: *const AVClass
Expand description

A class for logging and @ref avoptions. Set by avformat_alloc_context(). Exports (de)muxer private options if they exist.

iformat: *mut AVInputFormat
Expand description

The input container format.

Demuxing only, set by avformat_open_input().

oformat: *mut AVOutputFormat
Expand description

The output container format.

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

priv_data: *mut c_void
Expand description

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()
pb: *mut AVIOContext
Expand description

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.

ctx_flags: i32
Expand description

Flags signalling stream properties. A combination of AVFMTCTX_*. Set by libavformat.

nb_streams: u32
Expand description

Number of elements in AVFormatContext.streams.

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

streams: *mut *mut AVStream
Expand description

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

filename: [i8; 1024]
Expand description

input or output filename

  • demuxing: set by avformat_open_input()
  • muxing: may be set by the caller before avformat_write_header()

@deprecated Use url instead.

url: *mut i8
Expand description

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

start_time: i64
Expand description

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.

duration: i64
Expand description

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.

bit_rate: i64
Expand description

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.

packet_size: u32max_delay: i32flags: i32
Expand description

Flags modifying the (de)muxer behaviour. A combination of AVFMT_FLAG_*. Set by the user before avformat_open_input() / avformat_write_header().

probesize: i64
Expand description

Maximum size of the data read from input for determining the input container format. Demuxing only, set by the caller before avformat_open_input().

max_analyze_duration: i64
Expand description

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.

key: *const u8keylen: i32nb_programs: u32programs: *mut *mut AVProgramvideo_codec_id: u32
Expand description

Forced video codec_id. Demuxing: Set by user.

audio_codec_id: u32
Expand description

Forced audio codec_id. Demuxing: Set by user.

subtitle_codec_id: u32
Expand description

Forced subtitle codec_id. Demuxing: Set by user.

max_index_size: u32
Expand description

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
max_picture_buffer: u32
Expand description

Maximum amount of memory in bytes to use for buffering frames obtained from realtime capture devices.

nb_chapters: u32
Expand description

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
chapters: *mut *mut AVChaptermetadata: *mut AVDictionary
Expand description

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

start_time_realtime: i64
Expand description

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.
fps_probe_size: i32
Expand description

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

error_recognition: i32
Expand description

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

interrupt_callback: AVIOInterruptCB
Expand description

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.

debug: i32
Expand description

Flags to enable debugging.

max_interleave_delta: i64
Expand description

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

strict_std_compliance: i32
Expand description

Allow non-standard and experimental extension @see AVCodecContext.strict_std_compliance

event_flags: i32
Expand description

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().
max_ts_probe: i32
Expand description

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

avoid_negative_ts: i32
Expand description

Avoid negative timestamps during muxing. Any value of the AVFMT_AVOID_NEG_TS_* constants. Note, this only works when using av_interleaved_write_frame. (interleave_packet_per_dts is in use)

  • muxing: Set by user
  • demuxing: unused
ts_id: i32
Expand description

Transport stream id. This will be moved into demuxer private options. Thus no API/ABI compatibility

audio_preload: i32
Expand description

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
max_chunk_duration: i32
Expand description

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
max_chunk_size: i32
Expand description

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
use_wallclock_as_timestamps: i32
Expand description

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
avio_flags: i32
Expand description

avio flags, used to force AVIO_FLAG_DIRECT.

  • encoding: unused
  • decoding: Set by user
duration_estimation_method: u32
Expand description

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
skip_initial_bytes: i64
Expand description

Skip initial bytes when opening stream

  • encoding: unused
  • decoding: Set by user
correct_ts_overflow: u32
Expand description

Correct single timestamp overflows

  • encoding: unused
  • decoding: Set by user
seek2any: i32
Expand description

Force seeking to any (also non key) frames.

  • encoding: unused
  • decoding: Set by user
flush_packets: i32
Expand description

Flush the I/O context after each packet.

  • encoding: Set by user
  • decoding: unused
probe_score: i32
Expand description

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
format_probesize: i32
Expand description

number of bytes to read maximally to identify format.

  • encoding: unused
  • decoding: set by user
codec_whitelist: *mut i8
Expand description

‘,’ separated list of allowed decoders. If NULL then all are allowed

  • encoding: unused
  • decoding: set by user
format_whitelist: *mut i8
Expand description

‘,’ separated list of allowed demuxers. If NULL then all are allowed

  • encoding: unused
  • decoding: set by user
internal: *mut AVFormatInternal
Expand description

An opaque field for libavformat internal usage. Must not be accessed in any way by callers.

io_repositioned: i32
Expand description

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.

video_codec: *mut AVCodec
Expand description

Forced video codec. This allows forcing a specific decoder, even when there are multiple with the same codec_id. Demuxing: Set by user

audio_codec: *mut AVCodec
Expand description

Forced audio codec. This allows forcing a specific decoder, even when there are multiple with the same codec_id. Demuxing: Set by user

subtitle_codec: *mut AVCodec
Expand description

Forced subtitle codec. This allows forcing a specific decoder, even when there are multiple with the same codec_id. Demuxing: Set by user

data_codec: *mut AVCodec
Expand description

Forced data codec. This allows forcing a specific decoder, even when there are multiple with the same codec_id. Demuxing: Set by user

metadata_header_padding: i32
Expand description

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.

opaque: *mut c_void
Expand description

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

control_message_cb: Option<unsafe extern "C" fn(*mut AVFormatContext, i32, *mut c_void, u32) -> i32>
Expand description

Callback used by devices to communicate with application.

output_ts_offset: i64
Expand description

Output timestamp offset, in microseconds. Muxing: set by user

dump_separator: *mut u8
Expand description

dump format separator. can be “, “ or “\n “ or anything else

  • muxing: Set by user.
  • demuxing: Set by user.
data_codec_id: u32
Expand description

Forced Data codec_id. Demuxing: Set by user.

open_cb: Option<unsafe extern "C" fn(*mut AVFormatContext, *mut *mut AVIOContext, *const i8, i32, *const AVIOInterruptCB, *mut *mut AVDictionary) -> i32>
Expand description

Called to open further IO contexts when needed for demuxing.

This can be set by the user application to perform security checks on the URLs before opening them. The function should behave like avio_open2(), AVFormatContext is provided as contextual information and to reach AVFormatContext.opaque.

If NULL then some simple checks are used together with avio_open2().

Must not be accessed directly from outside avformat. @See av_format_set_open_cb()

Demuxing: Set by user.

@deprecated Use io_open and io_close.

protocol_whitelist: *mut i8
Expand description

‘,’ separated list of allowed protocols.

  • encoding: unused
  • decoding: set by user
io_open: Option<unsafe extern "C" fn(*mut AVFormatContext, *mut *mut AVIOContext, *const i8, i32, *mut *mut AVDictionary) -> i32>
Expand description

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.

@param s the format context @param pb on success, the newly opened IO context should be returned here @param url the url to open @param flags a combination of AVIO_FLAG_* @param options a dictionary of additional options, with the same semantics as in avio_open2() @return 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.

io_close: Option<unsafe extern "C" fn(*mut AVFormatContext, *mut AVIOContext)>
Expand description

A callback for closing the streams opened with AVFormatContext.io_open().

protocol_blacklist: *mut i8
Expand description

‘,’ separated list of disallowed protocols.

  • encoding: unused
  • decoding: set by user
max_streams: i32
Expand description

The maximum number of streams.

  • encoding: unused
  • decoding: set by user
skip_estimate_duration_from_pts: i32
Expand description

Skip duration calcuation in estimate_timings_from_pts.

  • encoding: unused
  • decoding: set by user
max_probe_packets: i32
Expand description

Maximum number of packets that can be probed

  • encoding: unused
  • decoding: set by user

Trait Implementations

impl Clone for AVFormatContext[src]

pub fn clone(&self) -> AVFormatContext[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Copy for AVFormatContext[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.