Mercurial > libavcodec.hg
comparison libgsm.c @ 6720:2c540dc9ca2c libavcodec
Fix decoding of:
http://samples.mplayerhq.hu/A-codecs/msgsm/levis.avi
http://samples.mplayerhq.hu/A-codecs/msgsm/wernfried_1.avi
partially fix decoding of:
http://samples.mplayerhq.hu/A-codecs/GSM/sample-gsm-8000.gsm
Allow the user to encode non standard samplerates by using -strict
author | michael |
---|---|
date | Tue, 29 Apr 2008 18:31:29 +0000 |
parents | 5df0c730234d |
children | 1c3bcb60bed4 |
comparison
equal
deleted
inserted
replaced
6719:e88e719b5e77 | 6720:2c540dc9ca2c |
---|---|
39 if (avctx->channels > 1) { | 39 if (avctx->channels > 1) { |
40 av_log(avctx, AV_LOG_ERROR, "Mono required for GSM, got %d channels\n", | 40 av_log(avctx, AV_LOG_ERROR, "Mono required for GSM, got %d channels\n", |
41 avctx->channels); | 41 avctx->channels); |
42 return -1; | 42 return -1; |
43 } | 43 } |
44 | |
45 if(avctx->codec->decode){ | |
46 if(!avctx->channels) | |
47 avctx->channels= 1; | |
48 | |
49 if(!avctx->sample_rate) | |
50 avctx->sample_rate= 8000; | |
51 }else{ | |
44 if (avctx->sample_rate != 8000) { | 52 if (avctx->sample_rate != 8000) { |
45 av_log(avctx, AV_LOG_ERROR, "Sample rate 8000Hz required for GSM, got %dHz\n", | 53 av_log(avctx, AV_LOG_ERROR, "Sample rate 8000Hz required for GSM, got %dHz\n", |
46 avctx->sample_rate); | 54 avctx->sample_rate); |
55 if(avctx->strict_std_compliance > FF_COMPLIANCE_INOFFICIAL) | |
47 return -1; | 56 return -1; |
48 } | 57 } |
49 if (avctx->bit_rate != 13000 /* Official */ && | 58 if (avctx->bit_rate != 13000 /* Official */ && |
50 avctx->bit_rate != 13200 /* Very common */ && | 59 avctx->bit_rate != 13200 /* Very common */ && |
51 avctx->bit_rate != 0 /* Unknown; a.o. mov does not set bitrate when decoding */ ) { | 60 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", | 61 av_log(avctx, AV_LOG_ERROR, "Bitrate 13000bps required for GSM, got %dbps\n", |
53 avctx->bit_rate); | 62 avctx->bit_rate); |
63 if(avctx->strict_std_compliance > FF_COMPLIANCE_INOFFICIAL) | |
54 return -1; | 64 return -1; |
65 } | |
55 } | 66 } |
56 | 67 |
57 avctx->priv_data = gsm_create(); | 68 avctx->priv_data = gsm_create(); |
58 | 69 |
59 switch(avctx->codec_id) { | 70 switch(avctx->codec_id) { |