Snatched auich_write_codec() function.