diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-11-03 02:01:37 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-11-03 02:16:26 +0100 |
commit | 988f585fcb1cfb40fe4b706c32b31594b536bba0 (patch) | |
tree | 659b8d9f4daf4ce497b42c83f7adb45725fa4f65 /libavformat/riff.c | |
parent | 0b3e9d5dc61bb705d93db1e87d78d8d5131905c6 (diff) | |
parent | 594b54b51e9f3af8aac18184d634b85a836b42b6 (diff) | |
download | ffmpeg-988f585fcb1cfb40fe4b706c32b31594b536bba0.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master: (44 commits)
replacement Indeo 3 decoder
gsm demuxer: do not allocate packet twice.
flvenc: use first packet delay as global delay.
ac3enc: doxygen update.
imc: return error codes instead of 0 for error conditions.
imc: return meaningful error codes instead of -1
imc: do not set channel layout for stereo
imc: validate channel count
imc: check for ff_fft_init() failure
imc: check output buffer size before decoding
imc: use DSPContext.bswap16_buf() to byte-swap packet data
rtsp: add allowed_media_types option
libgsm: add flush function to reset the decoder state when seeking
libgsm: simplify decoding by using a loop
gsm: log error message when packet is too small
libgsmdec: do not needlessly set *data_size to 0
gsmdec: do not needlessly set *data_size to 0
gsmdec: add flush function to reset the decoder state when seeking
libgsmdec: check output buffer size before decoding
gsmdec: log error message when output buffer is too small.
...
Conflicts:
Changelog
ffplay.c
libavcodec/indeo3.c
libavcodec/mjpeg_parser.c
libavcodec/vp3.c
libavformat/cutils.c
libavformat/id3v2.c
libavutil/parseutils.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/riff.c')
-rw-r--r-- | libavformat/riff.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/libavformat/riff.c b/libavformat/riff.c index 7492df7c0b..aea6eba112 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -400,11 +400,13 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc) avio_wl32(pb, enc->sample_rate); if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3 || enc->codec_id == CODEC_ID_GSM_MS) { bps = 0; - } else if (enc->codec_id == CODEC_ID_ADPCM_G726) { - bps = 4; } else { - if (!(bps = av_get_bits_per_sample(enc->codec_id))) - bps = 16; // default to 16 + if (!(bps = av_get_bits_per_sample(enc->codec_id))) { + if (enc->bits_per_coded_sample) + bps = enc->bits_per_coded_sample; + else + bps = 16; // default to 16 + } } if(bps != enc->bits_per_coded_sample && enc->bits_per_coded_sample){ av_log(enc, AV_LOG_WARNING, "requested bits_per_coded_sample (%d) and actually stored (%d) differ\n", enc->bits_per_coded_sample, bps); @@ -415,12 +417,10 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc) //blkalign = 144 * enc->bit_rate/enc->sample_rate; } else if (enc->codec_id == CODEC_ID_AC3) { blkalign = 3840; //maximum bytes per frame - } else if (enc->codec_id == CODEC_ID_ADPCM_G726) { // - blkalign = 1; } else if (enc->block_align != 0) { /* specified by the codec */ blkalign = enc->block_align; } else - blkalign = enc->channels*bps >> 3; + blkalign = bps * enc->channels / av_gcd(8, bps); if (enc->codec_id == CODEC_ID_PCM_U8 || enc->codec_id == CODEC_ID_PCM_S24LE || enc->codec_id == CODEC_ID_PCM_S32LE || @@ -572,6 +572,9 @@ int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) codec->channels = 0; codec->sample_rate = 0; } + /* override bits_per_coded_sample for G.726 */ + if (codec->codec_id == CODEC_ID_ADPCM_G726) + codec->bits_per_coded_sample = codec->bit_rate / codec->sample_rate; return 0; } |