1

我正在寻找一些代码库来编码 LibAV 中的视频。我无法理解这两行的目的:

av_opt_set(context->priv_data, "tune", "zerolatency", 0);
av_opt_set(context->priv_data, "preset", "fast", 0);

这里,contextAVCodecContext

我是这个图书馆的新手,希望得到一个描述性的答案。

4

2 回答 2

3

这是一个实用函数,用于设置在第一个参数中传递的 struct ref 中定义的 AVOption 成员的值。第二个参数是成员,第三个是值。第 4 个参数是一个搜索标志,告诉 fn 是否搜索子结构。

https://www.ffmpeg.org/doxygen/trunk/group__opt__set__funcs.html

https://www.ffmpeg.org/doxygen/trunk/group__avoptions.html

于 2018-11-11T18:01:35.567 回答
1

Gyan的补充:

当我们使用时av_opt_set() ,这里是原型

av_opt_set (void *obj, const char *name, const char *val, int search_flags)

第一个参数的类型AvClass定义在:https ://www.ffmpeg.org/doxygen/trunk/structAVClass.html

child_next()这个结构体中有两个函数指针:child_class_iterate()一个是可以获取AvClass对象child,所以很明显AvClass是形成树并且有childern,search_flags决定是否对childern进行操作;

于 2021-05-18T20:30:05.687 回答