Change avcodec code to compile with new ffmpeg major version
This commit set allows to use new major version of ffmpeg and converts minimal amount of code needed. Libva seems to be still non-working with new major version and it is out of this commit-set scope.
Mainly changes are to update code from things deprecated around 2015 in ffmpeg to current flow.