lavf: add a common function for selecting a pcm codec from parameters