avcodec: Make av_register_hwaccel() and avcodec_register() thread safe

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avcodec/parser: Make av_register_codec_parser() thread safe

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>