【转】ffmpeg分析三重要结构体之AVFormatContext
标签:
ffmpegavformatcontext |
分类: 多媒体/FFMPEG/协议 |
结构体AVFormatContext位于文件libavformat/avformat.h中。是有关文件格式的结构体。
[cpp] view plain copy
-
typedef
struct AVFormatContext { -
-
const AVClass *av_class; -
-
-
struct AVInputFormat *iformat; -
-
-
struct AVOutputFormat *oformat; -
-
-
void *priv_data; -
-
-
AVIOContext *pb; -
-
-
-
int ctx_flags; -
-
-
unsigned int nb_streams; -
-
AVStream **streams; -
-
-
char filename[1024]; -
-
-
int64_t start_time; -
-
-
int64_t duration; -
-
-
int64_t bit_rate; -
-
unsigned int packet_size; -
int max_delay; -
-
-
int flags; -
#define
AVFMT_FLAG_GENPTS 0x0001 ///< Generate missing pts even if it requires parsing future frames. -
#define
AVFMT_FLAG_IGNIDX 0x0002 ///< Ignore index. -
#define
AVFMT_FLAG_NONBLOCK 0x0004 ///< Do not block when reading packets from input. -
#define
AVFMT_FLAG_IGNDTS 0x0008 ///< Ignore DTS on frames that contain both DTS & PTS -
#define
AVFMT_FLAG_NOFILLIN 0x0010 ///< Do not infer any values from other values, just return what is stored in the container -
#define
AVFMT_FLAG_NOPARSE 0x0020 ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the fillin code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled -
#define
AVFMT_FLAG_NOBUFFER 0x0040 ///< Do not buffer frames when possible -
#define
AVFMT_FLAG_CUSTOM_IO 0x0080 ///< The caller has supplied a custom AVIOContext, don't avio_close() it. -
#define
AVFMT_FLAG_DISCARD_CORRUPT 0x0100 ///< Discard frames marked corrupted -
#define
AVFMT_FLAG_FLUSH_PACKETS 0x0200 ///< Flush the AVIOContext every packet. -
-
#define
AVFMT_FLAG_BITEXACT 0x0400 -
#define
AVFMT_FLAG_MP4A_LATM 0x8000 ///< Enable RTP MP4A-LATM payload -
#define
AVFMT_FLAG_SORT_DTS 0x10000 ///< try to interleave outputted packets by dts (using this flag can slow demuxing down) -
#define
AVFMT_FLAG_PRIV_OPT 0x20000 ///< Enable use of private options by delaying codec open (this could be made default once all code is converted) -
#define
AVFMT_FLAG_KEEP_SIDE_DATA 0x40000 ///< Don't merge side data but keep it separate. -
#define
AVFMT_FLAG_FAST_SEEK 0x80000 ///< Enable fast, but inaccurate seeks for some formats -
-
-
int64_t probesize; -
-
-
int64_t max_analyze_duration; -
-
const uint8_t *key; -
int keylen; -
-
unsigned int nb_programs; -
AVProgram **programs; -
-
-
enum AVCodecID video_codec_id; -
-
-
enum AVCodecID audio_codec_id; -
-
-
enum AVCodecID subtitle_codec_id; -
-
-
unsigned int max_index_size; -
-
-
unsigned int max_picture_buffer; -
-
-
unsigned int nb_chapters; -
AVChapter **chapters; -
-
-
AVDictionary *metadata; -
-
-
int64_t start_time_realtime; -
-
-
int fps_probe_size; -
-
-
int error_recognition; -
-
-
AVIOInterruptCB interrupt_callback; -
-
-
int debug; -
#define
FF_FDEBUG_TS 0x0001 -
-
-
int64_t max_interleave_delta; -
-
-
int strict_std_compliance; -
-
-
int event_flags; -
#define
AVFMT_EVENT_FLAG_METADATA_UPDATED 0x0001 ///< The call resulted in updated metadata. -
-
-
int max_ts_probe; -
-
-
int avoid_negative_ts; -
#define
AVFMT_AVOID_NEG_TS_AUTO -1 ///< Enabled when required by target format -
#define
AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE 1 ///< Shift timestamps so they are non negative -
#define
AVFMT_AVOID_NEG_TS_MAKE_ZERO 2 ///< Shift timestamps so that they start at 0 -
-
-
int ts_id; -
-
-
int audio_preload; -
-
-
int max_chunk_duration; -
-
-
int max_chunk_size; -
-
-
int use_wallclock_as_timestamps; -
-
-
int avio_flags; -
-
-
enum AVDurationEstimationMeth od duration_estimation_method; -
-
-
int64_t skip_initial_bytes; -
-
-
unsigned int correct_ts_overflow; -
-
-
int seek2any; -
-
-
int flush_packets; -
-
-
int probe_score; -
-
-
int format_probesize; -
-
-
char *codec_whitelist; -
-
-
char *format_whitelist; -
-
-
AVFormatInternal *internal; -
-
-
int io_repositioned; -
-
-
AVCodec *video_codec; -
-
-
AVCodec *audio_codec; -
-
-
AVCodec *subtitle_codec; -
-
-
AVCodec *data_codec; -
-
-
int metadata_header_padding; -
-
-
void *opaque; -
-
-
av_format_control_message control_message_cb; -
-
-
int64_t output_ts_offset; -
-
-
uint8_t *dump_separator; -
-
-
enum AVCodecID data_codec_id; -
-
-
int (*open_cb)( structAVFormatContext const*s, AVIOContext **p, char *url, intflags, constAVIOInterruptCB *int_cb, AVDictionary **options); -
}
AVFormatContext;
struct AVInputFormat *iformat:输入文件的格式。解码某mp4文件如图:
可从iformat中得到MP4格式的相关信息。
AVIOContext *pb:IO上下文结构体,这个以后详细介绍。
unsigned int nb_streams:文件中流的数量。(比如值为2,一个音频流,一个视频流)
AVStream **streams:流结构体。以后详细介绍。
char filename[1024]:文件名。
int64_t duration:流的持续时间,单位微秒?
int64_t bit_rate:比特率。单位bps
int64_t probesize:判断文件格式(format)需要读入的文件尺寸
int max_ts_probe:解码TS格式时,在得到第一个PTS前可解码的最大packet的数量。
int ts_id:TS格式中流的pid。

加载中…