So here's a Bz2 decompression unit for FPC created by Synopse. It didn't handle big files well. I fixed it with AI and now it does. I tested with 7 GB files and works fine.
Changes:
1) it needed to know the size of unpacked data. now it doesn't
2) it unpacked all data from memory to memory. now it works with streams
This is pure Pascal, no DLLs needed
uses SynBzPas, bufStream;
[...]
var
InS, OutS: TBufferedFileStream;
Err: Integer;
begin
InS := TBufferedFileStream.Create('packed.bz2', fmOpenRead or fmShareDenyNone);
try
OutS := TBufferedFileStream.Create('unpacked.mp4', fmCreate);
try
if not UnCompressBzStream(InS, OutS, @Err) then
ShowMEssage('Decompression failed: ', Err);
finally
OutS.Free;
end;
finally
InS.Free;
end;