Fixes to get phone compiling with libavcodec.

The rename of av_calloc to av_mallocz should be portable between FFmpeg and libav. The other changes aren't. If portability with FFmpeg is required, I can place these changes in guards.

`avcodec_encode_video2` has been introduced in libav 0.9, while Ubuntu 13.10 is still delivering libav 0.8. We could force a newer version of libav.