diff options
author | Piotr Bandurski <ami_stuff@o2.pl> | 2012-07-24 11:42:55 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-07-25 00:50:40 +0200 |
commit | 23bb85b0691d76162da753ce08d8dd03f636ef47 (patch) | |
tree | dedee3c92adac057e5579d4cf3f2e28d2b253805 /libavformat/riff.c | |
parent | e2fd18d40d998b84af49079aa4cbd9fe9aeb4d88 (diff) | |
download | ffmpeg-23bb85b0691d76162da753ce08d8dd03f636ef47.tar.gz |
riff: make the G723.1 in wav output compatible with WMP/msacm codec
Attached patch (together with demuxing patch) allows WMP/msacm G723.1 codec decode files encoded by FFmpeg.
Tested with both 6400 and 5333 mode
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/riff.c')
-rw-r--r-- | libavformat/riff.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavformat/riff.c b/libavformat/riff.c index 64f6e1d56e..04419ed317 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -482,6 +482,8 @@ 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_G723_1) { + blkalign = 24; } else if (enc->block_align != 0) { /* specified by the codec */ blkalign = enc->block_align; } else @@ -493,6 +495,8 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc) enc->codec_id == CODEC_ID_PCM_F64LE || enc->codec_id == CODEC_ID_PCM_S16LE) { bytespersec = enc->sample_rate * blkalign; + } else if (enc->codec_id == CODEC_ID_G723_1) { + bytespersec = 800; } else { bytespersec = enc->bit_rate / 8; } @@ -516,6 +520,11 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc) bytestream_put_le16(&riff_extradata, 16); /* fwHeadFlags */ bytestream_put_le32(&riff_extradata, 0); /* dwPTSLow */ bytestream_put_le32(&riff_extradata, 0); /* dwPTSHigh */ + } else if (enc->codec_id == CODEC_ID_G723_1) { + hdrsize += 20; + bytestream_put_le32(&riff_extradata, 0x9ace0002); /* extradata needed for msacm g723.1 codec */ + bytestream_put_le32(&riff_extradata, 0xaea2f732); + bytestream_put_le16(&riff_extradata, 0xacde); } else if (enc->codec_id == CODEC_ID_GSM_MS || enc->codec_id == CODEC_ID_ADPCM_IMA_WAV) { hdrsize += 2; bytestream_put_le16(&riff_extradata, frame_size); /* wSamplesPerBlock */ |