Loading...
Searching...
No Matches
AVStream Struct Reference

Stream structure. More...

`#include <libavformat/avformat.h>`

## Data Fields

const AVClass * | av_class
| A class for AVOptions.
int | index
| stream index in AVFormatContext
int | id
| Format-specific stream ID.
AVCodecParameters * | codecpar
| Codec parameters associated with this stream.
void * | priv_data
AVRational | time_base
| This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
int64_t | start_time
| Decoding: pts of the first frame of the stream in presentation order, in stream time base.
int64_t | duration
| Decoding: duration of the stream, in stream time base.
int64_t | nb_frames
| number of frames in this stream if known or 0
int | disposition
| Stream disposition - a combination of AV_DISPOSITION_* flags.
enum AVDiscard | discard
| Selects which packets can be discarded at will and do not need to be demuxed.
AVRational | sample_aspect_ratio
| sample aspect ratio (0 if unknown)
AVDictionary * | metadata
AVRational | avg_frame_rate
| Average framerate.
AVPacket | attached_pic
| For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet will contain the attached picture.
int | event_flags
| Flags indicating events happening on the stream, a combination of AVSTREAM_EVENT_FLAG_*.
AVRational | r_frame_rate
| Real base framerate of the stream.
int | pts_wrap_bits
| Number of bits in timestamps.

## Detailed Description

Stream structure.

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(AVStream) must not be used outside libav*.

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

Definition at line 744 of file avformat.h.

## Field Documentation

## av_class

const AVClass* AVStream::av_class

A class for AVOptions.

Set on stream creation.

Definition at line 748 of file avformat.h.

## index

int AVStream::index

stream index in AVFormatContext

Examples
  mux.c, and qsv_decode.c.

Definition at line 750 of file avformat.h.

Referenced by main(), and write_frame().

## id

int AVStream::id

Format-specific stream ID.

decoding: set by libavformat encoding: set by the user, replaced by libavformat if left unset

Definition at line 756 of file avformat.h.

## codecpar

AVCodecParameters* AVStream::codecpar

Codec parameters associated with this stream.

Allocated and freed by libavformat in avformat_new_stream() and avformat_free_context() respectively.

- demuxing: filled by libavformat on stream creation or in avformat_find_stream_info()
- muxing: filled by the caller before avformat_write_header()

Examples
  demux_decode.c, extract_mvs.c, hw_decode.c, qsv_decode.c, qsv_transcode.c, remux.c, transcode.c, transcode_aac.c, and vaapi_transcode.c.

Definition at line 767 of file avformat.h.

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

## priv_data

void* AVStream::priv_data

Definition at line 769 of file avformat.h.

## time_base

AVRational AVStream::time_base

This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.

decoding: set by libavformat encoding: May be set by the caller before avformat_write_header() to provide a hint to the muxer about the desired timebase. In avformat_write_header(), the muxer will overwrite this field with the timebase that will actually be used for the timestamps written into the file (which may or may not be related to the user-provided one, depending on the format).

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

Definition at line 783 of file avformat.h.

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

## start_time

int64_t AVStream::start_time

Decoding: pts of the first frame of the stream in presentation order, in stream time base.

Only set this if you are absolutely 100% sure that the value you set it to really is the pts of the first frame. This may be undefined (AV_NOPTS_VALUE).

Note
  The ASF header does NOT contain a correct start_time the ASF demuxer must NOT set this.

Definition at line 793 of file avformat.h.

## duration

int64_t AVStream::duration

Decoding: duration of the stream, in stream time base.

If a source file does not specify a duration, but does specify a bitrate, this value will be estimated from bitrate and file size.

Encoding: May be set by the caller before avformat_write_header() to provide a hint to the muxer about the estimated duration.

Definition at line 803 of file avformat.h.

## nb_frames

int64_t AVStream::nb_frames

number of frames in this stream if known or 0

Definition at line 805 of file avformat.h.

## disposition

int AVStream::disposition

Stream disposition - a combination of AV_DISPOSITION_* flags.

- demuxing: set by libavformat when creating the stream or in avformat_find_stream_info().
- muxing: may be set by the caller before avformat_write_header().

Definition at line 813 of file avformat.h.

## discard

enum AVDiscard AVStream::discard

Selects which packets can be discarded at will and do not need to be demuxed.

Examples
  qsv_decode.c.

Definition at line 815 of file avformat.h.

Referenced by main().

## sample_aspect_ratio

AVRational AVStream::sample_aspect_ratio

sample aspect ratio (0 if unknown)

- encoding: Set by user.
- decoding: Set by libavformat.

Definition at line 822 of file avformat.h.

## metadata

AVDictionary* AVStream::metadata

Definition at line 824 of file avformat.h.

## avg_frame_rate

AVRational AVStream::avg_frame_rate

Average framerate.

- demuxing: May be set by libavformat when creating the stream or in avformat_find_stream_info().
- muxing: May be set by the caller before avformat_write_header().

Definition at line 833 of file avformat.h.

## attached_pic

AVPacket AVStream::attached_pic

For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet will contain the attached picture.

decoding: set by libavformat, must not be modified by the caller. encoding: unused

Definition at line 842 of file avformat.h.

## event_flags

int AVStream::event_flags

Flags indicating events happening on the stream, a combination of AVSTREAM_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 855 of file avformat.h.

## r_frame_rate

AVRational AVStream::r_frame_rate

Real base framerate of the stream.

This is the lowest framerate with which all timestamps can be represented accurately (it is the least common multiple of all framerates in the stream). Note, this value is just a guess! For example, if the time base is 1/90000 and all frames have either approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1.

Definition at line 878 of file avformat.h.

## pts_wrap_bits

int AVStream::pts_wrap_bits

Number of bits in timestamps.

Used for wrapping control.

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

Definition at line 887 of file avformat.h.

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

- libavformat/avformat.h