Hello,

Since a few days (or weeks ?) there is a problem when trying to add an audio stream in 
an avi file.

Here is a sample code to explain the problem :

---------------------------------------------------------------------------------------
 
// 44100Hz, 16bits, mono sound
WAVEFORMATEX wfm;
wfm.wFormatTag=WAVE_FORMAT_PCM;
wfm.nChannels=1;                
wfm.nSamplesPerSec=44100*1;     // frequency x channels
wfm.nAvgBytesPerSec=2*44100;
wfm.nBlockAlign=2;      // 2 byte per sample ? what value should I give here ?
wfm.wBitsPerSample=16;
wfm.cbSize=0;

IAviAudioWriteStream *stream;
// ( the object "avi_file" has already been created elsewhere)
stream=avi_file->AddAudioStream(WAVE_FORMAT_MPEGLAYER3, &wfm, 8000);    //mp3, 
8000ko/s (128kbits/s)
stream->Start();                                // <-- HERE IS THE SEGMENTATION FAULT
stream->AddData(data, size_of_data);    // never reached
...

---------------------------------------------------------------------------------------

The problem occurs with all combinations of sound frequency, number of channels, 
format (PCM or mp3), etc.
Perhaps the values I give in the WAVEFORMATEX structure are not correct ? What are the 
fields "nBlockAlign" and "cbSize" ?

thanks,

Pierre.

_______________________________________________
Avifile mailing list
[EMAIL PROTECTED]
http://prak.org/mailman/listinfo/avifile

Reply via email to