[Lazarus] TProcess.Input hangs

"Leonardo M. Ramé" l.rame at griensu.com
Fri Oct 17 17:46:53 CEST 2014


Hi, I'm using this code to convert WAV files to MP3 on the fly, using 
lame. It was working great until today.

It looks like this code has problems with large files sent to stdin.

lProcess := TProcess.Create(nil);
lProcess.Executable := '/usr/bin/lame';
lProcess.Parameters.Add('-');  // stdin
lProcess.Parameters.Add('-');  // stdout
lProcess.Options := [poUsePipes];
lProcess.Execute;
lWav.LoadFromFile('/home/leonardo/16310.wav');
lWav.Position:= 0;
lWav.SaveToStream(lProcess.Input); // <--  here hangs
lProcess.CloseInput;


I also tried using this:

   repeat
     lReadCount := lProcess.Input.Write(lWav.Memory^, 500);
     if lReadCount < 500 then
       lReadCount := 0;
   until lReadCount = 0;

But also hangs before lReadCount < 500.

Any hint?

-- 
Leonardo M. Ramé
Medical IT - Griensu S.A.
Av. Colón 636 - Piso 8 Of. A
X5000EPT -- Córdoba
Tel.: +54(351)4246924 +54(351)4247788 +54(351)4247979 int. 19
Cel.: +54 9 (011) 40871877





More information about the Lazarus mailing list