From 53048c295973202d5981f303f62b4637a199b208 Mon Sep 17 00:00:00 2001 From: Ali Gholami Rudi Date: Sun, 3 Nov 2024 01:54:04 +0330 Subject: [PATCH] ffs: update setting channel layout for SwrContext --- ffs.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/ffs.c b/ffs.c index fe4cb74..be48801 100644 --- a/ffs.c +++ b/ffs.c @@ -293,14 +293,11 @@ void ffs_aconf(struct ffs *ffs) { int rate, bps, ch; ffs_ainfo(ffs, &rate, &bps, &ch); - ffs->swrc = swr_alloc(); - av_opt_set_int(ffs->swrc, "in_channel_layout", ffs->cc->channel_layout, 0); - /* av_opt_set_int(ffs->swrc, "in_channel_layout", ffs->cc->ch_layout, 0); */ - av_opt_set_int(ffs->swrc, "in_sample_rate", ffs->cc->sample_rate, 0); - av_opt_set_sample_fmt(ffs->swrc, "in_sample_fmt", ffs->cc->sample_fmt, 0); - av_opt_set_int(ffs->swrc, "out_channel_layout", FFS_CHLAYOUT, 0); - av_opt_set_int(ffs->swrc, "out_sample_rate", rate, 0); - av_opt_set_sample_fmt(ffs->swrc, "out_sample_fmt", FFS_SAMPLEFMT, 0); + AVChannelLayout chlayout; + av_channel_layout_from_mask(&chlayout, FFS_CHLAYOUT); + swr_alloc_set_opts2(&ffs->swrc, + &chlayout, FFS_SAMPLEFMT, rate, + &ffs->cc->ch_layout, ffs->cc->sample_fmt, ffs->cc->sample_rate, 0, NULL); swr_init(ffs->swrc); } -- 2.11.4.GIT