import VA-API support from mplayer-vaapi

cherry-picked from mplayer-vaapi hwaccel-vaapi  e4a658ef..1923fa10
[vd_ffmpeg/vaapi] fix double free of va_context
[vd_ffmpeg] fix crash in threaded H.264 vaapi decoding
[vo_vaapi] fix crash when direct rendring is used
[vo_vaapi] possible memory leak
[vo_vaapi] indexed subpictures not displayed correctly

maybe due to a bug in libva/HW?
[vo_vaapi] surpress compiler warnings