The function does not need the full pcm_convert_state struct.
Moved all code which converts the sample format to a separate library.