[MPlayer-dev-eng] [PATCH] lavc audio: fix wave format header for ima adpcm wav files #3
Edouard Gomez
ed.gomez at free.fr
Thu Dec 18 15:10:57 CET 2008
lavc audio: fix wave format header for ima adpcm wav files #2
Three bugs in the current IMA ADPCM handling:
1) The cast to (uint16_t*) is done too early, so the extended information
was written far behind its correct address.
2) The Formula computing the extended information was duplicating code
from avcodec and was wrong. Better use the value coming from the avcodec
context
3) The extended information is supposed to be little endian, so big endian
hosts were writing it in the wrong order.
With these three fixes, acodec=adpcm_ima_wav encoded files are now playable
with the default windows acm codec for ima adpcm when muxed in AVI using
mplayer's avi muxer.
--- a/libmpcodecs/ae_lavc.c
+++ b/libmpcodecs/ae_lavc.c
@@ -16,6 +16,7 @@
#include "libaf/af_format.h"
#include "libaf/reorder_ch.h"
#include "libavcodec/avcodec.h"
+#include "libavutil/intreadwrite.h"
static AVCodec *lavc_acodec;
static AVCodecContext *lavc_actx;
@@ -67,8 +68,7 @@
case 0x11: /* imaadpcm */
mux_a->wf->wBitsPerSample = 4;
mux_a->wf->cbSize = 2;
- ((uint16_t*)mux_a->wf)[sizeof(WAVEFORMATEX)] =
- ((lavc_actx->block_align - 4 * lavc_actx->channels) / (4 * lavc_actx->channels)) * 8 + 1;
+ AV_WL16(mux_a->wf+1, lavc_actx->frame_size);
break;
case 0x55: /* mp3 */
mux_a->wf->cbSize = 12;
--
Edouard Gomez
More information about the MPlayer-dev-eng
mailing list