当前位置:网站首页>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.
边栏推荐
- 语法基础(变量、输入输出、表达式与顺序语句)
- sql server 安装提示用户名不存在
- 2022了你还不会『低代码』?数据科学也能玩转Low-Code啦!
- Use SuperMap iDesktopX data migration tool to migrate map documents and symbols
- private封装
- From "useable" to "easy to use", domestic software is self-controllable and continues to advance
- Matlab drawing 3
- rpc-remote procedure call demo
- Never put off till tomorrow what you can put - house lease management system based on the SSM
- 开发Hololens遇到The type or namespace name ‘HandMeshVertex‘ could not be found..
猜你喜欢

IJCAI2022 | DictBert: Pre-trained Language Models with Contrastive Learning for Dictionary Description Knowledge Augmentation

Question about #sql shell#, how to solve it?

金仓数据库如何验证安装文件平台正确性
![[Solved] Unity Coroutine coroutine is not executed effectively](/img/ab/035ef004a561fb98d3dd1d7d8b5618.png)
[Solved] Unity Coroutine coroutine is not executed effectively

【已解决】Unity Coroutinue 协程未有效执行的问题

【软件测试】自动化测试之unittest框架

【七夕节】浪漫七夕,代码传情。将爱意变成绚烂的立体场景,给她(他)一个惊喜!(送代码)

【 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

The usage of try...catch and finally in js

通过模拟Vite一起深入其工作原理
随机推荐
leetcode - symmetric binary tree
Study Notes-----Left-biased Tree
21 Days Learning Challenge (2) Use of Graphical Device Trees
思考(八十八):使用 protobuf 自定义选项,做数据多版本管理
mysql can't Execute, please solve it
In 2022, you still can't "low code"?Data science can also play with Low-Code!
2022 High-level installation, maintenance, and removal of exam questions mock exam question bank and online mock exam
Never put off till tomorrow what you can put - house lease management system based on the SSM
undo problem
Cloud Native (32) | Introduction to Platform Storage System in Kubernetes
Hash table lookup (hash table)
CPDA|How Operators Learn Data Analysis (SQL) from Negative Foundations
Flink 1.15.1 Cluster Construction (StandaloneSession)
沃谈小知识 |“远程透传”那点事儿
Details such as compiling pretreatment
Thinking (88): Use protobuf custom options for multi-version management of data
Turn: Charles Handy: Who you are is more important than what you do
为什么pca分量没有关联
Programmer's Tanabata Romantic Moment
倒计时 2 天|云原生 Meetup 广州站,等你来!