⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vfw.pas

📁 iocp远控比较完整的代码.iocp far more complete control of the code
💻 PAS
📖 第 1 页 / 共 5 页
字号:
  VIDCF_COMPRESSFRAMES        = $0008 ;  // wants the compress all frames message
  VIDCF_DRAW                  = $0010 ;  // supports drawing
  VIDCF_FASTTEMPORALC         = $0020 ;  // does not need prev frame on compress
  VIDCF_FASTTEMPORALD         = $0080 ;  // does not need prev frame on decompress
  //VIDCF_QUALITYTIME         = $0040 ;  // supports temporal quality

  //VIDCF_FASTTEMPORAL        = (VIDCF_FASTTEMPORALC or VIDCF_FASTTEMPORALD)

(************************************************************************
************************************************************************)

  ICCOMPRESS_KEYFRAME         = $00000001;

type
  PICCOMPRESS = ^TICCOMPRESS;
  TICCOMPRESS = packed record
    dwFlags                 : DWORD;                // flags

    lpbiOutput              : PBITMAPINFOHEADER ;   // output format
    lpOutput                : PVOID ;               // output data

    lpbiInput               : PBITMAPINFOHEADER ;   // format of frame to compress
    lpInput                 : PVOID ;               // frame data to compress

    lpckid                  : PDWORD ;              // ckid for data in AVI file
    lpdwFlags               : PDWORD;               // flags in the AVI index.
    lFrameNum               : LONG ;               // frame number of seq.
    dwFrameSize             : DWORD ;               // reqested size in bytes. (if non zero)

    dwQuality               : DWORD ;               // quality

    // these are new fields

    lpbiPrev                : PBITMAPINFOHEADER ;   // format of previous frame
    lpPrev                  : PVOID ;               // previous frame
  end;

(************************************************************************
************************************************************************)

const
  ICCOMPRESSFRAMES_PADDING    = $00000001 ;

type
  TICCompressProc    = function(lInputOutput: LPARAM; lFrame: DWORD; lpBits: PVOID; len: LONG): LONG; stdcall;

  PICCOMPRESSFRAMES  = ^TICCOMPRESSFRAMES;
  TICCOMPRESSFRAMES  = packed record
    dwFlags                 : DWORD ;               // flags

    lpbiOutput              : PBITMAPINFOHEADER ;   // output format
    lOutput                 : LPARAM ;              // output identifier

    lpbiInput               : PBITMAPINFOHEADER ;   // format of frame to compress
    lInput                  : LPARAM ;              // input identifier

    lStartFrame             : LONG ;                // start frame
    lFrameCount             : LONG ;                // # of frames

    lQuality                : LONG ;                // quality
    lDataRate               : LONG ;                // data rate
    lKeyRate                : LONG ;                // key frame rate

    dwRate                  : DWORD ;               // frame rate, as always
    dwScale                 : DWORD ;

    dwOverheadPerFrame      : DWORD ;
    dwReserved2             : DWORD ;

    GetData                 : TICCompressProc;
    PutData                 : TICCompressProc;
  end;

{-- Messages for Status callback ---------------------------------------------}

const
    ICSTATUS_START              = 0 ;
    ICSTATUS_STATUS             = 1 ;   // l = % done
    ICSTATUS_END                = 2 ;
    ICSTATUS_ERROR              = 3 ;   // l = error string (LPSTR)
    ICSTATUS_YIELD              = 4 ;

type
  // return nonzero means abort operation in progress
  TICStatusProc    = function(lParam: LPARAM; message: UINT; l: LONG): LONG; stdcall;

  PICSETSTATUSPROC = ^TICSETSTATUSPROC;
  TICSETSTATUSPROC = packed record
    dwFlags                 : DWORD ;
    lParam                  : LPARAM ;
    Status                  : TICStatusProc;
  end;

(************************************************************************
************************************************************************)

const
    ICDECOMPRESS_HURRYUP        = $80000000 ;   // don't draw just buffer (hurry up!)
    ICDECOMPRESS_UPDATE         = $40000000 ;   // don't draw just update screen
    ICDECOMPRESS_PREROLL        = $20000000 ;   // this frame is before real start
    ICDECOMPRESS_NULLFRAME      = $10000000 ;   // repeat last frame
    ICDECOMPRESS_NOTKEYFRAME    = $08000000 ;   // this frame is not a key frame

type
  PICDECOMPRESS = ^TICDECOMPRESS;
  TICDECOMPRESS = packed record
    dwFlags                 : DWORD ;               // flags (from AVI index...)
    lpbiInput               : PBITMAPINFOHEADER ;   // BITMAPINFO of compressed data
                                                        // biSizeImage has the chunk size
    lpInput                 : PVOID ;               // compressed data
    lpbiOutput              : PBITMAPINFOHEADER ;   // DIB to decompress to
    lpOutput                : PVOID ;
    ckid                    : DWORD ;               // ckid from AVI file
  end;

  PICDECOMPRESSEX = ^TICDECOMPRESSEX;
  TICDECOMPRESSEX = packed record

    //
    // same as ICM_DECOMPRESS
    //

    dwFlags                 : DWORD;
    lpbiSrc                 : PBITMAPINFOHEADER;    // BITMAPINFO of compressed data
    lpSrc                   : PVOID;                // compressed data
    lpbiDst                 : PBITMAPINFOHEADER;    // DIB to decompress to
    lpDst                   : PVOID;                // output data

    //
    // new for ICM_DECOMPRESSEX
    //

    xDst                    : int; // destination rectangle
    yDst                    : int;
    dxDst                   : int;
    dyDst                   : int;

    xSrc                    : int; // source rectangle
    ySrc                    : int;
    dxSrc                   : int;
    dySrc                   : int;
  end;

(************************************************************************
************************************************************************)

const
    ICDRAW_QUERY                = $00000001 ; // test for support
    ICDRAW_FULLSCREEN           = $00000002 ; // draw to full screen
    ICDRAW_HDC                  = $00000004 ; // draw to a HDC/HWND
    ICDRAW_ANIMATE              = $00000008 ;   // expect palette animation
    ICDRAW_CONTINUE             = $00000010 ;   // draw is a continuation of previous draw
    ICDRAW_MEMORYDC             = $00000020 ;   // DC is offscreen, by the way
    ICDRAW_UPDATING             = $00000040 ;   // We're updating, as opposed to playing
    ICDRAW_RENDER               = $00000080 ; // used to render data not draw it
    ICDRAW_BUFFER               = $00000100 ; // please buffer this data offscreen, we will need to update it

type
  PICDRAWBEGIN = ^TICDRAWBEGIN;
  TICDRAWBEGIN = packed record
    dwFlags                 : DWORD ;       // flags

    hpal                    : HPALETTE ;    // palette to draw with
    hwnd                    : HWND ;        // window to draw to
    hdc                     : HDC ;         // HDC to draw to

    xDst                    : int ;         // destination rectangle
    yDst                    : int ;
    dxDst                   : int ;
    dyDst                   : int ;

    lpbi                    : PBITMAPINFOHEADER ;
                                                // format of frame to draw

    xSrc                    : int ;         // source rectangle
    ySrc                    : int ;
    dxSrc                   : int ;
    dySrc                   : int ;

    dwRate                  : DWORD ;       // frames/second = (dwRate/dwScale)
    dwScale                 : DWORD ;
  end;

(************************************************************************
************************************************************************)

const
    ICDRAW_HURRYUP              = $80000000 ;   // don't draw just buffer (hurry up!)
    ICDRAW_UPDATE               = $40000000 ;   // don't draw just update screen
    ICDRAW_PREROLL              = $20000000 ;   // this frame is before real start
    ICDRAW_NULLFRAME            = $10000000 ;   // repeat last frame
    ICDRAW_NOTKEYFRAME          = $08000000 ;   // this frame is not a key frame

type
    PICDRAW                     = ^TICDRAW;
    TICDRAW                     = packed record
        dwFlags                 : DWORD ;   // flags
        lpFormat                : PVOID ;   // format of frame to decompress
        lpData                  : PVOID ;   // frame data to decompress
        cbData                  : DWORD ;
        lTime                   : LONG  ;   // time in drawbegin units (see dwRate and dwScale)
    end;

    PICDRAWSUGGEST              = ^TICDRAWSUGGEST;
    TICDRAWSUGGEST              = packed record
        lpbiIn                  : PBITMAPINFOHEADER ;   // format to be drawn
        lpbiSuggest             : PBITMAPINFOHEADER ;   // location for suggested format (or NULL to get size)
        dxSrc                   : int ;                 // source extent or 0
        dySrc                   : int ;
        dxDst                   : int ;                 // dest extent or 0
        dyDst                   : int ;
        hicDecompressor         : HIC ;                 // decompressor you can talk to
    end;

(************************************************************************
************************************************************************)

    PICPALETTE                  = ^TICPALETTE;
    TICPALETTE                  = packed record
        dwFlags                 : DWORD ;           // flags (from AVI index...)
        iStart                  : int ;             // first palette to change
        iLen                    : int ;             // count of entries to change.
        lppe                    : PPALETTEENTRY ;   // palette
    end;

(************************************************************************

    ICM function declarations

************************************************************************)

function    ICInfo(fccType, fccHandler: DWORD; lpicinfo: PICINFO) : BOOL ; stdcall ;
function    ICInstall(fccType, fccHandler: DWORD; lParam: LPARAM; szDesc: LPSTR; wFlags: UINT) : BOOL ; stdcall ;
function    ICRemove(fccType, fccHandler: DWORD; wFlags: UINT) : BOOL ; stdcall ;
function    ICGetInfo(hic: HIC; picinfo: PICINFO; cb: DWORD) : DWORD ; stdcall ;

function    ICOpen(fccType, fccHandler: DWORD; wMode: UINT) : HIC ; stdcall ;
function    ICOpenFunction(fccType, fccHandler: DWORD; wMode: UINT; lpfnHandler: TFarProc) : HIC ; stdcall ;
function    ICClose(hic: HIC) : DWORD; stdcall ;

function    ICSendMessage(hic: HIC; msg: UINT; dw1, dw2: DWORD) : DWORD ; stdcall ;

{-- Values for wFlags of ICInstall -------------------------------------------}

const
    ICINSTALL_UNICODE           = $8000 ;

    ICINSTALL_FUNCTION          = $0001 ; // lParam is a DriverProc (function ptr)
    ICINSTALL_DRIVER            = $0002 ; // lParam is a driver name (string)
    ICINSTALL_HDRV              = $0004 ; // lParam is a HDRVR (driver handle)

    ICINSTALL_DRIVERW           = $8002 ; // lParam is a unicode driver name

{-- Query macros -------------------------------------------------------------}

    ICMF_CONFIGURE_QUERY        = $00000001 ;
    ICMF_ABOUT_QUERY            = $00000001 ;

function    ICQueryAbout(hic: HIC): BOOL;
function    ICAbout(hic: HIC; hwnd: HWND): DWORD;
function    ICQueryConfigure(hic: HIC): BOOL;
function    ICConfigure(hic: HIC; hwnd: HWND): DWORD;

{-- Get/Set state macros -----------------------------------------------------}

function    ICGetState(hic: HIC; pv: PVOID; cb: DWORD): DWORD;
function    ICSetState(hic: HIC; pv: PVOID; cb: DWORD): DWORD;
function    ICGetStateSize(hic: HIC): DWORD;

{-- Get value macros ---------------------------------------------------------}

function    ICGetDefaultQuality(hic: HIC): DWORD;
function    ICGetDefaultKeyFrameRate(hic: HIC): DWORD;

{-- Draw window macro --------------------------------------------------------}

function    ICDrawWindow(hic: HIC; prc: PRECT): DWORD;

(************************************************************************

    compression functions

************************************************************************/
/*
 *  ICCompress()
 *
 *  compress a single frame
 *
 *)
function ICCompress(
    hic             : HIC;
    dwFlags         : DWORD;                // flags
    lpbiOutput      : PBITMAPINFOHEADER;    // output format
    lpData          : PVOID;                // output data
    lpbiInput       : PBITMAPINFOHEADER;    // format of frame to compress
    lpBits          : PVOID;                // frame data to compress
    lpckid          : PDWORD;               // ckid for data in AVI file
    lpdwFlags       : PDWORD;               // flags in the AVI index.
    lFrameNum       : DWORD;                 // frame number of seq.
    dwFrameSize     : DWORD;                // reqested size in bytes. (if non zero)
    dwQuality       : DWORD;                // quality within one frame
    lpbiPrev        : PBITMAPINFOHEADER;    // format of previous frame
    lpPrev          : PVOID                 // previous frame
    ): DWORD; cdecl;

(*
 *  ICCompressBegin()
 *
 *  start compression from a source format (lpbiInput) to a dest
 *  format (lpbiOuput) is supported.
 *
 *)

function    ICCompressBegin(hic: HIC; lpbiInput: PBITMAPINFOHEADER; lpbiOutput: PBITMAPINFOHEADER): DWORD;

(*
 *  ICCompressQuery()
 *
 *  determines if compression from a source format (lpbiInput) to a dest
 *  format (lpbiOuput) is supported.
 *
 *)

function    ICCompressQuery(hic: HIC; lpbiInput, lpbiOutput: PBITMAPINFOHEADER): DWORD;

(*
 *  ICCompressGetFormat()

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -