Convert a buffer from one format to another.
Called when either the input or output formats have changed.