From 414425e0641bb29bd659bfaa31ee1a367214e994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Paesa?= Date: Sat, 7 Apr 2007 11:57:35 +0000 Subject: [PATCH] =?UTF-8?q?Print=20a=20list=20of=20valid=20AMR=20bitrates?= =?UTF-8?q?=20if=20a=20wrong=20one=20is=20used.=20patch=20by=20V=C3=ADctor?= =?UTF-8?q?=20Paesa,=20wzrlpy=20arsystel=20com?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Originally committed as revision 8639 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/amr.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/libavcodec/amr.c b/libavcodec/amr.c index 46c35d4109..9c4d69994b 100644 --- a/libavcodec/amr.c +++ b/libavcodec/amr.c @@ -86,6 +86,11 @@ #include "amr_float/interf_enc.h" #endif +static const char *nb_bitrate_unsupported = + "bitrate not supported: use one of 4.75k, 5.15k, 5.9k, 6.7k, 7.4k, 7.95k, 10.2k or 12.2k\n"; +static const char *wb_bitrate_unsupported = + "bitrate not supported: use one of 6.6k, 8.85k, 12.65k, 14.25k, 15.85k, 18.25k, 19.85k, 23.05k, or 23.85k\n"; + /* Common code for fixed and float version*/ typedef struct AMR_bitrates { @@ -217,7 +222,7 @@ static int amr_nb_encode_init(AVCodecContext * avctx) if((s->enc_bitrate=getBitrateMode(avctx->bit_rate))<0) { - av_log(avctx, AV_LOG_ERROR, "bitrate not supported\n"); + av_log(avctx, AV_LOG_ERROR, nb_bitrate_unsupported); return -1; } @@ -414,7 +419,7 @@ static int amr_nb_encode_init(AVCodecContext * avctx) if((s->enc_bitrate=getBitrateMode(avctx->bit_rate))<0) { - av_log(avctx, AV_LOG_ERROR, "bitrate not supported\n"); + av_log(avctx, AV_LOG_ERROR, nb_bitrate_unsupported); return -1; } @@ -475,7 +480,7 @@ static int amr_nb_encode_frame(AVCodecContext *avctx, if((s->enc_bitrate=getBitrateMode(avctx->bit_rate))<0) { - av_log(avctx, AV_LOG_ERROR, "bitrate not supported\n"); + av_log(avctx, AV_LOG_ERROR, nb_bitrate_unsupported); return -1; } @@ -591,7 +596,7 @@ static int amr_wb_encode_init(AVCodecContext * avctx) if((s->mode=getWBBitrateMode(avctx->bit_rate))<0) { - av_log(avctx, AV_LOG_ERROR, "bitrate not supported\n"); + av_log(avctx, AV_LOG_ERROR, wb_bitrate_unsupported); return -1; } @@ -622,7 +627,7 @@ static int amr_wb_encode_frame(AVCodecContext *avctx, if((s->mode=getWBBitrateMode(avctx->bit_rate))<0) { - av_log(avctx, AV_LOG_ERROR, "bitrate not supported\n"); + av_log(avctx, AV_LOG_ERROR, wb_bitrate_unsupported); return -1; } size = E_IF_encode(s->state, s->mode, data, frame, s->allow_dtx);