```
/**
* 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*.
*/
typedef struct AVStream {
//AVFormatContext流索引
int index; /**< stream index in AVFormatContext */
//流id
int id;
#if FF_API_LAVF_AVCTX
attribute_deprecated
//过时,使用codecpar结构体
AVCodecContext *codec;
#endif
//私有数据
void *priv_data;
//时间基,以秒为单位
AVRational time_base;
//按显示图像排序的第一帧的PTS,注意,ASF header不包含正确的start_time,ASF Demuxer不要设置此属性
int64_t start_time;
//流时长
int64_t duration;
//流中 的帧数
int64_t nb_frames; ///< number of frames in this stream if known or 0
int disposition; /**< AV_DISPOSITION_* bit field */
//选择哪个packet可以废弃掉,不需要demux
enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed.
// 采样率
AVRational sample_aspect_ratio;
//元数据
AVDictionary *metadata;
//平均帧率
AVRational avg_frame_rate;
//对于有AV_DISPOSITION_ATTACHED_PIC的配置,packet将包含附加图像
AVPacket attached_pic;
//整个流的side data
AVPacketSideData *side_data;
// side data的个数
int nb_side_data;
//检测流时的标示
int event_flags;
#define AVSTREAM_EVENT_FLAG_METADATA_UPDATED 0x0001 ///< The call resulted in updated metadata.
//帧率
AVRational r_frame_rate;
#if FF_API_LAVF_FFSERVER
attribute_deprecated
char *recommended_encoder_configuration;
#endif
//Codec参数,通过avformat_new_stream分配,通过avformat_free_context释放
AVCodecParameters *codecpar;
//**************************下面都是非公共字段**************************************\
#define MAX_STD_TIMEBASES (30*12+30+3+6)
/**
* Stream information used internally by avformat_find_stream_info()
*/
struct {
int64_t last_dts;
int64_t duration_gcd;
int duration_count;
int64_t rfps_duration_sum;
double (*duration_error)[2][MAX_STD_TIMEBASES];
int64_t codec_info_duration;
int64_t codec_info_duration_fields;
int frame_delay_evidence;
/**
* 0 -> decoder has not been searched for yet.
* >0 -> decoder found
* <0 -> decoder with codec_id == -found_decoder has not been found
*/
//大于0,表示找到,否则未找到
int found_decoder;
int64_t last_duration;
/**
* Those are used for average framerate estimation.
*/
int64_t fps_first_dts;
int fps_first_dts_idx;
int64_t fps_last_dts;
int fps_last_dts_idx;
} *info;
//用于装饰控制时表示PTS数目
int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */
//第一个DTS
int64_t first_dts;
//当前的DTS
int64_t cur_dts;
int64_t last_IP_pts;
int last_IP_duration;
//codec探测出Buffer的packet数
int probe_packets;
//解复用后的帧数
int codec_info_nb_frames;
/* av_read_frame() support */
enum AVStreamParseType need_parsing;
struct AVCodecParserContext *parser;
/**
* last packet in packet_buffer for this stream when muxing.
*/
struct AVPacketList *last_in_packet_buffer;
AVProbeData probe_data;
#define MAX_REORDER_DELAY 16
int64_t pts_buffer[MAX_REORDER_DELAY+1];
AVIndexEntry *index_entries; /**< Only used if the format does not
support seeking natively. */
int nb_index_entries;
unsigned int index_entries_allocated_size;
//stream识别,0表示未知
int stream_identifier;
int64_t interleaver_chunk_size;
int64_t interleaver_chunk_duration;
//stream探测状态,-1表示探测完成,0表示没有探测请求
int request_probe;
//跳过下一个关键帧
int skip_to_keyframe;
//帧开始时,下一个Packet中解码的样本数
int skip_samples;
int64_t start_skip_samples;
//第一个废弃的采样
int64_t first_discard_sample;
//上次废弃的采样,避免EOF
int64_t last_discard_sample;
//解码后的帧数
int nb_decoded_frames;
//在muxing时,给时间戳添加偏移量
int64_t mux_ts_offset;
//检查时间戳的包装
int64_t pts_wrap_reference;
//PTS的拓展行为
int pts_wrap_behavior;
//避免更新初始化时间两次
int update_initial_durations_done;
//pts生成dts
int64_t pts_reorder_error[MAX_REORDER_DELAY+1];
uint8_t pts_reorder_error_count[MAX_REORDER_DELAY+1];
int64_t last_dts_for_order_check;
uint8_t dts_ordered;
uint8_t dts_misordered;
//内部数据注入全局side data
int inject_global_side_data;
//显示率
AVRational display_aspect_ratio;
//libavformat内部使用的成员
AVStreamInternal *internal;
} AVStream;
```