Merged from upstream. Works fine with ffmpeg-2.2

Author: Wouter Verhelst <w@uter.be>
Date:   Sun Feb 23 13:58:35 2014 +0100

    Follow renaming of CodecID to AVCodecID

    This probably means we can't compile against FFmpeg anymore, only
    against libav, but that should be fine.