SwrContext *swr_alloc(void); // 分配重采樣的上下文。
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
);
參數1:重采樣上下文
參數2:輸出的layout, 如:5.1聲道…
參數3:輸出的樣本格式。Float, S16, S24
參數4:輸出的樣本率。可以不變。
參數5:輸入的layout。
參數6:輸入的樣本格式。
參數7:輸入的樣本率。
參數8,參數9,日志,不用管,可直接傳0
針對音頻的播放速度,可以通過樣本率的改變而改變。
int swr_init(struct SwrContext *s); // 初始化上下文
void swr_free(struct SwrContext **s); // 釋放上下文空間