ad_libav: flush decoder output after last input packet

Some versions of libav APE audio decoder can consume a packet and
return data on subsequent calls. This could lead to audio being cut at
end of file as mplayer2 stopped decoding as soon as input as
exhausted. Keep calling libavcodec audio decoder until it returns no
more output.
audio: add af_lavrresample, remove old resampling filters

Remove `af_resample` and `af_lavcresample`. The former is a mess while
the latter uses an API that was long deprecated in libavcodec and is
now removed. Add new filter af_lavrresample which uses libavresample.
`af_lavrresample` has roughly the same features and structure as
`af_lavcresample` had.

Libavresample is now a mandatory dependency. Change configure script
accordingly and remove #ifdefs in other code.
Use avg_frame_rate instead of r_frame_rate

r_frame_rate was removed in Libav 10.
Use avcodec_encode_video2 instead of avcodec_encode_video

avcodec_encode_video2 was removed in Libav 10.