www.pudn.com > delphi-Sdk3000-ocx.zip > sdk3000.pas, change:2005-05-20,size:13401b


(* 
 
  FILE:    sdk3000.pas 
  CREATE:  CUIY [2005-05-07] 
  DISC: 
   天敏 10MOONS SDK3000 视频卡SDK delphi接口 
   sdk3000_7130.dll 
 
  MODIFY: 
 
  MEMO: 
  转完后要检查指针,字符串的调用使用情况。 
 
*) 
 
unit sdk3000; 
 
interface 
uses Windows; 
 
const 
  DLL_SDK3000 = 'sdk3000_7130.dll'; 
 
  BrightnessDefault: DWORD = $80; 
  ContrastDefault:   DWORD = $44; 
  SaturationDefault: DWORD = $40; 
  HueDefault       : DWORD = $00; 
  SharpnessDefault : DWORD = $00; 
 
 
  MIN_VAMP_BRIGHTNESS_UNITS   = 0; 
  MAX_VAMP_BRIGHTNESS_UNITS   = 255; 
 
  MIN_VAMP_CONTRAST_UNITS     = -128; 
  MAX_VAMP_CONTRAST_UNITS     = 127; 
 
  MIN_VAMP_HUE_UNITS          = -128; 
  MAX_VAMP_HUE_UNITS          = 127; 
 
  MIN_VAMP_SATURATION_UNITS   = -128; 
  MAX_VAMP_SATURATION_UNITS   = 127; 
 
  MIN_VAMP_SHARPNESS_UNITS    = -8; 
  MAX_VAMP_SHARPNESS_UNITS    = 7; 
 
   
type 
 
VCBOOL = Integer; 
 
enImageType = 
( 
  IMAGE_BMP = 1,  //BMP文件格式 
  IMAGE_JPG = 2   //JPG文件格式 
); 
 
//输入视频源端口 
VIDEOSOURCE = 
( 
  VIDEO_IN_1 = 0, //AV视频源1 
  VIDEO_IN_2 = 1, //AV视频源2 
  VIDEO_IN_3 = 2, //AV视频源3 
  VIDEO_IN_4 = 3, //AV视频源4 
  SVIDEO_IN  = 4  //SVIDEO视频源 
); 
 
//视频处理属性 
VideoProcAmpProperty = 
( 
  VideoProcAmp_Brightness             = 0, 
  VideoProcAmp_Contrast               = 1, 
  VideoProcAmp_Hue                    = 2, 
  VideoProcAmp_Saturation             = 3, 
  VideoProcAmp_Sharpness              = 4, 
  VideoProcAmp_Gamma                  = 5, 
  VideoProcAmp_ColorEnable            = 6, 
  VideoProcAmp_WhiteBalance           = 7, 
  VideoProcAmp_BacklightCompensation  = 8, 
  VideoProcAmp_Gain                   = 9 
); 
 
//视频属性 
VideoProperty = 
( 
  VideoProperty_Brightness                    = 0,        //亮度 
  VideoProperty_Contrast                      = 1,        //对比度 
  VideoProperty_Hue                           = 2,        //色度 
  VideoProperty_Saturation                    = 3,        //饱和度 
  VideoProperty_Sharpness                     = 4, 
  VideoProperty_Gamma                         = 5,        //Gamma校验 
  VideoProperty_ColorEnable                   = 6, 
  VideoProperty_WhiteBalance                  = 7,        //白平衡 
  VideoProperty_BacklightCompensation         = 8, 
  VideoProperty_Gain                          = 9 
); 
 
//SDK3000属性页 
PropertyDialog = 
( 
  PropertyDlg_VideoCaptureFilter      = 0,    //SDK3000视频设备属性页 
  PropertyDlg_VideoCapturePin         = 1,    //SDK3000视频设备输出引脚属性页 
  PropertyDlg_VideoCrossbar           = 2,    //Video Crossbar属性页 
  PropertyDlg_DeinterlaceFilter       = 3,    //Deinterlace设备属性页 
  PropertyDlg_DeinterlaceCapturePin   = 4,    //Deinterlace设备捕获引脚属性页 
  PropertyDlg_DeinterlacePreviewPin   = 5     //Deinterlace设备预览引脚属性页 
); 
 
//视频运行状态 
PGRAPH_STATE = ^GRAPH_STATE; 
GRAPH_STATE= 
( 
  STATE_STOP  = 0, 
  STATE_RUN   = 1, 
  STATE_PAUSE = 2 
); 
 
//视频格式 
//VideoSubType_YUY2格式支持SDK3000所有功能。 
//视频制式除VideoSubType_YUY2外,只能支持视频原始回调方式。 
VideoSubType = 
( 
  VideoSubType_None   = -1, 
  VideoSubType_RGB555 = 0, 
  VideoSubType_RGB24  = 1, 
  VideoSubType_YUY2   = 2, 
  VideoSubType_RGB8   = 3, 
  VideoSubType_RGB32  = 4 
); 
 
//视频制式 
PVideoStandard = ^VideoStandard; 
VideoStandard = 
( 
  VideoStandard_None      = $00000000, 
  VideoStandard_NTSC_M    = $00000001, 
  VideoStandard_NTSC_M_J  = $00000002, 
  VideoStandard_NTSC_433  = $00000004, 
  VideoStandard_PAL_B     = $00000010, 
  VideoStandard_PAL_D     = $00000020, 
  VideoStandard_PAL_H     = $00000080, 
  VideoStandard_PAL_I     = $00000100, 
  VideoStandard_PAL_M     = $00000200, 
  VideoStandard_PAL_N     = $00000400, 
  VideoStandard_PAL_60    = $00000800, 
  VideoStandard_SECAM_B   = $00001000, 
  VideoStandard_SECAM_D   = $00002000, 
  VideoStandard_SECAM_G   = $00004000, 
  VideoStandard_SECAM_H   = $00008000, 
  VideoStandard_SECAM_K   = $00010000, 
  VideoStandard_SECAM_K1  = $00020000, 
  VideoStandard_SECAM_L   = $00040000, 
  VideoStandard_SECAM_L1  = $00080000 
); 
 
//场类型 
VideoFieldType = 
( 
  Even_Field       = 0, //偶场 
  Odd_Field        = 1, //奇场 
  Odd_Even_Field   = 2, //奇场、偶场 
  Interlaced_Field = 3  //复合场 
); 
 
//视频叠加参数 
POSDPARAM = ^OSDPARAM; 
OSDPARAM = record 
  cfHeight    : Integer;              //字符高度 
  cfWidth     : Integer;              //字符宽度 
  cfWeight    : Integer;              //字符粗细 
  cfSpacing   : Integer;              //字符间距 
  cfItalic    : LongBool;              //斜体 
  cfUnderline : LongBool;              //下划线 
  cfStrikeOut : LongBool;              //删除线 
  cfBkColor   : COLORREF;             //背景色 
  cfTextColor : COLORREF;             //前景色 
  cfFaceName  : Array[0..31] of Char; //字体名  TCHAR[32] 
end; 
 
//视频属性范围 
PVIDEOPROPERTYRANGE = ^VIDEOPROPERTYRANGE; 
VIDEOPROPERTYRANGE = record 
  nValue      : Integer;  //当前值 
  nMin        : Integer;  //最小值 
  nMax        : Integer;  //最大值 
  nStepDelta  : Integer;  //最小步进值 
  nDefault    : Integer;  //默认值 
  nCapsFlags  : Integer;  //风格 
end; 
 
//视频流信息 
PVIDEOSTREAMINFO = ^VIDEOSTREAMINFO; 
VIDEOSTREAMINFO = record 
  subtype         : VideoSubType;     //视频格式 
  rcSource        : TRect;            //视频源范围 
  rcTarget        : TRect;            //目标视频范围 
  dwBitRate       : DWORD;            //比特率 
  dwBitErrorRate  : DWORD;            //比特错误率 
  AvgTimePerFrame : Int64;            //帧率 
  bmiHeader       : BITMAPINFOHEADER; //宽、高、颜色位率等 
end; 
 
//视频源输入频率 
PeFieldFrequency = ^eFieldFrequency; 
eFieldFrequency= 
(          //@enum Field frequency 
  FIELD_FREQ_50HZ = 0,        //@emem source is 50 Hz (PAL) 
  FIELD_FREQ_60HZ = 1,        //@emem source is 60 Hz (NTSC) 
  FIELD_FREQ_0HZ  = 2         //@emem source is 0 Hz  (NO SIGNL) 
); 
 
 
//---- call back functions define 
  // 动态检测回调 
  TPrcCbMotionDetect = procedure (nCardID: Integer; bMove: VCBOOL; pContext: pointer); stdcall; 
 
  // 捕获原始流回调 
  TPrcCapSourceStream = procedure (nCardID: Integer; pBuf: PByte; nWidth: Integer; nHeight: Integer; nBitCount: Integer); stdcall; 
 
  // IO报警回调 
  TPrcIoAlertCallBack = procedure (nCardID: Integer); stdcall; 
 
  //pic回调(?) 
  TPrcPicMessage = procedure( lnCardID: Integer; pBuf: PByte; lnWidth: Integer; lnHeight: Integer); 
 
  // 初始化SDK 
  function VCAInitSdk(): HRESULT; stdcall; external DLL_SDK3000; 
 
 
  // 释放SDK资源 
  procedure VCAUnInitSdk(); stdcall; external DLL_SDK3000; 
 
  // 得到设备总数 
  function VCAGetDevNum(var nDev: Integer): HRESULT; stdcall; external DLL_SDK3000; 
 
 
  //连接设备 
  function VCAConnectDevice( nCards: Integer; bOverlay: VCBOOL; hParentWnd: HWND; var szVidSize: Size; 
  enVideoSource: VIDEOSOURCE; nFrameRate: Integer =25; enVideoSubType: VideoSubType =VideoSubType_YUY2) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //断开设备 
  function VCADisConnectDevice(nCards: Integer): HRESULT; stdcall; external DLL_SDK3000; 
 
  //设置捕获文件名 
  function VCASetCaptureFile(nCards: Integer; const szFileName: PChar): HRESULT; stdcall; external DLL_SDK3000; 
 
  //开始捕获 
  function VCAStartCapture(nCards: Integer): HRESULT; stdcall; external DLL_SDK3000; 
 
  //停止捕获 
  function VCAStopCapture(nCards: Integer): HRESULT; stdcall; external DLL_SDK3000; 
 
  //是否正在捕获 
  function VCAIsCapturing(nCards: Integer; var bIsCapturing: VCBOOL): HRESULT; stdcall; external DLL_SDK3000; 
 
  //设置视频在显示窗口中的区域 
  function VCASetWindowPos(nCards: Integer; rc: TRect): HRESULT; stdcall; external DLL_SDK3000; 
 
  //设置动态检测 
  function VCAEnableMotionDetect(nCards: Integer; bEnaDetect: VCBOOL; pAreaMap: PByte; 
  nSizeOfMap: Integer; nPersistTime: Integer; lpContext: pointer; OnObjectMove: TPrcCbMotionDetect) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //抓图 
  function VCACapturePicture(nCards: Integer; const szFileName: PChar; enImgType: enImageType; rcImg: PRect; 
  nQuality: Integer; nCapCount: Integer; bCapFast: VCBOOL): HRESULT; stdcall; external DLL_SDK3000; 
 
  //切换视频源 
  function VCASwitchVideoSource(nCards: Integer; enVideoSource: VIDEOSOURCE; bFast: VCBOOL =1 ) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //设置视频属性 
  function VCASetVideoPropertyValue(nCards: Integer; eVideoProperty: VideoProperty; value: Integer) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //得到视频属性 
  function VCAGetVideoPropertyValue(nCards: Integer; eVideoProperty: VideoProperty; var pVPR: VIDEOPROPERTYRANGE) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //IO输出 
  function VCAIOAlertOut(nCards: Integer; bHighLevel: VCBOOL) 
    : HRESULT; stdcall; external DLL_SDK3000; 
 
  //初始化IO输入 
  function VCAInitIOAlertIn(nCards: Integer; ppCall: TPrcIoAlertCallBack) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //开始等待IO输入 
  function VCAStartIOAlertIn(nCards: Integer; bHigh: VCBOOL) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //停止等待IO输入 
  function VCAStopIOAlertIn(nCards: Integer) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //设置文本叠加 
  function VCASetTextOSD(nCards: Integer; bEnableOSD: VCBOOL; pText: PChar; ptTopLeft: TPOINT ; 
  bTransparent: VCBOOL; var pOSD: OSDPARAM; nWndMain: HWND) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //设置时间叠加 
  function VCASetDateTimeOSD(nCards: Integer; bEnableOSD: VCBOOL; ptTopLeft: TPOINT; 
  bTransparent: VCBOOL; var pOSD: OSDPARAM; nWndMain: HWND) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //显示属性页对话框 
  function VCADisplayPropertyDialogs(nCards: Integer; id: PropertyDialog; 
   hParentWnd: HWND; szCaption: PChar) 
   : HRESULT; stdcall; external DLL_SDK3000; 
 
  //运行视频流 
  function VCARun(nCards: Integer) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //暂停视频流 
  function VCAPause(nCards: Integer) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //停止视频流 
  function VCAStop(nCards: Integer) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //得到视频流状况 
  function VCAGetStreamStatus(nCards: Integer; var pStatus: GRAPH_STATE) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //设置视频帧率 
  function VCASetFrameRate(nCards: Integer; nFrameRate: Integer) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //得到视频信息 
  function VCAGetVideoInfo(nCards: Integer; var pVSI:VIDEOSTREAMINFO) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //设置视频信息 
  function VCASetVideoInfo(nCards: Integer; var pVSI: VIDEOSTREAMINFO) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //设置视频大小为全屏 
  function VCASetFullScreen(nCards: Integer; bFullSrc: VCBOOL) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //是否视频为全屏模式 
  function VCAIsFullSrcMode(nCards: Integer; var pFullSrc: VCBOOL) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //得到视频制式 
  function VCAGetVideoStandard(nCards: Integer; var pVideoStandard: VideoStandard; var pAvailable: Integer) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //设置视频制式 
  function VCASetVideoStandard(nCards: Integer; vs: VideoStandard) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //枚举视频压缩格式 
  function VCAEnumVideoCompressor(nCards: Integer; arrCompDevName: PChar; var pCompDevCount: Integer) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //得到视频当前压缩格式 
  function VCAGetCurrentVideoCompressor(nCards: Integer; pCompDevName: PChar) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //枚举视频当前压缩格式 
  function VCASetCurrentVideoCompressor(nCards: Integer; pCompDevName: PChar) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //设置视频原始回调格式 
  function VCAEnableCapSourceStream(nCards: Integer; bCapStream: VCBOOL; 
  enVideoFieldType: VideoFieldType; pCapStream: TPrcCapSourceStream) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  // 
  function VCAEnablePicMessage(nCards: Integer; bPicMessage: VCBOOL; pPicMessage: TPrcPicMessage) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //读E2C 
  function VCAReadE2C(nCards: Integer; iSubAddr: Integer; var pucData: Byte) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //写E2C 
  function VCAWriteE2C(nCards: Integer; iSubAddr: Integer; ucData: BYTE) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //得到视频源输入频率( 0HZ / 50HZ / 60HZ )对应( 无信号 / PAL制 / NTSC制 ), 参考枚举变量eFieldFrequency 
  function VCAGetVideoFieldFrq(nCards: Integer; var pFieldFrequency: eFieldFrequency) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //枚举音频设备 
  function VCAEnumAudioCaptureDev(nCards: Integer; arrAudDevName: PChar; var pAudDevCount: Integer) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //通过音频设备名设置音频采集,一个音频设备(声卡)仅供一路卡, strAudDevName 为"",表示取消音频采集 
  function VCASetCurrentAudioCompressorName(nCards: Integer; strAudDevName:PChar) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  //通过音频设备序号设置音频采集,一个音频设备(声卡)仅供一路卡, nCurrentAudDevice 为-1,表示取消音频采集 
  function VCASetCurrentAudioCompressorNum(nCards: Integer; nCurrentAudDevice: Integer) 
  : HRESULT; stdcall; external DLL_SDK3000; 
 
  function ToVcbool(bIn: Boolean): VCBOOL; 
   
implementation 
 
function ToVcbool(bIn: Boolean): VCBOOL; 
begin 
  If bIn Then 
    result := 1     //VCTRUE 
  Else 
    result := 0;    //VCFALSE 
end; 
 
end.