[FFmpeg-devel] [PATCH] doc: fix option setting for encoding example
george at nsup.org
Tue Jan 13 19:33:27 CET 2015
Le quartidi 24 nivôse, an CCXXIII, Michael Bradshaw a écrit :
> In the encoding/decoding example, in the video_encode_example()
> function, av_opt_set() is used to set the option "preset" to "slow" (here,
> c is a AVCodecContext*):
> av_opt_set(c->priv_data, "preset", "slow", 0);
> I presume this is wrong to use priv_data, and instead the codec context
> should be passed. Attached patch passes the codec context instead of
Did you test both?
As far as I can see, both are wrong, because both forget to check the return
The current code is, IMHO, wrong because it accesses an undocumented, and
therefore for internal use, field in the structure instead of cleanly using
But I suspect your code is wrong too, because it lacks
AV_OPT_SEARCH_CHILDREN: it will only find options for AVCodecContext, not
options for the private data of the codec.
If the error check was done, it would probably show
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 819 bytes
Desc: Digital signature
More information about the ffmpeg-devel