[FFmpeg-devel] FFmpeg internal API: access to encoder private options

Michael Niedermayer michaelni at gmx.at
Sat Oct 6 10:57:26 CEST 2012

On Sat, Oct 06, 2012 at 12:29:33PM +0400, Dmitry Samonenko wrote:
> Hello.
> Some of the FFmpeg encoders specify options which can adjust it's
> operation slightly - most of the time turning optional or legacy
> features on.
> For example, libspeex encoder supports several options turning
> on some of it's rich features set. As far as I understand code, all
> options defined for the encoder are parsed and stored in encoder
> context struct - LibSpeexEncContext (for libspeexenc case), which, 
> on the other hand, is the priv_data field of AVCodecContext struct.
> So, is there a way using AVOption API (may I call it like that?) to access
> these options?
> I'm asking this because I'm working on a patch for SDP with speex payload
> and RFC states that some of the params must be present only when encoder
> is configured with particular feature(-s). Function that does SDP
> populating is issued with AVFormatContext and AVCodecContext. Please,
> correct me if I am wrong, but encoder options are not present in AVCodecContext.
> I tried to find a similar case when AVFormat "layer" needs to check some 
> of the encoder options, but had no luck. 
> Personally, I think casting AVCodecContext->priv_data to LibSpeexEncContext
> during this func would be a huge mistake.

there is av_opt_get*() to read these options but theres possibly a
problem. If you want to support stream copy then theres no encoder,
that is speex packets would just be read from a file to which they
have been encoded previously, the encoder parameters no longer being
available in a struct but just in the bitstream. Also it could have
been an encoder very different from ffmpeg+libspeex

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates
-------------- 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/20121006/de4bb6ff/attachment.asc>

More information about the ffmpeg-devel mailing list