当前位置:网站首页>ffmpeg enumeration decoders, encoders analysis
ffmpeg enumeration decoders, encoders analysis
2022-08-05 03:19:00 【hjjdebug】
ffmpeg 枚举decoders, encoders 分析
$ffmpeg -decoders
调用 print_codecs(0);
$ffmpeg -encoders
调用 print_codecs(1);
$ffmpeg -codecs
调用 show_codecs() Document a list of similarities.
下面对 print_codecs ()进行代码分析.
第一步, 获取所有codecs 描述符
const AVCodecDescriptor **codecs;
unsigned i, nb_codecs = get_codecs_sorted(&codecs);
怎样获取codecs Pointer to the descriptor pointer?
原来codec_descriptors[] is a large array.codec A descriptor is a structure.
static const AVCodecDescriptor codec_descriptors[] = {
/* video codecs */
{
.id = AV_CODEC_ID_MPEG1VIDEO,
.type = AVMEDIA_TYPE_VIDEO,
.name = "mpeg1video",
.long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"),
.props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_REORDER,
},
{
.id = AV_CODEC_ID_MPEG2VIDEO,
.type = AVMEDIA_TYPE_VIDEO,
.name = "mpeg2video",
.long_name = NULL_IF_CONFIG_SMALL("MPEG-2 video"),
.props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_REORDER,
.profiles = NULL_IF_CONFIG_SMALL(ff_mpeg2_video_profiles),
},
{
.id = AV_CODEC_ID_H261,
.type = AVMEDIA_TYPE_VIDEO,
.name = "h261",
.long_name = NULL_IF_CONFIG_SMALL("H.261"),
.props = AV_CODEC_PROP_LOSSY,
},
... //忽略, 很多
};
typedef struct AVCodecDescriptor {
enum AVCodecID id;
enum AVMediaType type;
const char *name;
const char *long_name;
int props;
const char *const *mime_types;
const struct AVProfile *profiles;
} AVCodecDescriptor;
All this function does is organize the descriptor pointers into an array. 采用了2Sub-scanning principle,
Got the number the first time, Then pointer memory is allocated,The second pass fills in the addresses.
第二步,由id可以获得对应的codec指针.
codec Lists also define a large array.
static const AVCodec * const codec_list[] = {
&ff_a64multi_encoder,
&ff_a64multi5_encoder,
&ff_alias_pix_encoder,
&ff_amv_encoder,
&ff_apng_encoder,
&ff_asv1_encoder,
&ff_asv2_encoder,
&ff_avrp_encoder,
.... // 很多,180个encoder, 480个decoder
}
每种codec 是一种对象,其对应的类为:
type = const struct AVCodec {
const char *name;
const char *long_name;
enum AVMediaType type;
enum AVCodecID id;
int capabilities;
const AVRational *supported_framerates;
const enum AVPixelFormat *pix_fmts;
const int *supported_samplerates;
const enum AVSampleFormat *sample_fmts;
const uint64_t *channel_layouts;
uint8_t max_lowres;
const AVClass *priv_class;
const AVProfile *profiles;
const char *wrapper_name;
int priv_data_size;
struct AVCodec *next;
int (*update_thread_context)(struct AVCodecContext *, const struct AVCodecContext *);
const AVCodecDefault *defaults;
void (*init_static_data)(struct AVCodec *);
int (*init)(struct AVCodecContext *);
int (*encode_sub)(struct AVCodecContext *, uint8_t *, int, const struct AVSubtitle *);
int (*encode2)(struct AVCodecContext *, struct AVPacket *, const struct AVFrame *, int *);
int (*decode)(struct AVCodecContext *, void *, int *, struct AVPacket *);
int (*close)(struct AVCodecContext *);
int (*receive_packet)(struct AVCodecContext *, struct AVPacket *);
int (*receive_frame)(struct AVCodecContext *, struct AVFrame *);
void (*flush)(struct AVCodecContext *);
int caps_internal;
const char *bsfs;
const struct AVCodecHWConfigInternal * const *hw_configs;
const uint32_t *codec_tags;
}
when you implement onecodec 时,It may be enough to implement the required few functional interfaces.
列出codec 列表,Also just enumerate eachcodec,Its capabilities are printed,名称,long name only.
found after analysis,概念比较简单,It's just a data organization.
边栏推荐
- 【Daily Training】1403. Minimum Subsequence in Non-Increasing Order
- Use @Mapper to query the partition status of oracle and report an error
- 北斗三号短报文终端露天矿山高边坡监测方案
- QT MV\MVC structure
- J9 Digital Currency: What is the creator economy of web3?
- 沃谈小知识 |“远程透传”那点事儿
- Review 51 MCU
- Beidou no. 3 short message terminal high slope in open-pit mine monitoring programme
- sql怎么找字段里所有数据为空的字段
- After the large pixel panorama is completed, what are the promotion methods?
猜你喜欢

ASP.NET应用程序--Hello World

2022 High-level installation, maintenance, and removal of exam questions mock exam question bank and online mock exam

开发Hololens遇到The type or namespace name ‘HandMeshVertex‘ could not be found..

.NET Application -- Helloworld (C#)

Use SuperMap iDesktopX data migration tool to migrate map documents and symbols

大像素全景制作完成后,推广方式有哪些?

shell脚本:for循环与while循环

Why did they choose to fall in love with AI?

Simple description of linked list and simple implementation of code

Question about #sql shell#, how to solve it?
随机推荐
运维监控系统之Open-Falcon
burp安装及代理设置
A small tool to transfer files using QR code - QFileTrans 1.2.0.1
Data storage practice based on left-order traversal
百日刷题计划 ———— DAY2
sql server installation prompts that the username does not exist
leetcode - a subtree of another tree
Beidou no. 3 short message terminal high slope in open-pit mine monitoring programme
High Item 02 Information System Project Management Fundamentals
Open Source License Description LGPL
【 genius_platform software platform development 】 : seventy-six vs the preprocessor definitions written cow force!!!!!!!!!!(in the other groups conding personnel told so cow force configuration to can
Question about #sql shell#, how to solve it?
word column notes
From "useable" to "easy to use", domestic software is self-controllable and continues to advance
Syntax basics (variables, input and output, expressions and sequential statement completion)
北斗三号短报文终端露天矿山高边坡监测方案
Details such as compiling pretreatment
使用二维码传输文件的小工具 - QFileTrans 1.2.0.1
Review 51 MCU
You may use special comments to disable some warnings. 报错解决的三种方式