DVD我用缓冲区模式播放的。VCD我用基本模式播放的。
function TFMPVideo.Play(FileName: string): Boolean;
var
FMPOpenStruct : TFMP_OPEN_STRUCT;
begin
FFileName:= FileName;
if FileExists(FFileName) then
// 如果文件存在
begin
if not Active then
SetActive(True);
// 如果没有激活设备则激活它!
if DriverHandle <> 0 then
begin
// 设备打开
Stop;
// 关闭已打开的媒体流
if FBufMode then
// 如果是缓冲区模式
begin
FillChar(FMPOpenStruct, SizeOf(TFMP_OPEN_STRUCT), 0);
FMPOpenStruct.lpFileName:= PChar(FileName);
FMPOpenStruct.dwCallBack:= DWORD(@CallBackProc);
FMPEGStream:= FMPOpen(FMPF_BUFFERS, DWord(@FMPOpenStruct));
end
else
begin
FMPOpenStruct.dwCallBack:= 0;
FMPEGStream:= FMPOpen(FMPF_FILE , DWord(PChar(FileName)));
end;
end;
end;
Result:= FMPEGStream <> 0;
if Result then
// 打开播放流
begin
FSize:= FMPGet(FMPEGStream, FMPI_STM_FILESIZE);
FMPSet (FMPEGStream, FMPI_VID_KEY_MODE, FMPF_KEY_VGA);// set video keying mode
FMPSet (FMPEGStream, FMPI_VID_KEY_COL, 0);
// set video keying color
FMPPlay(FMPEGStream, FMPF_POS_END or FMPF_END_STOP, 0);
FMPSet (FMPEGStream, FMPI_VID_SATURATION, FContrast);
FMPSet (FMPEGStream, FMPI_VID_CONTRAST, FBrightness);
FMPSet (FMPEGStream, FMPI_VID_BRIGHTNESS, FSaturation);
if isZeroVolume then
FMPSet (FMPEGStream, FMPI_AUD_VOLUME, 0)
else
FMPSet (FMPEGStream, FMPI_AUD_VOLUME, FRightVolume shl 16 + FLeftVolume);
FisPause:= False;
end;
end;