Fix compilation with recent ffmpeg versions

This commit fixes compilation with ffmpeg v1.2.1; it should still work on whatever version you guys are using (v0.6 something?) but I cannot test that. I tried to avoid breakages on any older versions (v0.7, v0.8) but I cannot test that either. Most of deprecations are gone except ones about encode_video/encode_audio (AVPacket stuff - not worth the effort until it breaks which will happen when libavcodec API gets bumped to v56)