comparison g726.c @ 7049:bb24d15211a4 libavcodec

Print sane error message for channels != 1.
author michael
date Mon, 16 Jun 2008 23:20:11 +0000
parents 167726a95509
children ecb7071103af
comparison
equal deleted inserted replaced
7048:167726a95509 7049:bb24d15211a4
322 static av_cold int g726_init(AVCodecContext * avctx) 322 static av_cold int g726_init(AVCodecContext * avctx)
323 { 323 {
324 AVG726Context* c = (AVG726Context*)avctx->priv_data; 324 AVG726Context* c = (AVG726Context*)avctx->priv_data;
325 unsigned int index= (avctx->bit_rate + avctx->sample_rate/2) / avctx->sample_rate - 2; 325 unsigned int index= (avctx->bit_rate + avctx->sample_rate/2) / avctx->sample_rate - 2;
326 326
327 if (avctx->channels != 1 || 327 if (
328 (avctx->bit_rate != 16000 && avctx->bit_rate != 24000 && 328 (avctx->bit_rate != 16000 && avctx->bit_rate != 24000 &&
329 avctx->bit_rate != 32000 && avctx->bit_rate != 40000)) { 329 avctx->bit_rate != 32000 && avctx->bit_rate != 40000)) {
330 av_log(avctx, AV_LOG_ERROR, "G726: unsupported audio format\n"); 330 av_log(avctx, AV_LOG_ERROR, "G726: unsupported audio format\n");
331 return -1; 331 return -1;
332 } 332 }
333 if (avctx->sample_rate != 8000 && avctx->strict_std_compliance>FF_COMPLIANCE_INOFFICIAL) { 333 if (avctx->sample_rate != 8000 && avctx->strict_std_compliance>FF_COMPLIANCE_INOFFICIAL) {
334 av_log(avctx, AV_LOG_ERROR, "G726: unsupported audio format\n"); 334 av_log(avctx, AV_LOG_ERROR, "G726: unsupported audio format\n");
335 return -1;
336 }
337 if(avctx->channels != 1){
338 av_log(avctx, AV_LOG_ERROR, "Only mono is supported\n");
335 return -1; 339 return -1;
336 } 340 }
337 if(index>3){ 341 if(index>3){
338 av_log(avctx, AV_LOG_ERROR, "Unsupported number of bits %d\n", index+2); 342 av_log(avctx, AV_LOG_ERROR, "Unsupported number of bits %d\n", index+2);
339 return -1; 343 return -1;