[MPlayer-dev-eng] [PATCH] lavc audio: fix wave format header for ima adpcm wav files #2
Edouard Gomez
ed.gomez at free.fr
Thu Dec 18 14:45:07 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.
default windows acm codec for ima adpcm.
--- libmpcodecs/ae_lavc.c
+++ libmpcodecs/ae_lavc.c
@@ -67,8 +67,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;
+ *(uint16_t*)(mux_a->wf+1) = le2me_16((uint16_t)lavc_actx->frame_size);
break;
case 0x55: /* mp3 */
mux_a->wf->cbSize = 12;
--
Edouard Gomez
More information about the MPlayer-dev-eng
mailing list