当前位置:网站首页>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.
边栏推荐
- 【 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
- Apache DolphinScheduler, a new generation of distributed workflow task scheduling platform in practice - Medium
- 软链接引发的物理备份问题
- Cloud Native (32) | Introduction to Platform Storage System in Kubernetes
- Intersection of Boolean Operations in SuperMap iDesktop.Net - Repairing Complex Models with Topological Errors
- Package zip is not available, but is referred to by another package.
- How to simulate the background API call scene, very detailed!
- 基于生长的棋盘格角点检测方法
- Lexicon - the maximum depth of a binary tree
- 如何在WordPress中添加特定类别的小工具
猜你喜欢
21天学习挑战赛(2)图解设备树的使用
presto启动成功后出现2022-08-04T17:50:58.296+0800 ERROR Announcer-3 io.airlift.discovery.client.Announcer
A small tool to transfer files using QR code - QFileTrans 1.2.0.1
Beyond YOLO5-Face | YOLO-FaceV2 officially open source Trick+ academic point full
引领数字医学高地,中山医院探索打造未来医院“新范式”
2022-08-04 The sixth group, hidden from spring, study notes
今年七夕,「情蔬」比礼物更有爱
Use SuperMap iDesktopX data migration tool to migrate map documents and symbols
The Tanabata copywriting you want has been sorted out for you!
After the large pixel panorama is completed, what are the promotion methods?
随机推荐
Why is the pca component not associated
冰蝎V4.0攻击来袭,安全狗产品可全面检测
sql server 安装提示用户名不存在
PostgreSQL数据库 用navicat 打开表结构的时候报错 cannot update secondarysnapshot during a parallel operation 怎么解决?
调用阿里云oss和sms服务
Kubernetes 网络入门
sql怎么找字段里所有数据为空的字段
倒计时 2 天|云原生 Meetup 广州站,等你来!
QT MV\MVC structure
In 2022, you still can't "low code"?Data science can also play with Low-Code!
word分栏小记
用CH341A烧录外挂Flash (W25Q16JV)
【滤波跟踪】基于matlab无迹卡尔曼滤波惯性导航+DVL组合导航【含Matlab源码 2019期】
人人都在说的数据中台,你需要关注的核心特点是什么?
[Filter tracking] based on matlab unscented Kalman filter inertial navigation + DVL combined navigation [including Matlab source code 2019]
undo问题
2022-08-04 第六小组 瞒春 学习笔记
ffmpeg -sources分析
北斗三号短报文终端露天矿山高边坡监测方案
论治理与创新,2022 开放原子全球开源峰会 OpenAnolis 分论坛圆满落幕