[MPlayer-dev-eng] [PATCH] lavc audio: fix wave format header for ima adpcm wav files

ed.gomez at free.fr ed.gomez at free.fr
Thu Dec 18 11:54:43 CET 2008


lavc audio: fix wave format header for ima adpcm wav files

Two 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 had the multiply in the wrong place. Checked against what
libavcodec uses.

With these two 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
@@ -67,8 +67,8 @@
 		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) = 
+				((lavc_actx->block_align - 4 * lavc_actx->channels) * 8 / (4 * lavc_actx->channels)) + 1;
 			break;
 		case 0x55: /* mp3 */
 			mux_a->wf->cbSize = 12;


-- 
Edouard Gomez



More information about the MPlayer-dev-eng mailing list