Reputation: 1575
I am looking at some code base to encode videos in LibAV. I am unable to understand the purpose of these two lines:
av_opt_set(context->priv_data, "tune", "zerolatency", 0);
av_opt_set(context->priv_data, "preset", "fast", 0);
Here, context
is AVCodecContext
.
I am new to this library and would appreciate a descriptive answer.
Upvotes: 1
Views: 4216
Reputation: 805
supplement for Gyan:
when we use av_opt_set()
, here is prototype
av_opt_set (void *obj, const char *name, const char *val, int search_flags)
the first argument is type AvClass
defined in: https://www.ffmpeg.org/doxygen/trunk/structAVClass.html
there are two function pointer in this struct: child_next()
and child_class_iterate()
which can get AvClass object child, so it is clearly that AvClass
is formed as tree and has childern, search_flags
decides whether to opearate on childern;
Upvotes: 1
Reputation: 93058
That's a utility function to set the value of defined AVOption members in the struct ref passed in the first arg. The 2nd arg is the member and the 3rd is the value. The 4th arg is a search flag that tells the fn whether to search child structs.
See https://www.ffmpeg.org/doxygen/trunk/group__opt__set__funcs.html
and https://www.ffmpeg.org/doxygen/trunk/group__avoptions.html
Upvotes: 3