I found and fixed a bug in lib/util/aviio.c. Without this fix, aviio.c can write out ridiculous numbers for the "total length" field of audio streams. It could be that MAME and/or MESS never trigger this bug, but CD-i Emulator certainly did.

You can find my one-line fix here: http://www.cdiemu.org/download/aviio.diff

Can somebody with SVN access please apply this? I've also sent it to Aaron for inclusion in MAME.