libav-9 - add missing includes

With these modifications, openmw builds (and runs) against libav-9.7 on Gentoo with Clang and libcxx.

I do not know if the checks are strictly necessary for backward compatibility, but there was precedent and I figure it can't hurt.