我抄的!!!!!!!!!!!!!!!!
unit FMPdefs;
interface
uses Windows, mmSystem;
{------------------------- FMP Commands ---------------------}
const FMP_OPEN = $01;
const FMP_CLOSE = $02;
const FMP_PLAY = $03;
const FMP_PAUSE = $04;
const FMP_STOP = $05;
const FMP_SEEK = $06;
const FMP_STEP = $07;
const FMP_GROUP = $08;
const FMP_SET = $09;
const FMP_GET = $0A;
const FMP_CALLBACK = $0B;
const FMP_SIGNAL = $0C;
const FMP_UNLOAD = $0D;
const FMP_INIT = $0E;
const FMP_CAPTURE = $0F;
const FMP_UPDATE = $10;
const FMP_FREEZE = $12;
{------------------------- FMP Errors ---------------------}
const FMPE_DOS = $0100;
const FMPE_INVALID_FLAGS = $0200;
const FMPE_HANDLE = $0300;
const FMPE_NOT_IMPLEMENT = $0400;
const FMPE_INVALID_CMD = $0500;
const FMPE_OUT_OF_MEM = $0600;
const FMPE_INDEX = $0700;
const FMPE_TYPE = $0800;
const FMPE_WRITE = $0900;
const FMPE_TOO_MANY = $0A00;
const FMPE_ITEM_INDEX = $0B00;
const FMPE_ITEM_HANDLE = $0C00;
const FMPE_ERROR = $0D00;
const FMPE_STREAM_DATA = $0E00;
const FMPE_NOT_CDXA_DRV = $0F00;
const FMPE_HARDWARE = $1000;
const FMPE_NA = $1100;
const FMPE_VALUE = $1200;
const FMPE_TIME_FMT = $1300;
const FMPE_NOT_READY = $1400;
const FMPE_POS = $1500;
const FMPE_REFUSE = $1600;
const FMPE_INVALID_INDEX = $1700;
{------------------------- FMP Messages ---------------------}
const FMPM_BUF_POS = $01;
const FMPM_BUF_EMPTY = $02;
const FMPM_BUF_SEEK = $03;
const FMPM_BUF_CREATE = $04;
const FMPM_BUF_CLOSE = $05;
const FMPM_BUF_TOTALSIZE = $06;
const FMPM_COMPLETED = $07;
const FMPM_CANCELED = $08;
const FMPM_ERROR = $09;
const FMPM_MEM_ALLOC = $0A;
const FMPM_MEM_FREE = $0B;
const FMPM_SIGNAL = $0C;
const FMPM_FIFO_START = $0D;
const FMPM_FIFO_LOW = $0E;
const FMPM_FIFO_HIGH = $0F;
const FMPM_FIFO_DROP = $10;
const FMPM_PUSH_READ = $11;
const FMPM_PUSH_SEEK = $12;
const FMPM_PUSH_CREATE = $13;
{------------------------- FMP Flags ---------------------}
const FMPF_BUF_LOW = $00000000;
const FMPF_BUF_EMS = $00010000;
const FMPF_BUF_XMS = $00020000;
const FMPF_PASCAL = $1000;
const FMPF_C = $2000;
const FMPF_TEST = $8000;
const FMPF_INSERT = $0001;
const FMPF_REMOVE = $0002;
const FMPF_GET = $0003;
const FMPF_SELECT = $0004;
const FMPF_UNSELECT = $0005;
const FMPF_HANDLE = $0000;
const FMPF_INDEX = $0020;
const FMPF_FILE = $0001;
const FMPF_BUFFERS = $0002;
const FMPF_GROUP = $0003;
const FMPF_BROADCAST = $0004;
const FMPF_EXTEND = $0010;
const FMPF_NOACCESS = $0100;
const FMPF_UNKNOWN = $0000;
const FMPF_AUDIO = $0001;
const FMPF_VIDEO = $0002;
const FMPF_POS_START = $0100;
const FMPF_POS_SET = $0200;
const FMPF_POS_END = $0300;
const FMPF_POS_CUR = $0400;
const FMPF_DONT_UPDATE = $1000;
const FMPF_UPDATE_ALL = $2000;
const FMPF_SIG_AT = $0001;
const FMPF_SIG_EVERY = $0002;
const FMPF_SIG_REMOVE = $0003;
const FMPF_SIG_REMOVE_AT = $0004;
const FMPF_SIG_REMOVE_ALL = $0005;
const FMPE_HRD = $2000;
const FMPE_HRD_NO_DMA = $2100;
const FMPE_HRD_NO_INT = $2200;
const FMPE_HRD_NO_PORT = $2300;
const FMPE_HRD_NOT_FOUND = $2400;
const FMPE_HRD_DONT_USE = $2500;
const FMPF_END_STOP = $0000;
const FMPF_END_PAUSE = $0001;
const FMPF_END_KEEP = $0002;
const FMPF_END_REPEAT = $0004;
const FMPF_END_CLOSE = $0005;
const FMPF_PAUSED = $0001;
const FMPF_STOPPED = $0002;
const FMPF_PLAYING = $0004;
const FMPF_SEEKING = $0008;
const FMPF_STEPPING = $0010;
const FMPF_CLOSED = $0020;
const FMPF_READY = (FMPF_PAUSED or FMPF_STOPPED);
const FMPF_BYTES = $0001;
const FMPF_SAMPLES = $0002;
const FMPF_MSEC = $0003;
const FMPF_HMSF = $0004;
const FMPF_HMSC = $0005;
const FMPF_FRAMES = FMPF_SAMPLES;
const FMPF_TIME = FMPF_HMSC;
const FMPF_SMPTE = FMPF_HMSF;
const FMPF_BUF_32_BITS = $0001;
const FMPF_BUF_LOOP = $0002;
const FMPF_VID_UNKNOWN = $0000;
const FMPF_VID_MPEG = $0001;
const FMPF_VID_AVI = $0002;
const FMPF_VID_MPEG2 = $0004;
const FMPF_ALL_VGA = $0001;
const FMPF_ALL_VID = $0002;
const FMPF_KEY_VGA = $0004;
const FMPF_KEY_VID = $0008;
const FMPF_KEY_MIX = $000C;
const FMPF_KEY_CALIBRATE = $000D;
const FMPF_AUD_UNKNOWN = $0000;
const FMPF_AUD_MPEG = $0001;
const FMPF_AUD_MPEG_L1 = $0002;
const FMPF_AUD_MPEG_L2 = $0004;
const FMPF_AUD_MPEG_L3 = $0008;
const FMPF_AUD_MPEG2 = $0010;
const FMPF_AUD_MPEG2_L1 = $0020;
const FMPF_AUD_MPEG2_L2 = $0040;
const FMPF_AUD_MPEG2_L3 = $0080;
const FMPF_AUD_DOLBY_AC3 = $0100;
const FMPF_AUD_WAVE = $0010;
const FMPF_AUD_VOC = $0020;
const FMPF_AUD_PCM = $0040;
const FMPF_AUD_ADPCM = $0080;
const FMPF_AUD_STEREO = $0001;
const FMPF_AUD_JSTEREO = $0002;
const FMPF_AUD_DUAL = $0003;
const FMPF_AUD_SINGLE = $0004;
const FMPF_AUD_11 = $0000;
const FMPF_AUD_10 = $0001;
const FMPF_AUD_20 = $0002;
const FMPF_AUD_30 = $0003;
const FMPF_AUD_21 = $0004;
const FMPF_AUD_31 = $0005;
const FMPF_AUD_22 = $0006;
const FMPF_AUD_32 = $0007;
const FMPF_AUD_NO_EMPH = $0001;
const FMPF_AUD_EMPH_50 = $0002;
const FMPF_AUD_EMPH_J17 = $0003;
const FMPF_AUD_COPYRIGHT = $0001;
const FMPF_AUD_ORIGINAL = $0002;
const FMPF_GRP_UNKNOWN = $0000;
const FMPF_GRP_MPEG = $0001;
const FMPF_GRP_AVI = $0002;
const FMPF_GRP_CUSTOM = $0004;
const FMPF_GRP_MPEG2_PROGRAM = $0008;
const FMPF_GRP_MPEG2_TRANSPORT = $0010;
const FMPF_PIC_BMP = $0001;
const FMPF_PIC_DIB24 = $0002;
const FMPF_PIC_TOFILE = $0004;
const FMPF_REFUSE = $0001;
const FMPF_IGNORE = $0002;
{------------------------- FMP Index ---------------------}
const FMPI_DRV_PRODUCT = $0101;
const FMPI_DRV_VERSION = $0102;
const FMPI_DRV_MAX_CHAN = $0103;
const FMPI_DRV_VID_SUP = $0104;
const FMPI_DRV_AUD_SUP = $0105;
const FMPI_DRV_GRP_SUP = $0106;
const FMPI_DRV_HDR_STAT = $0107;
const FMPI_DRV_MEMORY = $0108;
const FMPI_DRV_ID = $0109;
const FMPI_DRV_CAPABILITY = $010A;
const FMPI_STM_TYPE = $0202;
const FMPI_STM_SOURCE = $0203;
const FMPI_STM_MODE = $0204;
const FMPI_STM_TIME_FMT = $0205;
const FMPI_STM_POSITION = $0206;
const FMPI_STM_SPEED = $0207;
const FMPI_STM_USER = $0208;
const FMPI_STM_SIZE = $0209;
const FMPI_STM_SLIDE = $020A;
const FMPI_STM_PASSWD = $0210;
const FMPI_STM_FILETYPE = $0211;
const FMPI_STM_MEMFLAGS = $0212;
const FMPI_STM_FILESIZE = $0213;
const FMPI_STM_FILEORG = $0214;
const FMPI_STM_BIT_RATE = $0215;
const FMPI_STM_NOCACHE = $0216;
const FMPI_BUF_LEFT = $0301;
const FMPI_BUF_POS = $0302;
const FMPI_BUF_ADDRESS = $0303;
const FMPI_BUF_SIZE = $0304;
const FMPI_BUF_MODE = $0305;
const FMPI_BUF_TOTALSIZE = $0306;
const FMPI_VID_TYPE = $0401;
const FMPI_VID_RATE = $0402;
const FMPI_VID_SIZE = $0403;
const FMPI_VID_ASPECT = $0404;
const FMPI_VID_BIT_RATE = $0405;
const FMPI_VID_SRC_POS = $0406;
const FMPI_VID_SRC_SIZE = $0407;
const FMPI_VID_DEST_POS = $0408;
const FMPI_VID_DEST_SIZE = $0409;
const FMPI_VID_KEY_MIN = $040A;
const FMPI_VID_KEY_MAX = $040B;
const FMPI_VID_KEY_MASK = $040C;
const FMPI_VID_KEY_COL = $040D;
const FMPI_VID_KEY_MODE = $040E;
const FMPI_VID_KEY_TYPE = $040F;
const FMPI_VID_CONTRAST = $0410;
const FMPI_VID_BRIGHTNESS = $0411;
const FMPI_VID_SATURATION = $0412;
const FMPI_VID_SLIDE = $0420;
const FMPI_VID_HWND = $0413;
const FMPI_VID_KEY_COL_INDEX = $0414;
const FMPI_VID_TV = $041b;
const FMPI_VID_DEFAULTS = $1000;
const FMPI_VID_REGISTRY = $2000;
const FMPI_AUD_TYPE = $0501;
const FMPI_AUD_RATE = $0502;
const FMPI_AUD_VOLUME = $0503;
const FMPI_AUD_BIT_RATE = $0504;
const FMPI_AUD_TREBLE = $0505;
const FMPI_AUD_BASS = $0506;
const FMPI_AUD_CHANNELS = $0507;
const FMPI_AUD_EMPH = $0508;
const FMPI_AUD_RIGHTS = $0509;
const FMPI_AUD_SHIFT = $0510;
const FMPI_AUD_BAL_L = $0511;
const FMPI_AUD_BAL_R = $0512;
const FMPI_AUD_DEFAULTS = $1000;
const FMPI_AUD_REGISTRY = $2000;
const FMPI_GRP_TYPE = $0601;
const FMPI_GRP_NB = $0602;
const FMPI_FIFO_FCNTRL = $0701;
const FMPI_FIFO_SIZE = $0702;
const FMPI_FIFO_MAX = $0703;
const FMPI_FIFO_VID_SIZE = $0704;
const FMPI_FIFO_AUD_SIZE = $0705;
const FMPI_FIFO_START = $0706;
const FMPI_FIFO_LOW = $0707;
const FMPI_FIFO_HIGH = $0708;
const FMPI_FIFO_DROP = $0709;
const FMPI_FIFO_UNIT = $070A;
const FMPI_PUSH_ASYNC = $0801;
const FMPI_PUSH_SYNC = $0802;
const FMPI_OVLY_XOFFSET = $0901;
const FMPI_OVLY_YOFFSET = $0902;
const FMPI_OVLY_VGACORRECTION = $0903;
const FMPI_OVLY_STABILITY = $0904;
const FMPI_OVLY_HFREQUENCY = $0905;
const FMPI_OVLY_USEDEFAULTFREQ = $0906;
const FMPI_OVLY_COLOR_SETTING = $0907;
const FMPI_OVLY_LOWERLEVEL = $0908;
const FMPI_OVLY_UPPERLEVEL = $0909;
const FMPI_OVLY_DELTA_CALIBRATE = $090A;
const FMPI_OVLY_COLOR_CALIBRATION = $090B;
const FMPI_OVLY_DEFAULTS = $1000;
const FMPI_OVLY_REGISTRY = $2000;
const FMPI_UPD_PALETTE = $0001;
const FMPI_UPD_VGA_MODE = $0007;
const FMPI_UPD_FRAME_POS = $0008;
const FMPI_UPD_FRAME_SIZE = $0009;
const FMP_MIN_AUD_VOLUME = 0;
const FMP_MAX_AUD_VOLUME = 100;
const FMP_DEF_AUD_VOLUME = 50;
const FMP_MIN_BSC = 0;
const FMP_MAX_BSC = 1000;
const FMP_DEF_BSC = 500;
const FMP_CAPABILITY_BORDER_ADJUST = $0001;
const FMP_CAPABILITY_KEYCOLOR_ADJUST = $0002;
const FMP_CAPABILITY_BSC_ADJUST = $0004;
const FMP_MIN_COLOR_LEVEL = $00000000;
const FMP_MEDIUM_COLOR_LEVEL = $00808080;
const FMP_MAX_COLOR_LEVEL = $00FFFFFF;
const FMP_MEDIUM_COLOR = $80;
const FMP_LOWER_RED = $01;
const FMP_LOWER_GREEN = $02;
const FMP_LOWER_BLUE = $04;
const FMP_UPPER_RED = $10;
const FMP_UPPER_GREEN = $20;
const FMP_UPPER_BLUE = $40;
const SET_VGA = 1;
const SET_TV = 0;
const MAXFILENAME = 256;
// maximum length of file pathname
const MAXCUSTFILTER = 40;
// maximum size of custom filter buffer
const MAX_BUF_SIZE = 40960;
// maximum buffer size (< 65534)(multiple of 1024)
const MAX_BUF_NUMBER = 20;
// maximum number of buffers to use
{------------------------- FMP Structures ---------------------}
Type
COLORREF = DWORD;
Type
PFMP_OPEN_STRUCT = ^TFMP_OPEN_STRUCT;
TFMP_OPEN_STRUCT = record
lpFileName: LPTSTR;
dwCallBack: DWORD;
Reserved : array[0..7] of Byte;
end;
PFMP_PUSH_STRUCT = ^TFMP_PUSH_STRUCT;
TFMP_PUSH_STRUCT = record
dwSize : DWORD;
lpBuffer: Pointer;
end;
PBuffer = ^Byte;
PBuf= ^TBuf;
TBuffer = array[0..MAX_BUF_NUMBER - 1] of PBuffer;
TBuf = record
hFile : THandle;
dwSize: DWORD;
wIndex: WORD;
Buffer: TBuffer;
BufferIndex: array[0..MAX_BUF_NUMBER- 1] of DWord;
end;
PFMP_COLOR_SETTING_STRUCT = ^FMP_COLOR_SETTING_STRUCT;
FMP_COLOR_SETTING_STRUCT = record
RGBColorKey: COLORREF;
RGBUpper : COLORREF;
RGBLower : COLORREF;
Mask : Short;
end;
var
hReelDrv: HDRVR;
// RealMagic Driver Handle
function FMPOpenDriver: integer;
procedure FMPCloseDriver;
function FMPCommand(Command: Byte;
hMPEGStream: Byte;
Flags: WORD;
Value: DWORD)
WORD;
function FMPGetLastError(a: Word): DWORD;
function FMPOpen(Flags: WORD;
Filename: DWORD): DWORD;
function FMPClose(hStream: Byte)
WORD;
function FMPSet(hStream: Byte;
Index: WORD;
Value: DWORD): DWORD;
function FMPGet(hStream: Byte;
Index: WORD)
WORD;
function FMPPlay(hStream: Byte;
Flags: WORD;
Position: DWORD): DWORD;
function FMPStep(hStream: Byte;
Flags: WORD;
Position: DWORD): DWORD;
function FMPCapture(hStream: Byte;
Index: WORD;
Position: DWORD): DWORD;
function FMPSeek(hStream: Byte;
Flags: WORD;
Position: DWORD): DWORD;
function FMPSignal(hStream: Byte;
Flags: WORD;
Position: DWORD): DWORD;
function FMPPause(hStream: Byte)
WORD;
function FMPStop(hStream: Byte)
WORD;
function FMPGroup(hStream: Byte;
Flags: WORD;
Value: DWORD): DWORD;
function FMPCallback(hStream: Byte;
Value: DWORD): DWORD;
function FMPFreeze(hStream: Byte;
Flags: WORD;
Value: DWORD): DWORD;
implementation
{--------------------------------------------------------------
* FUNCTION : FMPOpenDriver()
* DESCRIPTION : Opens IMPEG32.DLL
* RETURN : non-zero if successful, 0 if failed.
---------------------------------------------------------------}
function FMPOpenDriver: integer;
const
szDriverName = 'reeldrv';
szSectionName = 'Drivers32';
begin
hReelDrv:= OpenDriver(szDriverName, szSectionName, 0);
Result := hReelDrv;
end;
{--------------------------------------------------------------
* procedure : FMPCloseDriver()
* DESCRIPTION : Closes IMPEG32.DLL
* RETURN : NONE
---------------------------------------------------------------}
procedure FMPCloseDriver;
begin
CloseDriver(hReelDrv,0,0);
hReelDrv:= 0;
end;
{--------------------------------------------------------------
* FUNCTION : FMPCommand()
* DESCRIPTION : This function interfaces with the FMP MPEG support driver
* and sends out the requested command.
* RETURN : value from SendDriverMessage
------------------------------------------------------------------}
function FMPCommand(Command: Byte;
hMPEGStream: Byte;
Flags: WORD;
Value: DWORD)
WORD;
begin
Result:= SendDriverMessage(hReelDrv,DRV_USER+1,
MakeLParam(MakeWord(Command,hMPEGStream),Flags),Value);
end;
{-----------------------------------------------------------------
* FUNCTION : FMPGetLastError()
* DESCRIPTION : Returns last command error code.
* RETURN : last REALmagic command error code
------------------------------------------------------------------}
function FMPGetLastError(a: Word): DWORD;
begin
Result:= SendDriverMessage(hReelDrv, DRV_USER + 2, a, 0);
end;
function FMPOpen(Flags: WORD;
Filename: DWORD): DWORD;
begin
Result:= FMPCommand(FMP_OPEN, 0, Flags, Filename);
end;
function FMPClose(hStream: Byte)
WORD;
begin
Result:= FMPCommand(FMP_CLOSE, hStream, 0, 0)
end;
function FMPSet(hStream: Byte;
Index: WORD;
Value: DWORD): DWORD;
begin
Result:= FMPCommand(FMP_SET, hStream, Index, Value);
end;
function FMPGet(hStream: Byte;
Index: WORD)
WORD;
begin
Result:= FMPCommand(FMP_GET, hStream, Index, 0);
end;
function FMPPlay(hStream: Byte;
Flags: WORD;
Position: DWORD): DWORD;
begin
Result:= FMPCommand(FMP_PLAY, hStream, Flags, Position);
end;
function FMPStep(hStream: Byte;
Flags: WORD;
Position: DWORD): DWORD;
begin
Result:= FMPCommand(FMP_STEP, hStream, Flags, Position);
end;
function FMPCapture(hStream: Byte;
Index: WORD;
Position: DWORD): DWORD;
begin
Result:= FMPCommand(FMP_CAPTURE, hStream, Index, Position);
end;
function FMPSeek(hStream: Byte;
Flags: WORD;
Position: DWORD): DWORD;
begin
Result:= FMPCommand(FMP_SEEK, hStream, Flags, Position);
end;
function FMPSignal(hStream: Byte;
Flags: WORD;
Position: DWORD): DWORD;
begin
Result:= FMPCommand(FMP_SIGNAL, hStream, Flags, Position);
end;
function FMPPause(hStream: Byte)
WORD;
begin
Result:= FMPCommand(FMP_PAUSE, hStream, 0, 0);
end;
function FMPStop(hStream: Byte)
WORD;
begin
Result:= FMPCommand(FMP_STOP, hStream, 0, 0);
end;
function FMPGroup(hStream: Byte;
Flags: WORD;
Value: DWORD): DWORD;
begin
Result:= FMPCommand(FMP_GROUP, hStream, Flags, Value);
end;
function FMPCallback(hStream: Byte;
Value: DWORD): DWORD;
begin
Result:= FMPCommand(FMP_CALLBACK, hStream, FMPF_PASCAL, Value);
end;
function FMPFreeze(hStream: Byte;
Flags: WORD;
Value: DWORD): DWORD;
begin
Result:= FMPCommand(FMP_FREEZE, hStream, Flags, Value);
end;
end.
我抄的!!!!!!!!!!!!!!!!