SwrContext *swr=swr_alloc(); //1.需要申请一个空间
//2.设置参数
struct SwrContext * swr_alloc_set_opts (
struct SwrContext *s,
int64_t out_ch_layout,
enum AVSampleFormat out_sample_fmt,
int out_sample_rate,
int64_t in_ch_layout,
enum AVSampleFormat in_sample_fmt,
int in_sample_rate,
int log_offset,
void *log_ctx);
//现有Swr上下文(如果可用),如果不可用则为NULL
//out_ch_layout:输出通道布局(AV_CH_LAYOUT_ *)
//out_sample_fmt:输出采样格式(AV_SAMPLE_FMT_ *)。
//out_sample_rate:输出采样率(频率(Hz))
//in_ch_layout:输入通道布局(AV_CH_LAYOUT_ *)
//in_sample_fmt:输入样品格式(AV_SAMPLE_FMT_ *)。
//in_sample_rate:输入采样率(频率(Hz))
//log_offset:记录级别偏移
//log_ctx:父记录上下文,可以为NULL
//3.初始化上下文
swr_init(struct SwrContext *s);