comparison riff.c @ 3895:5554c668388b libavformat

simplify bps code by using av_get_bits_per_sample
author bcoudurier
date Fri, 05 Sep 2008 02:20:33 +0000
parents 8e7b2616e1ad
children b3a0c732d0d7
comparison
equal deleted inserted replaced
3894:30c8c9f53b9d 3895:5554c668388b
241 return -1; 241 return -1;
242 242
243 put_le16(pb, enc->codec_tag); 243 put_le16(pb, enc->codec_tag);
244 put_le16(pb, enc->channels); 244 put_le16(pb, enc->channels);
245 put_le32(pb, enc->sample_rate); 245 put_le32(pb, enc->sample_rate);
246 if (enc->codec_id == CODEC_ID_PCM_U8 || 246 if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3 || enc->codec_id == CODEC_ID_GSM_MS) {
247 enc->codec_id == CODEC_ID_PCM_ALAW ||
248 enc->codec_id == CODEC_ID_PCM_MULAW ||
249 enc->codec_id == CODEC_ID_PCM_ZORK) {
250 bps = 8;
251 } else if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3 || enc->codec_id == CODEC_ID_GSM_MS) {
252 bps = 0; 247 bps = 0;
253 } else if (enc->codec_id == CODEC_ID_ADPCM_IMA_WAV || enc->codec_id == CODEC_ID_ADPCM_MS || enc->codec_id == CODEC_ID_ADPCM_G726 || enc->codec_id == CODEC_ID_ADPCM_YAMAHA) { // 248 } else if (enc->codec_id == CODEC_ID_ADPCM_IMA_WAV || enc->codec_id == CODEC_ID_ADPCM_MS || enc->codec_id == CODEC_ID_ADPCM_G726 || enc->codec_id == CODEC_ID_ADPCM_YAMAHA) { //
254 bps = 4; 249 bps = 4;
255 } else if (enc->codec_id == CODEC_ID_PCM_S24LE) {
256 bps = 24;
257 } else if (enc->codec_id == CODEC_ID_PCM_S32LE || enc->codec_id == CODEC_ID_PCM_F32LE) {
258 bps = 32;
259 } else if (enc->codec_id == CODEC_ID_PCM_F64LE) {
260 bps = 64;
261 } else { 250 } else {
262 bps = 16; 251 bps = av_get_bits_per_sample(enc->codec_id);
263 } 252 }
264 if(bps != enc->bits_per_sample && enc->bits_per_sample){ 253 if(bps != enc->bits_per_sample && enc->bits_per_sample){
265 av_log(enc, AV_LOG_WARNING, "requested bits_per_sample (%d) and actually stored (%d) differ\n", enc->bits_per_sample, bps); 254 av_log(enc, AV_LOG_WARNING, "requested bits_per_sample (%d) and actually stored (%d) differ\n", enc->bits_per_sample, bps);
266 } 255 }
267 256