SwrContext * swr_alloc (void); // allocate resampling context.
SwrContext *swr_alloc_set_opts(struct SwrContext *s, int64_t out_ch_layout, AVSampleFormat out_sample_fmt, int out_sample_rate
, int64_t in_ch_layout, AVSampleFormat in_sample_fmt, int in_sample_rate, int log_offset, void *log_ctx
);
Parameter 1: resampling context
Parameter 2: output layout, such as: 5.1 ...
Parameter 3: output sample format. Float, S16, S24
Parameter 4: output sample rate. You can not change.
Parameter 5: layout input.
Parameter 6: the input sample format.
7 parameters: input sample rate.
Parameter 8, 9 parameters, log, not control, can be directly transmitted 0
For audio playback speed can be changed by changing the sample rate.
int swr_init (struct SwrContext * s); // initialize context
void swr_free (struct SwrContext ** s); // for releasing context space