Fixed bugs in AVI mux module
Fixed bugs in AVI mux module

Closes #21 (partly, at least), #4288 and #4304

Description
===================
Fixed bugs in AVI mux to support creation of AVI files with following popular video/audio combinations
(a) MPEG4 video (aka XVID) with MP3/AC3/PCM Audio
(b) MJPEG video with PCM audio.
AVI as such is not used for storing other formats like H.264, AAC etc

Bug fix details
===================
(a) 'hdrl' list size was wrong. It incorrectly included some parts of MOVI list, size taken by hdrl LIST tag and its size and Size of 'RIFF', File size and 'AVI ' type.
(b) Block Align was set to 0 in case of MP3/AC3. It has to be non-zero. It has to been set to 1.
(c) XVID video decoders expect header to present as part of first frame. Added code to append header present at end of BITMAPINFOHEADER to beginning of the first video frame in case of XVID video.
(d) nAvgBytesPerSec of Waveformatex was not properly being set in case of PCM audio.
(e) Last index entry value was set to garbage due to incorrect index size calculation.

Test PC configuration
===================
Tested with Windows Media Player 11 installed on Windows XP Service pack 3 machine with following directshow filters installed
(a) XVID MPEG4 video decoder filter for MPEG4 video decoding
(b) LAME MP3 codec for MP3 audio decoding

Combinations tested
====================
(a) MPEG4/MP3 transcode
vlc -I dummy "Mr_MrsSmith-h264_aac.mp4" :sout="#transcode{vcodec=mp4v,vb=1024,fps=25,acodec=mpga,ab=128}:standard{mux=avi,access=file,dst=out.avi}" vlc://quit

(b) MPEG4/AC3 transcode
vlc -I dummy "Mr_MrsSmith-h264_aac.mp4" :sout="#transcode{vcodec=mp4v,vb=1024,fps=25,acodec=a52, ab=128}:standard{mux=avi,access=file,dst=out.avi}" vlc://quit

(c) MPEG4/PCM(16bit) transcode
vlc -I dummy "Mr_MrsSmith-h264_aac.mp4" :sout="#transcode{vcodec=mp4v,vb=1024,fps=25,acodec=s16l}:standard{mux=avi,access=file,dst=out.avi}" vlc://quit

(d) MPEG4/PCM(24 bit) transcode
vlc -I dummy "Mr_MrsSmith-h264_aac.mp4" :sout="#transcode{vcodec=mp4v,vb=1024,fps=25,acodec=s24l}:standard{mux=avi,access=file,dst=out.avi}" vlc://quit

(e) MPEG4/PCM(32bit) transcode
vlc -I dummy "Mr_MrsSmith-h264_aac.mp4" :sout="#transcode{vcodec=mp4v,vb=1024,fps=25,acodec=s32l}:standard{mux=avi,access=file,dst=out.avi}" vlc://quit

(f) MJPEG/PCM(32bit) transcode
vlc -I dummy "Mr_MrsSmith-h264_aac.mp4" :sout="#transcode{vcodec=mjpeg,vb=1024,fps=25,acodec=s32l}:standard{mux=avi,access=file,dst=out.avi}" vlc://quit

Signed-off-by: Jean-Baptiste Kempf <7b85a41a628204b76aba4326273a3ccc74bd009a@videolan.org>

xkfz007/vlc,jomanmuk/vlc-2.1,vlc-mirror/vlc-2.1,xkfz007/vlc,jomanmuk/vlc-2.1,jomanmuk/vlc-2.2,shyamalschandra/vlc,vlc-mirror/vlc,shyamalschandra/vlc,jomanmuk/vlc-2.2,jomanmuk/vlc-2.1,krichter722/vlc,jomanmuk/vlc-2.1,vlc-mirror/vlc-2.1,jomanmuk/vlc-2.1,krichter722/vlc,shyamalschandra/vlc,jomanmuk/vlc-2.1,vlc-mirror/vlc-2.1,xkfz007/vlc,vlc-mirror/vlc,vlc-mirror/vlc,krichter722/vlc,vlc-mirror/vlc-2.1,jomanmuk/vlc-2.2,xkfz007/vlc,shyamalschandra/vlc,vlc-mirror/vlc-2.1,vlc-mirror/vlc,jomanmuk/vlc-2.2,jomanmuk/vlc-2.2,krichter722/vlc,jomanmuk/vlc-2.1,vlc-mirror/vlc,jomanmuk/vlc-2.2,vlc-mirror/vlc-2.1,krichter722/vlc,xkfz007/vlc,xkfz007/vlc,vlc-mirror/vlc,shyamalschandra/vlc,krichter722/vlc,krichter722/vlc,vlc-mirror/vlc,shyamalschandra/vlc,shyamalschandra/vlc,jomanmuk/vlc-2.2,vlc-mirror/vlc-2.1,xkfz007/vlc