博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
FFmpeg结构体彻底分析——AVCodec
阅读量:5873 次
发布时间:2019-06-19

本文共 3996 字,大约阅读时间需要 13 分钟。

hot3.png

/**

 * AVCodec.一个AVCodec结构体对应一个编解码器,这个结构体表示编解码器本身
 */
typedef struct AVCodec {
    /**
     * Name of the codec implementation.    编解码实现的名字
     * The name is globally unique among encoders and among decoders (but an
     * encoder and a decoder can share the same name).
     * This is the primary way to find a codec from the user perspective.
     */
    const char *name; //编解码器实现的名字,这个名字全局唯一(但是编解码器可以共用一个名字),从用户方面去找编解码器的主要方式
    /**
     * Descriptive name for the codec, meant to be more human readable than name.
     * You should use the NULL_IF_CONFIG_SMALL() macro to define it.
     */
    const char *long_name;//更接近人类可阅读的编解码器的描述名字,要使用NULL_IF_CONFIG_SMALL()这个宏定义来定义它

    enum AVMediaType type;//媒体类型

    enum AVCodecID id;//编解码器的ID
    /**
     * Codec capabilities.
     * see CODEC_CAP_*
     */
    int capabilities;
    const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0}

supported_framerates支持的帧率的数组,NULL表示任何的都支持,数组由{0,0}结束

    const enum AVPixelFormat *pix_fmts;     ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1

pix_fmts支持的像素格式的数组,NULL表示未知,数组由-1结束

    const int *supported_samplerates;       ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0

supported_samples支持的声音采样频率的数组,NULL表示未知,数组由0结束

    const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1

sample_fmts支持的声音采样格式的数组,NULL表示未知,数组由-1结束

    const uint64_t *channel_layouts;         ///< array of support channel layouts, or NULL if unknown. array is terminated by 0

支持的声音的通道数,NULL表示未知,由0结束

#if FF_API_LOWRES
    uint8_t max_lowres;                     ///< maximum value for lowres supported by the decoder, no direct access, use av_codec_get_max_lowres()
#endif
    const AVClass *priv_class;              ///< AVClass for the private context
    const AVProfile *profiles;              ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}


    /*****************************************************************

     * No fields below this line are part of the public API. They
     * may not be used outside of libavcodec and can be changed and
     * removed at will.
     * New public fields should be added right above.
     *****************************************************************
     */
    int priv_data_size;
    struct AVCodec *next;
    /**
     *  Frame-level threading support functions
     * @{
     */
    /**
     * If defined, called on thread contexts when they are created.
     * If the codec allocates writable tables in init(), re-allocate them here.
     * priv_data will be set to a copy of the original.
     */
    int (*init_thread_copy)(AVCodecContext *);
    /**
     * Copy necessary context variables from a previous thread context to the current one.
     * If not defined, the next thread will start automatically; otherwise, the codec
     * must call ff_thread_finish_setup().
     *
     * dst and src will (rarely) point to the same context, in which case memcpy should be skipped.
     */
    int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src);
    /** @} */

    /**

     * Private codec-specific defaults.
     */
    const AVCodecDefault *defaults;

    /**

     * Initialize codec static data, called from avcodec_register().
     */
    void (*init_static_data)(struct AVCodec *codec);

    int (*init)(AVCodecContext *);

    int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size,
                      const struct AVSubtitle *sub);
    /**
     * Encode data to an AVPacket.
     *
     * @param      avctx          codec context
     * @param      avpkt          output AVPacket (may contain a user-provided buffer)
     * @param[in]  frame          AVFrame containing the raw data to be encoded
     * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a
     *                            non-empty packet was returned in avpkt.
     * @return 0 on success, negative error code on failure
     */
    int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame,
                   int *got_packet_ptr);
    int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt);
    int (*close)(AVCodecContext *);
    /**
     * Flush buffers.
     * Will be called when seeking
     */
    void (*flush)(AVCodecContext *);
} AVCodec;

转载于:https://my.oschina.net/u/1024767/blog/357027

你可能感兴趣的文章
同步、异步、阻塞、非阻塞 简析
查看>>
PYthon常用模块 logging 日志
查看>>
BZOJ1257:[CQOI2007]余数之和(整除分块)
查看>>
[Android]HttpPost之post请求传递Json数据
查看>>
在View页面,使用@if(){ }输出判断正确的内容
查看>>
js或jquery如何获取父级、子级、兄弟元素(包括祖级、孙级等)
查看>>
软件测试为什么需要学习Linux的知识?Linux学到什么程度?-log5
查看>>
amazon中文文档
查看>>
CodeVs 1017 乘积最大(DP)
查看>>
智能运维基础设施
查看>>
01.LoT.UI 前后台通用框架分解系列之——小图片背景全屏显示(可自动切换背景)...
查看>>
[BZOJ] 3301: [USACO2011 Feb] Cow Line
查看>>
KNN K近邻算法
查看>>
android post(HTTP设置参数,仿html表单提交)
查看>>
BZOJ1061 [NOI2008]志愿者招募
查看>>
第一次作业:深入源码分析进程模型
查看>>
Pandas 基础(9) - 组合方法 merge
查看>>
初学shell,今天遇到由wget下载到本地的网页源代码的乱码问题,无聊的写了一个转码的脚本...
查看>>
磁盘管理常用命令
查看>>
Algs4-2.3.25切换到插入排序的试验
查看>>