Use av_frame_free for av_frame_alloc.

See http://stackoverflow.com/a/17404688 for why that code now looks like
it looks. This works with GCC, but needs to be tested against other
C++11 compilers to make sure the lambda works.
Compatibility for older version of ffmpeg/libav.

av_frame_alloc/av_frame_free is new in ffmpeg 2.0/libav 10. Add some
compatibility for older releases.