View Single Post
Old 29th December 2005, 02:22   #8  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,914
Thanks for your rapid and large answer. I have a lot of work to do.
First I want answer your questions.
Quote:
EnsureVBRMP3Sync - I think it must be right after decoder. I believe this is just buffering to avoid desync and it can be used with any source type (maybe i'm wrong?)
I think is not necessary for uncompressed audio, but I'm not sure.
Quote:
Which software did You use for such diagnostic?
I make a little utility to read wav header. But with a hex editor (I use WinHex) you can see the header (only 44 bytes). Here is a graphical description of wav header:
http://ccrma.stanford.edu/courses/42...ts/WaveFormat/
Quote:
I can use int64 in source BUT there are only 4 bytes in WAV HEADER - how I must write this to WAV?
This is the problem for the wav limit 4 GB. And 2 GB limit is for soft using 'signed long int' for these fields.
The faad decoder (aac) can generate 'invalid' wav's > 4 GB, and fill these fields (RiffLength and DataLength) with 0xFFFFFF00.
Foobar also make 'invalid' wav's > 4 GB, and fill these fields with the 4 low order bytes.
Really the only way, afaik, to use a wav > 4 GB is split it in mono wav's. Then Tranzcode, WaveWizard and BeSplit can generate valid (not for BeSplit because a bug in BlockAlign field) mono wav's with the original length. The method is ignore these fields and continue working until end of file.
I prefer the faad method (0xFFFFFF00) because Foobar method can be confused with valid fields.
Quote:
Can you fix my source?
I send you a PM (2005-12-19) about this. In your previous BeHappy version you use for DataLength:
Code:
Int64 nByteSize = streamSampleLength * m_WavHeader.nBlockAlign;
target.Write(BitConverter.GetBytes((uint)Math.Min(nByteSize,uint.MaxValue)),0,4);
And I suggest you use the same method for RiffLength. In actual version the int64 is missing and you use for DataLength the method from RiffLength (?).

In the actual version, the variable with possible overflow is used also in:
Code:
private uint m_nSizeInBytes;
...
m_nSizeInBytes = m_nSampleCount*m_wavHeader.nBlockAlign;  // may be > 2^32
...
private void createEncoderProcess()
...
  info.Arguments = string.Format(m_commandLine, m_output,
   m_wavHeader.nSamplesPerSec, m_wavHeader.wBitsPerSample,
   m_wavHeader.nChannels,m_nSampleCount,m_nSizeInBytes);
tebasuna51 is offline   Reply With Quote