一个真正快乐的人,是能够享受他的创造的人。那些像海绵一样,只取不予的人,只会失去快乐。
AVInputFormat结构体用来表示输入文件容器格式,着重于功能函数,一个文件容器格式对应着一个AVInputFormat结构。
通过以下两种方式进行设置:
- 当通过avformat_open_input函数设置时,需要对filename的值进行探测
- 如果上一步骤探测失败,则会对filename指定的文件或协议进行探测
- 也可以通过av_find_input_format函数获取
输入文件容器格式举例如下:
AVInputFormat ff_aac_demuxer = {
.name = "aac",
.long_name = NULL_IF_CONFIG_SMALL("raw ADTS AAC (Advanced Audio Coding)"),
.read_probe = adts_aac_probe,
.read_header = adts_aac_read_header,
.read_packet = adts_aac_read_packet,
.flags = AVFMT_GENERIC_INDEX,
.extensions = "aac",
.mime_type = "audio/aac,audio/aacp,audio/x-aac",
.raw_codec_id = AV_CODEC_ID_AAC,
};
1.name
/** * A comma separated list of short names for the format. New names * may be appended with a minor bump. */ const char *name;
通过逗号分隔的格式名列表,例如aac。
2.long_name
/** * Descriptive name for the format, meant to be more human-readable * than name. You should use the NULL_IF_CONFIG_SMALL() macro * to define it. */ const char *long_name;
3.flags
/** * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS, * AVFMT_NOTIMESTAMPS, AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH, * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK, AVFMT_SEEK_TO_PTS. */ int flags;
4.extensions
/** * If extensions are defined, then no probe is done. You should * usually not use extension format guessing because it is not * reliable enough */ const char *extensions;
如果定义了扩展,则不执行任何探测。通常不应该使用扩展格式猜测,因为它不是足够可靠。
5.codec_tag
const struct AVCodecTag * const *codec_tag;
6.priv_class
const AVClass *priv_class; ///< AVClass for the private context
7.mine_type
/** * Comma-separated list of mime types. * It is used check for matching mime types while probing. * @see av_probe_input_format2 */ const char *mime_type;
8.next
/***************************************************************** * No fields below this line are part of the public API. They * may not be used outside of libavformat and can be changed and * removed at will. * New public fields should be added right above. ***************************************************************** */ #if FF_API_NEXT ff_const59 struct AVInputFormat *next; #endif
9.raw_codec_id
/** * Raw demuxers store their codec ID here. */ int raw_codec_id;
10.priv_data_size
/** * Size of private data so that it can be allocated in the wrapper. */ int priv_data_size;