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

📄 vfw_gai.pas

📁 加密算法,非常好的,值得看啊,太好不过,很好 很好很好很好很好
💻 PAS
📖 第 1 页 / 共 5 页
字号:

function    ToHex(n: BYTE): BYTE;
function    MAKEAVICKID(tcc: WORD; stream: BYTE): DWORD;

{-- Main AVI file header -----------------------------------------------------}

{-- flags for use in <dwFlags> in AVIFileHdr ---------------------------------}

const
    AVIF_HASINDEX               = $00000010;    // Index at end of file?
    AVIF_MUSTUSEINDEX           = $00000020;
    AVIF_ISINTERLEAVED          = $00000100;
    AVIF_TRUSTCKTYPE            = $00000800;    // Use CKType to find key frames?
    AVIF_WASCAPTUREFILE         = $00010000;
    AVIF_COPYRIGHTED            = $00020000;

{-- The AVI File Header LIST chunk should be padded to this size -------------}

const
    AVI_HEADERSIZE              = 2048;         // size of AVI header list

type
    PMainAVIHeader              = ^TMainAVIHeader;
    TMainAVIHeader              = packed record
        dwMicroSecPerFrame      : DWORD;        // frame display rate (or 0L)
        dwMaxBytesPerSec        : DWORD;        // max. transfer rate
        dwPaddingGranularity    : DWORD;        // pad to multiples of this
                                                // size; normally 2K.
        dwFlags                 : DWORD;        // the ever-present flags
        dwTotalFrames           : DWORD;        // # frames in file
        dwInitialFrames         : DWORD;
        dwStreams               : DWORD;
        dwSuggestedBufferSize   : DWORD;

        dwWidth                 : DWORD;
        dwHeight                : DWORD;

        dwReserved              : array[0..3] of DWORD;
    end;

{-- Stream header ------------------------------------------------------------}

const
    AVISF_DISABLED              = $00000001;

    AVISF_VIDEO_PALCHANGES      = $00010000;

type
    PAVIStreamHeader            = ^TAVIStreamHeader;
    TAVIStreamHeader            = packed record
        fccType                 : FOURCC;
        fccHandler              : FOURCC;
        dwFlags                 : DWORD;        // Contains AVITF_* flags
        wPriority               : WORD;
        wLanguage               : WORD;
        dwInitialFrames         : DWORD;
        dwScale                 : DWORD;
        dwRate                  : DWORD;        // dwRate / dwScale == samples/second
        dwStart                 : DWORD;
        dwLength                : DWORD;        // In units above...
        dwSuggestedBufferSize   : DWORD;
        dwQuality               : DWORD;
        dwSampleSize            : DWORD;
        rcFrame                 : TRECT;
    end;

{-- Flags for index ----------------------------------------------------------}

const
    AVIIF_NOTIME                = $00000100;    // this frame doesn't take any time
    AVIIF_COMPUSE               = $0FFF0000;    // these bits are for compressor use

type
    PAVIINDEXENTRY              = ^TAVIINDEXENTRY;
    TAVIINDEXENTRY              = packed record
        ckid                    : DWORD;
        dwFlags                 : DWORD;
        dwChunkOffset           : DWORD;        // Position of chunk
        dwChunkLength           : DWORD;        // Length of chunk
    end;

{-- Palette change chunk (used in video streams) -----------------------------}

    PAVIPALCHANGE               = ^TAVIPALCHANGE;
    TAVIPALCHANGE               = packed record
        bFirstEntry             : BYTE;         // first entry to change
        bNumEntries             : BYTE;         // # entries to change (0 if 256)
        wFlags                  : WORD;         // Mostly to preserve alignment...
        peNew                   : array[0..0] of TPALETTEENTRY; // New color specifications
    end;

(****************************************************************************
 *
 *  AVIFile - routines for reading/writing standard AVI files
 *
 ***************************************************************************)

//
// Ansi - Unicode thunking.
//
// Unicode or Ansi-only apps can call the avifile APIs.
// any Win32 app who wants to use
// any of the AVI COM interfaces must be UNICODE - the AVISTREAMINFO and
// AVIFILEINFO structures used in the Info methods of these interfaces are
// the unicode variants, and no thunking to or from ansi takes place
// except in the AVIFILE api entrypoints.
//
// For Ansi/Unicode thunking: for each entrypoint or structure that
// uses chars or strings, two versions are declared in the Win32 version,
// ApiNameW and ApiNameA. The default name ApiName is #defined to one or
// other of these depending on whether UNICODE is defined (during
// compilation of the app that is including this header). The source will
// contain ApiName and ApiNameA (with ApiName being the Win16 implementation,
// and also #defined to ApiNameW, and ApiNameA being the thunk entrypoint).
//

// For GetFrame::SetFormat - use the best format for the display

const
    AVIGETFRAMEF_BESTDISPLAYFMT = 1;

//
// Structures used by AVIStreamInfo & AVIFileInfo.
//
// These are related to, but not identical to, the header chunks
// in an AVI file.
//

{-- AVISTREAMINFO ------------------------------------------------------------}

// for Unicode/Ansi thunking we need to declare three versions of this!

type
    PAVIStreamInfoW             = ^TAVIStreamInfoW;
    TAVIStreamInfoW             = packed record
        fccType                 : DWORD;
        fccHandler              : DWORD;
        dwFlags                 : DWORD;        // Contains AVITF_* flags
        dwCaps                  : DWORD;
        wPriority               : WORD;
        wLanguage               : WORD;
        dwScale                 : DWORD;
        dwRate                  : DWORD;        // dwRate / dwScale == samples/second
        dwStart                 : DWORD;
        dwLength                : DWORD;        // In units above...
        dwInitialFrames         : DWORD;
        dwSuggestedBufferSize   : DWORD;
        dwQuality               : DWORD;
        dwSampleSize            : DWORD;
        rcFrame                 : TRECT;
        dwEditCount             : DWORD;
        dwFormatChangeCount     : DWORD;
        szName                  : array[0..63] of WideChar;
    end;

    PAVIStreamInfoA             = ^TAVIStreamInfoA;
    TAVIStreamInfoA             = packed record
        fccType                 : DWORD;
        fccHandler              : DWORD;
        dwFlags                 : DWORD;        // Contains AVITF_* flags
        dwCaps                  : DWORD;
        wPriority               : WORD;
        wLanguage               : WORD;
        dwScale                 : DWORD;
        dwRate                  : DWORD;        // dwRate / dwScale == samples/second
        dwStart                 : DWORD;
        dwLength                : DWORD;        // In units above...
        dwInitialFrames         : DWORD;
        dwSuggestedBufferSize   : DWORD;
        dwQuality               : DWORD;
        dwSampleSize            : DWORD;
        rcFrame                 : TRECT;
        dwEditCount             : DWORD;
        dwFormatChangeCount     : DWORD;
        szName                  : array[0..63] of AnsiChar;
    end;

  PAVIStreamInfo = ^TAVIStreamInfo;
{$IFDEF UNICODE}
  TAVIStreamInfo = TAVIStreamInfoW;
{$ELSE}
  TAVIStreamInfo = TAVIStreamInfoA;
{$ENDIF}

const
    AVISTREAMINFO_DISABLED      = $00000001;
    AVISTREAMINFO_FORMATCHANGES = $00010000;

{-- AVIFILEINFO --------------------------------------------------------------}

type
    PAVIFileInfoW               = ^TAVIFileInfoW;
    TAVIFileInfoW               = packed record
        dwMaxBytesPerSec        : DWORD;        // max. transfer rate
        dwFlags                 : DWORD;        // the ever-present flags
        dwCaps                  : DWORD;
        dwStreams               : DWORD;
        dwSuggestedBufferSize   : DWORD;

        dwWidth                 : DWORD;
        dwHeight                : DWORD;

        dwScale                 : DWORD;
        dwRate                  : DWORD;        // dwRate / dwScale == samples/second
        dwLength                : DWORD;

        dwEditCount             : DWORD;

        szFileType              : array[0..63] of WideChar;
                                                // descriptive string for file type?
    end;

    PAVIFileInfoA               = ^TAVIFileInfoA;
    TAVIFileInfoA               = packed record
        dwMaxBytesPerSec        : DWORD;        // max. transfer rate
        dwFlags                 : DWORD;        // the ever-present flags
        dwCaps                  : DWORD;
        dwStreams               : DWORD;
        dwSuggestedBufferSize   : DWORD;

        dwWidth                 : DWORD;
        dwHeight                : DWORD;

        dwScale                 : DWORD;
        dwRate                  : DWORD;        // dwRate / dwScale == samples/second
        dwLength                : DWORD;

        dwEditCount             : DWORD;

        szFileType              : array[0..63] of AnsiChar;
                                                // descriptive string for file type?
    end;

  PAVIFileInfo = ^TAVIFileInfo;
{$IFDEF UNICODE}
  TAVIFileInfo = TAVIFileInfoW;
{$ELSE}
  TAVIFileInfo = TAVIFileInfoA;
{$ENDIF}

{-- Flags for dwFlags --------------------------------------------------------}

const
    AVIFILEINFO_HASINDEX            = $00000010;
    AVIFILEINFO_MUSTUSEINDEX        = $00000020;
    AVIFILEINFO_ISINTERLEAVED       = $00000100;
    AVIFILEINFO_WASCAPTUREFILE      = $00010000;
    AVIFILEINFO_COPYRIGHTED         = $00020000;

{-- Flags for dwCaps ---------------------------------------------------------}

    AVIFILECAPS_CANREAD             = $00000001;
    AVIFILECAPS_CANWRITE            = $00000002;
    AVIFILECAPS_ALLKEYFRAMES        = $00000010;
    AVIFILECAPS_NOCOMPRESSION       = $00000020;

type
    TAVISAVECALLBACK                = function(i: int): BOOL; pascal;

{-- AVICOMPRESSOPTIONS -------------------------------------------------------}

// Make sure it matches the AutoDoc in avisave.c !!!

type
    PAVICOMPRESSOPTIONS             = ^TAVICOMPRESSOPTIONS;
    TAVICOMPRESSOPTIONS             = packed record
        fccType                     : DWORD;    // stream type, for consistency
        fccHandler                  : DWORD;    // compressor
        dwKeyFrameEvery             : DWORD;    // keyframe rate
        dwQuality                   : DWORD;    // compress quality 0-10,000
        dwBytesPerSecond            : DWORD;    // bytes per second
        dwFlags                     : DWORD;    // flags... see below
        lpFormat                    : PVOID;    // save format
        cbFormat                    : DWORD;
        lpParms                     : PVOID;    // compressor options
        cbParms                     : DWORD;
        dwInterleaveEvery           : DWORD;    // for non-video streams only
    end;

//
// Defines for the dwFlags field of the AVICOMPRESSOPTIONS struct
// Each of these flags determines if the appropriate field in the structure
// (dwInterleaveEvery, dwBytesPerSecond, and dwKeyFrameEvery) is payed
// attention to.  See the autodoc in avisave.c for details.
//

const
    AVICOMPRESSF_INTERLEAVE         = $00000001;    // interleave
    AVICOMPRESSF_DATARATE           = $00000002;    // use a data rate
    AVICOMPRESSF_KEYFRAMES          = $00000004;    // use keyframes
    AVICOMPRESSF_VALID              = $00000008;    // has valid data?

(*	-	-	-	-	-	-	-	-	*/


/****** AVI Stream Interface *******************************************)

type
    IAVIStream = interface(IUnknown)
        function Create(lParam1, lParam2: LPARAM): HResult; stdcall;
        function Info(var psi: TAVIStreamInfoW; lSize: LONG): HResult; stdcall;
        function FindSample(lPos: LONG; lFlags: LONG): LONG; stdcall;
        function ReadFormat(lPos: LONG; lpFormat: PVOID; var lpcbFormat: LONG): HResult; stdcall;
        function SetFormat(lPos: LONG; lpFormat: PVOID; cbFormat: LONG): HResult; stdcall;
        function Read(lStart: LONG; lSamples: LONG; lpBuffer: PVOID; cbBuffer: LONG; var plBytes, plSamples: LONG): HResult; stdcall;
        function Write(lStart: LONG; lSamples: LONG; lpBuffer: PVOID; cbBuffer: LONG; dwFlags: DWORD; var plSampWritten, plBytesWritten: LONG): HResult; stdcall;
        function Delete(lStart: LONG; lSamples: LONG): HResult; stdcall;
        function ReadData(fcc: DWORD; lp: PVOID; var lpcb: LONG): HResult; stdcall;
        function WriteData(fcc: DWORD; lp: PVOID; cb: LONG): HResult; stdcall;
        function SetInfo(var lpInfo: TAVIStreamInfoW; cbInfo: LONG): HResult; stdcall;
    end;

    IAVIStreaming = interface(IUnknown)
        function _Begin(lStart, lEnd : LONG; lRate : LONG): HResult; stdcall;
        function _End: HResult; stdcall;
    end;

    IAVIEditStream = interface(IUnknown)
        function Cut(var plStart, plLength: LONG; var ppResult: IAVIStream): HResult; stdcall;
        function Copy(var plStart, plLength: LONG; var ppResult: IAVIStream): HResult; stdcall;
        function Paste(var plPos: LONG; var plLength: LONG; pstream: IAVIStream; lStart, lEnd: LONG): HResult; stdcall;
        function Clone(var ppResult: IAVIStream): HResult; stdcall;
        function SetInfo(var lpInfo: TAVIStreamInfoW; cbInfo: LONG): HResult; stdcall;
    end;

{-- AVIFile -------------------------------------------------------

⌨️ 快捷键说明

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