AVStream Struct Reference

Stream structure. More...

#include <avformat.h>

Data Fields

int index
 stream index in AVFormatContext More...
 
int id
 Format-specific stream ID. More...
 
attribute_deprecated AVCodecContextcodec
 
void * priv_data
 
AVRational time_base
 This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented. More...
 
int64_t start_time
 Decoding: pts of the first frame of the stream, in stream time base. More...
 
int64_t duration
 Decoding: duration of the stream, in stream time base. More...
 
int64_t nb_frames
 number of frames in this stream if known or 0 More...
 
int disposition
 AV_DISPOSITION_* bit field. More...
 
enum AVDiscard discard
 Selects which packets can be discarded at will and do not need to be demuxed. More...
 
AVRational sample_aspect_ratio
 sample aspect ratio (0 if unknown) More...
 
AVDictionarymetadata
 
AVRational avg_frame_rate
 Average framerate. More...
 
AVPacket attached_pic
 For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet will contain the attached picture. More...
 
AVPacketSideDataside_data
 An array of side data that applies to the whole stream (i.e. More...
 
int nb_side_data
 The number of elements in the AVStream.side_data array. More...
 
int event_flags
 Flags for the user to detect events happening on the stream. More...
 
AVCodecParameterscodecpar
 
struct {
   int   nb_decoded_frames
 
   int   found_decoder
 
   int64_t   fps_first_dts
 Those are used for average framerate estimation. More...
 
   int   fps_first_dts_idx
 
   int64_t   fps_last_dts
 
   int   fps_last_dts_idx
 
} * info
 
int pts_wrap_bits
 number of bits in pts (used for wrapping control) More...
 
int64_t first_dts
 
int64_t cur_dts
 
int64_t last_IP_pts
 
int last_IP_duration
 
int probe_packets
 
int codec_info_nb_frames
 Number of frames that have been demuxed during av_find_stream_info() More...
 
enum AVStreamParseType need_parsing
 
struct AVCodecParserContextparser
 
struct AVPacketListlast_in_packet_buffer
 last packet in packet_buffer for this stream when muxing. More...
 
AVProbeData probe_data
 
int64_t pts_buffer [MAX_REORDER_DELAY+1]
 
AVIndexEntryindex_entries
 Only used if the format does not support seeking natively. More...
 
int nb_index_entries
 
unsigned int index_entries_allocated_size
 
AVStreamInternalinternal
 An opaque field for libavformat internal usage. More...
 

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:
output.c, and transcode_aac.c.

Definition at line 693 of file avformat.h.

Field Documentation

◆ index

int AVStream::index

stream index in AVFormatContext

Examples:
output.c.

Definition at line 694 of file avformat.h.

Referenced by encode_audio_frame(), and write_video_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 700 of file avformat.h.

◆ codec

Deprecated:
use the codecpar struct instead

Definition at line 706 of file avformat.h.

◆ priv_data

void* AVStream::priv_data

Definition at line 708 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:
output.c, and transcode_aac.c.

Definition at line 722 of file avformat.h.

Referenced by add_audio_stream(), add_video_stream(), encode_audio_frame(), open_output_file(), and write_video_frame().

◆ start_time

int64_t AVStream::start_time

Decoding: pts of the first frame of the stream, 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).

Definition at line 730 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.

Definition at line 737 of file avformat.h.

◆ nb_frames

int64_t AVStream::nb_frames

number of frames in this stream if known or 0

Definition at line 739 of file avformat.h.

◆ disposition

int AVStream::disposition

AV_DISPOSITION_* bit field.

Definition at line 741 of file avformat.h.

◆ discard

enum AVDiscard AVStream::discard

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

Definition at line 743 of file avformat.h.

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

◆ metadata

AVDictionary* AVStream::metadata

Definition at line 752 of file avformat.h.

◆ avg_frame_rate

AVRational AVStream::avg_frame_rate

Average framerate.

Definition at line 761 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 770 of file avformat.h.

◆ side_data

AVPacketSideData* AVStream::side_data

An array of side data that applies to the whole stream (i.e.

the container does not allow it to change between packets).

There may be no overlap between the side data in this array and side data in the packets. I.e. a given side data is either exported by the muxer (demuxing) / set by the caller (muxing) in this array, then it never appears in the packets, or the side data is exported / sent through the packets (always in the first packet where the value becomes known or changes), then it does not appear in this array.

  • demuxing: Set by libavformat when the stream is created.
  • muxing: May be set by the caller before avformat_write_header().

Freed by libavformat in avformat_free_context().

Definition at line 788 of file avformat.h.

◆ nb_side_data

int AVStream::nb_side_data

The number of elements in the AVStream.side_data array.

Definition at line 792 of file avformat.h.

◆ event_flags

int AVStream::event_flags

Flags for the user to detect events happening on the stream.

Flags must be cleared by the user once the event has been handled. A combination of AVSTREAM_EVENT_FLAG_*.

Definition at line 799 of file avformat.h.

◆ codecpar

AVCodecParameters* AVStream::codecpar
Examples:
output.c, and transcode_aac.c.

Definition at line 811 of file avformat.h.

Referenced by open_audio(), open_output_file(), and open_video().

◆ nb_decoded_frames

int AVStream::nb_decoded_frames

Definition at line 826 of file avformat.h.

◆ found_decoder

int AVStream::found_decoder

Definition at line 827 of file avformat.h.

◆ fps_first_dts

int64_t AVStream::fps_first_dts

Those are used for average framerate estimation.

Definition at line 832 of file avformat.h.

◆ fps_first_dts_idx

int AVStream::fps_first_dts_idx

Definition at line 833 of file avformat.h.

◆ fps_last_dts

int64_t AVStream::fps_last_dts

Definition at line 834 of file avformat.h.

◆ fps_last_dts_idx

int AVStream::fps_last_dts_idx

Definition at line 835 of file avformat.h.

◆ info

struct { ... } * AVStream::info

◆ pts_wrap_bits

int AVStream::pts_wrap_bits

number of bits in pts (used for wrapping control)

Definition at line 839 of file avformat.h.

◆ first_dts

int64_t AVStream::first_dts

Definition at line 842 of file avformat.h.

◆ cur_dts

int64_t AVStream::cur_dts

Definition at line 843 of file avformat.h.

◆ last_IP_pts

int64_t AVStream::last_IP_pts

Definition at line 844 of file avformat.h.

◆ last_IP_duration

int AVStream::last_IP_duration

Definition at line 845 of file avformat.h.

◆ probe_packets

int AVStream::probe_packets

Definition at line 851 of file avformat.h.

◆ codec_info_nb_frames

int AVStream::codec_info_nb_frames

Number of frames that have been demuxed during av_find_stream_info()

Definition at line 856 of file avformat.h.

◆ need_parsing

enum AVStreamParseType AVStream::need_parsing

Definition at line 859 of file avformat.h.

◆ parser

struct AVCodecParserContext* AVStream::parser

Definition at line 860 of file avformat.h.

◆ last_in_packet_buffer

struct AVPacketList* AVStream::last_in_packet_buffer

last packet in packet_buffer for this stream when muxing.

Definition at line 865 of file avformat.h.

◆ probe_data

AVProbeData AVStream::probe_data

Definition at line 866 of file avformat.h.

◆ pts_buffer

int64_t AVStream::pts_buffer[MAX_REORDER_DELAY+1]

Definition at line 868 of file avformat.h.

◆ index_entries

AVIndexEntry* AVStream::index_entries

Only used if the format does not support seeking natively.

Definition at line 870 of file avformat.h.

◆ nb_index_entries

int AVStream::nb_index_entries

Definition at line 872 of file avformat.h.

◆ index_entries_allocated_size

unsigned int AVStream::index_entries_allocated_size

Definition at line 873 of file avformat.h.

◆ internal

AVStreamInternal* AVStream::internal

An opaque field for libavformat internal usage.

Must not be accessed in any way by callers.

Definition at line 879 of file avformat.h.


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