"error: 'avcodec_open' was not declared in this scope" on attempting to compile untrunc

avcodec_open was deprecated for avcodec_open2. See for instance this note. Reading through the docs for avcodec_open, it appears that the way to do the replacement is to convert:

avcodec_open(a,b);

to

avcodec_open2(a,b,NULL);

This fix is similar to one that was suggested, but not verified in the untrunc library itself, here.

I tried to verify that the fix worked. In practice, it was a single line modification in track.cpp. Take:

 if(avcodec_open(codec.context, codec.codec)<0)

and replace it with

 if(avcodec_open2(codec.context, codec.codec, NULL)<0)

(on commit 3c708a, this change is on line 218). NOTE: I only verified that the code compiled, not that it actually worked the way it was supposed to (I don't have a broken m4v to test on). Let me know if it works, or if you encounter any other problems.

Tags:

C++

Video