Le quartidi 24 nivôse, an CCXXIII, Michael Bradshaw a écrit :
> In the encoding/decoding example[1], 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
> priv_data.

Did you test both?

As far as I can see, both are wrong, because both forget to check the return
value.

The current code is, IMHO, wrong because it accesses an undocumented, and
therefore for internal use, field in the structure instead of cleanly using
the API.

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
AVERROR_OPTION_NOT_FOUND.

Regards,

-- 
  Nicolas George

Attachment: signature.asc
Description: Digital signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to