FFmpeg的HEVC解码器源代码学习笔记-3

简介:

使用FFmpeg对HEVC码流进行解码时,所采用的各种结构体的介绍:

AVCodec

cpp 复制代码
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; //编解码器的描述性名称,比名称更易于理解。
    enum AVMediaType type; // 媒体类型,例如视频还是音频
    enum AVCodecID id; // 视频编码器的ID
    /**
     * Codec capabilities.
     * see AV_CODEC_CAP_*
     */
    int capabilities; // 
    uint8_t max_lowres;                     ///解码器支持的低分辨率最大值 < maximum value for lowres supported by the decoder 
    const AVRational *supported_framerates; ///支持的帧率,由数组形式表现,其中每个AVRational为{num,den}分别为分子和分母,以此来表示帧率< array of supported framerates, or NULL if any, array is terminated by {0,0}
    const enum AVPixelFormat *pix_fmts;     ///支持的像素格式,由数组形式表示,枚举了每种类型,可以参考libavutil/pixfmt.h里面的枚举定义enum AVPixelFormat{} < array of supported pixel formats, or NULL if unknown, array is terminated by -1
    const int *supported_samplerates;       ///音频相关,为音频的采样频率< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
    const enum AVSampleFormat *sample_fmts; ///音频相关,为音频的采样格式,例如24点位< array of supported sample formats, or NULL if unknown, array is terminated by -1
#if FF_API_OLD_CHANNEL_LAYOUT
    /**
     * @deprecated use ch_layouts instead
     */
    attribute_deprecated
    const uint64_t *channel_layouts;         ///音频相关,支持的音频通道布局< array of support channel layouts, or NULL if unknown. array is terminated by 0
#endif
    const AVClass *priv_class;              ///指向特定解码器的上下文环境< AVClass for the private context
    const AVProfile *profiles;              ///指向当前解码的配置文件类型,例如main,main10等< array of recognized profiles, or NULL if unknown, array is terminated by {AV_PROFILE_UNKNOWN}

    /**
     * Group name of the codec implementation.
     * This is a short symbolic name of the wrapper backing this codec. A
     * wrapper uses some kind of external implementation for the codec, such
     * as an external library, or a codec implementation provided by the OS or
     * the hardware.
     * If this field is NULL, this is a builtin, libavcodec native codec.
     * If non-NULL, this will be the suffix in AVCodec.name in most cases
     * (usually AVCodec.name will be of the form "<codec_name>_<wrapper_name>").
     */
    const char *wrapper_name;

    /**
     * Array of supported channel layouts, terminated with a zeroed layout.
     */
    const AVChannelLayout *ch_layouts;
} AVCodec;

为了弄清楚这个结构体每个变量的作用,以及在解码过程中的实际值,我将HEVC解码过程中的codec变量打印出来,里面每个变量如下:

codec->priv_class

codec->profiles

AVCodecParserContext定义的变量parser

AVCodeContext定义的变量C如下:

AVFrame frame

相关推荐
我命由我1234515 分钟前
开发中的英语积累 P19:Inspect、Hint、Feedback、Direction、Compact、Vulnerability
经验分享·笔记·学习·职场和发展·求职招聘·职场发展·学习方法
fqbqrr23 分钟前
2512C++,clangd支持模块
开发语言·c++
老王熬夜敲代码2 小时前
C++中的thread
c++·笔记·面试
qq_12498707532 小时前
基于SpringBoot学生学习历史的选课推荐系统的设计与实现(源码+论文+部署+安装)
java·spring boot·后端·学习·毕业设计·毕设
qq_479875432 小时前
C++ 鸭子类型” (Duck Typing)
开发语言·c++
崇山峻岭之间2 小时前
C++ Prime Plus 学习笔记033
c++·笔记·学习
暗然而日章2 小时前
C++基础:Stanford CS106L学习笔记 7 类
c++·笔记·学习
思成不止于此3 小时前
【MySQL 零基础入门】DDL 核心语法全解析:数据库与表结构操作篇
数据库·笔记·学习·mysql
学编程的闹钟3 小时前
86【CSS的模块化处理】
学习
lkbhua莱克瓦243 小时前
Java进阶——IO流
java·开发语言·笔记·学习方法·io流