[Libav-user] API changes v2.8.x ==> 3.0.x

Axel Holzinger aholzinger at gmx.de
Sat Jun 18 18:07:15 CEST 2016

Carl Eugen Hoyos <cehoyos at ...> writes:
> Axel Holzinger <aholzinger at ...> writes:
> > > Note that (major) parts of the 3.0 API are deprecated.
> >
> > But isn't the 3.0 API the newest one?
> No.

Interesting, thanks for the clarification. I thought 3.0.x is the trunk version. So it might be smart to wait for the next API change to not having to do the porting effort twice.

> I cannot answer how you have to change your code (and you
> did not provide any code that could be changed by readers)

Well, I didn't do by means as it is C++ and I didn't want to inspire a C/C++ flame war. Whatever, here's a snippet:
//! AVFrame Wrapper
class Frame : public AVFrame {
   typedef std::pair<int64_t, AVCodecContext*> UserInfo;
   Frame(AVCodecContext *ctx=0, AVPicture const *pic=nullptr);

//! Swscale Wrapper
class SwsContextHandle {
   SwsContextHandle(int iWidth, int iHeight, AVPixelFormat iFormat, int oWidth, int oHeight, AVPixelFormat oFormat);
   void resample(const AVPicture& input, AVPicture& output);

Frame::Frame(AVCodecContext *ctx, AVPicture const *pic)
   AVFrame *frame = this;
   memset(frame, 0, sizeof(AVFrame));
   frame->extended_data = NULL;

   if(ctx) {
      opaque = new UserInfo(0, ctx);
      ctx->get_buffer = our_get_buffer;
      ctx->release_buffer = our_release_buffer;
      ctx->get_buffer(ctx, this);
      if (pic) {
         SwsContextHandle swctx(ctx->width, ctx->height, ctx->pix_fmt, ctx->width, ctx->height, ctx->pix_fmt);  // deep copy
         swctx.resample(*pic, *this);

> but both ffmpeg.c itself (or libavformat/*.c) and every open
> source software using FFmpeg had to be changed so it should
> be possible to find examples.
> Debian for example had to patch many packages to update to
> 3.0.

This is clearly a viable approach, nevertheless it's a rocky road and my idea was that a lot of projects need(ed) to update from 2.8.x to 3.0.x and so I thought that there is a lot of need for such a documentation and that I just wasn't able to find it.

As it's not there this might mean everybody is going that rocky road and doing it on his own or perhaps not many projects did yet port to th new version?

> Sorry, Carl Eugen

Fair enough

More information about the Libav-user mailing list