comparison libgsm.c @ 6672:79984fdb1203 libavcodec

Allow bitrates zero and 13200 (needed for decoding mov and aiff)
author mbardiaux
date Fri, 25 Apr 2008 13:05:15 +0000
parents 48759bfbd073
children 679b9ef6f5f3
comparison
equal deleted inserted replaced
6671:2d0b86dfe5bb 6672:79984fdb1203
34 #define GSM_BLOCK_SIZE 33 34 #define GSM_BLOCK_SIZE 33
35 #define GSM_MS_BLOCK_SIZE 65 35 #define GSM_MS_BLOCK_SIZE 65
36 #define GSM_FRAME_SIZE 160 36 #define GSM_FRAME_SIZE 160
37 37
38 static av_cold int libgsm_init(AVCodecContext *avctx) { 38 static av_cold int libgsm_init(AVCodecContext *avctx) {
39 if (avctx->channels > 1 || avctx->sample_rate != 8000 || avctx->bit_rate != 13000) 39 if (avctx->channels > 1) {
40 av_log(avctx, AV_LOG_ERROR, "Mono required for GSM, got %d channels\n",
41 avctx->channels);
40 return -1; 42 return -1;
43 }
44 if (avctx->sample_rate != 8000) {
45 av_log(avctx, AV_LOG_ERROR, "Sample rate 8000Hz required for GSM, got %dHz\n",
46 avctx->sample_rate);
47 return -1;
48 }
49 if (avctx->bit_rate != 13000 /* Official */ &&
50 avctx->bit_rate != 13200 /* Very common */ &&
51 avctx->bit_rate != 0 /* Unknown; a.o. mov does not set bitrate when decoding */ ) {
52 av_log(avctx, AV_LOG_ERROR, "Bitrate 13000bps required for GSM, got %dbps\n",
53 avctx->bit_rate);
54 return -1;
55 }
41 56
42 avctx->priv_data = gsm_create(); 57 avctx->priv_data = gsm_create();
43 58
44 switch(avctx->codec_id) { 59 switch(avctx->codec_id) {
45 case CODEC_ID_GSM: 60 case CODEC_ID_GSM: