Libav does not have av_get_alt_sample_fmt
AudioFormat.alt_packed -> packed

I think this is simpler.
AudioFormat docs