[FFmpeg-devel] Using a codec-private AVOption in init()?

Michael Niedermayer michaelni at gmx.at
Mon Apr 18 18:13:49 CEST 2011


On Sat, Apr 16, 2011 at 10:05:08AM -0700, Philip Langdale wrote:
> This one's got me quite confused. As far as I can tell, it's
> impossible to use an AVOption value in a codec's init function.
>
> av_opt_set_string3() and friends need to be passed the codec
> private context and will use the AVOption to discover the offset
> inside the context to write the value.
>
> However, the context isn't initialised until you call avcodec_open()
> which also calls the codec's init function before returning.
>
> Yet, there are multiple existing codecs that use AVOptions and use
> those values in init() (eg: vorbis, openamr-nb). Am I missing something
> or is this just broken?

you are missing avcodec_get_context_defaults3()

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110418/1f6c9765/attachment.asc>


More information about the ffmpeg-devel mailing list