FFmpeg源码分析:AVInputFormat结构体

10 篇文章 0 订阅
9 篇文章 0 订阅

一个真正快乐的人,是能够享受他的创造的人。那些像海绵一样,只取不予的人,只会失去快乐。

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;
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值