[FFmpeg-devel] [PATCH] avcodec: Assert on codec->encode2 in encode_audio2

wm4 nfxjfg at googlemail.com
Thu Aug 27 13:15:44 CEST 2015

On Thu, 27 Aug 2015 12:55:17 +0200
Lukas Blubb <luogpg at googlemail.com> wrote:

> 2015-08-27 12:45 GMT+02:00 wm4 <nfxjfg at googlemail.com>:
> > [..]
> >
> > When can this happen? Shouldn't it just return an error somewhere if
> > this is not an encoder?
> I'm working on a Rust wrapper library and apparently am doing something
> wrong (it segfaulted). `avcodec_encode_video2()` has this assertion, so I
> thought it might fit here aswell.


If you want to hear my opinion on making safe wrappers around libav*:
don't try to export the complete API. Instead, provide a way to
feed/read AVPackets and AVFrames, and a way to set codec parameters
before initialization. This should give pretty robust results, and
should be easy to use. (Also make sure you're not committing the
mistake of using the libavformat provided AVCodecContext instances for
decoding and encoding.)

More information about the ffmpeg-devel mailing list