本文主要是介绍FFmpeg的HEVC解码器源代码学习笔记-3,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
简介:
使用FFmpeg对HEVC码流进行解码时,所采用的各种结构体的介绍:
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; //编解码器的描述性名称,比名称更易于理解。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 -1const int *supported_samplerates; ///音频相关,为音频的采样频率< array of supported audio samplerates, or NULL if unknown, array is terminated by 0const 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_deprecatedconst uint64_t *channel_layouts; ///音频相关,支持的音频通道布局< array of support channel layouts, or NULL if unknown. array is terminated by 0
#endifconst AVClass *priv_class; ///指向特定解码器的上下文环境< AVClass for the private contextconst 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
这篇关于FFmpeg的HEVC解码器源代码学习笔记-3的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!