function IstRAWFormat(const Buf: TBytes):Boolean; overload;
const
cRawHeader: TArray<TBytes>
= [
[$49,$49,$1A,$00,$00,$00,$48,$45,$41,$50,$43,$43,$44,$52,$02,$00], // Canon, veraltet
[$49,$49,$2A,$00,$10,$00,$00,$00,$43,$52], // Canon
[$49,$49,$2A,$00], // Sony, auch SR2 (Sony), 3FR (Hasselblad), IIQ (PhaseOne)
[$49,$49,$55,$00,$18,$00,$00,$00,$88,$E7,$74,$D8,$F8,$25,$1D,$4D], // Panasonic
[$4D,$4D,$00,$2A,$00,$00,$00,$08,$00], // Nikon
[$49,$49,$52], // Olympus
[$4D,$4D,$00,$2A,$00], // Pentax
[$46,$55,$4A,$49,$46,$49,$4C,$4D,$43,$43,$44,$2D,$52,$41,$57,$20], // Fujifilm
[$49,$49,$55,$00], // Leica
[$4D,$4D,$00,$2A,$00,$00,$00,$08,$00,$06,$01,$0F,$00,$02,$00,$00], // Samsung
[$46,$4F,$56,$62], // Sigma
// veraltet
[$44,$53,$43,$2D,$49,$6D,$61,$67,$65], // Kodak, veraltet
[$43,$6F,$6D,$70,$75,$63,$6F,$6E,$20,$45,$4F,$53,$20,$44,$65,$73], // Epson, veraltet
[$4D,$4D,$00,$2A], // Hasselblad, veraltet
[$4D,$52,$00,$00,$00,$00,$00,$00,$00,$00,$1C,$0E], // Mamiya, veraltet
[$00,$4D,$52,$4D], // Minolta, veraltet
[$4E,$4F,$4B,$49,$41,$52,$41,$57], // Nokia, veraltet
[$4C,$53] // Sony, veraltet, DSC-F828 von 2004
];
var
rawHeader: TBytes;
begin
for rawHeader in cRawHeader do begin
if CompareMem(@rawHeader[0], @Buf[0], Length(rawHeader)) then Exit(true);
end;
Result := false;
end;
function IstRAWFormat(Stream: TStream):Boolean; overload;
var
buf: TBytes;
savePos: Int64;
begin
SetLength(buf, 20);
savePos := Stream.Position;
try
Stream.ReadData(buf, Length(buf));
finally
Stream.Position := savePos;
end;
Result := IstRAWFormat(buf);
end;
function IstRAWFormat(const Dateiname: string):Boolean; overload;
var
stream: TFileStream;
begin
stream := TFileStream.Create(Dateiname, fmOpenRead);
try
result := IstRAWFormat(stream);
finally
stream.Free;
end;
end;