算了,还是贴出来。
procedure TFMPPlayer.CapturePic(FileName: String);
var
PicSize: DWORD;
Buffer: Pointer;
BMP: TBitmap;
TempStream: TMemoryStream;
begin
if FStreamID <= 0 then
Exit;
Pause;
try
PicSize := FMPCapture(FStreamID, FMPF_PIC_DIB24, 0);
if PicSize > 0 then
begin
GetMem(Buffer, PicSize);
try
if FMPCapture(FStreamID, FMPF_PIC_DIB24, DWORD(Buffer)) = 0 then
begin
TempStream := TMemoryStream.Create;
TempStream.WriteBuffer(Buffer^, PicSize);
TempStream.Position := 0;
try
BMP := TBitmap.Create;
try
BMP.LoadFromStream(TempStream);
BMP.SaveToFile(FileName);
finally
BMP.Free;
end;
finally
TempStream.Free;
end;
end;
finally
FreeMem(Buffer);
end;
end;
finally
Play;
end;
end;