[FFmpeg-cvslog] libopencore-amr: set channel layout for amr-nb or if not set by the user
Justin Ruggles
git at videolan.org
Fri Nov 2 14:32:41 CET 2012
ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Mon Oct 22 17:49:59 2012 -0400| [d40dab907aad684885988552a84da76488f298c0] | committer: Justin Ruggles
libopencore-amr: set channel layout for amr-nb or if not set by the user
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d40dab907aad684885988552a84da76488f298c0
---
libavcodec/libopencore-amr.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c
index 9a543b4..a754d52 100644
--- a/libavcodec/libopencore-amr.c
+++ b/libavcodec/libopencore-amr.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/audioconvert.h"
#include "avcodec.h"
#include "libavutil/avstring.h"
#include "libavutil/common.h"
@@ -30,13 +31,16 @@ static void amr_decode_fix_avctx(AVCodecContext *avctx)
{
const int is_amr_wb = 1 + (avctx->codec_id == AV_CODEC_ID_AMR_WB);
- if (!avctx->sample_rate)
- avctx->sample_rate = 8000 * is_amr_wb;
+ avctx->sample_rate = 8000 * is_amr_wb;
- if (!avctx->channels)
- avctx->channels = 1;
+ if (avctx->channels > 1) {
+ av_log_missing_feature(avctx, "multi-channel AMR", 0);
+ return AVERROR_PATCHWELCOME;
+ }
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ avctx->channels = 1;
+ avctx->channel_layout = AV_CH_LAYOUT_MONO;
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16;
}
#if CONFIG_LIBOPENCORE_AMRNB
More information about the ffmpeg-cvslog
mailing list