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

📄 vfw.pas

📁 可旋转90度浏览的视频浏览源码
💻 PAS
📖 第 1 页 / 共 5 页
字号:
    dxSrc       : int;
    dySrc       : int;
    wFlags      : UINT
    ): BOOL; stdcall;

{-- DrawDibUpdate() - redraw last image (may only be valid with DDF_BUFFER) --}

function    DrawDibUpdate(hdd: HDRAWDIB; hdc: HDC; x, y: int): BOOL;

{-- DrawDibEnd() -------------------------------------------------------------}

function    DrawDibEnd(hdd: HDRAWDIB): BOOL; stdcall;

{-- DrawDibTime() - for debugging purposes only ------------------------------}

type
    PDRAWDIBTIME        = ^TDRAWDIBTIME;
    TDRAWDIBTIME        = record
        timeCount       : DWORD;
        timeDraw        : DWORD;
        timeDecompress  : DWORD;
        timeDither      : DWORD;
        timeStretch     : DWORD;
        timeBlt         : DWORD;
        timeSetDIBits   : DWORD;
    end;

function    DrawDibTime(hdd: HDRAWDIB; lpddtime: PDRAWDIBTIME): BOOL; stdcall;

{-- Display profiling --------------------------------------------------------}

const
    PD_CAN_DRAW_DIB             = $0001;    // if you can draw at all
    PD_CAN_STRETCHDIB           = $0002;    // basicly RC_STRETCHDIB
    PD_STRETCHDIB_1_1_OK        = $0004;    // is it fast?
    PD_STRETCHDIB_1_2_OK        = $0008;    // ...
    PD_STRETCHDIB_1_N_OK        = $0010;    // ...

function    DrawDibProfileDisplay(lpbi: PBITMAPINFOHEADER): DWORD; stdcall;

{== AVIFMT - AVI file format definitions =====================================}

//
// The following is a short description of the AVI file format.  Please
// see the accompanying documentation for a full explanation.
//
// An AVI file is the following RIFF form:
//
//  RIFF('AVI' 
//        LIST('hdrl'
//          avih(<MainAVIHeader>)
//                  LIST ('strl'
//                      strh(<Stream header>)
//                      strf(<Stream format>)
//                      ... additional header data
//            LIST('movi'    
//            { LIST('rec' 
//                    SubChunk...
//                 )
//                | SubChunk } ....
//            )
//            [ <AVIIndex> ]
//      )
//
//  The main file header specifies how many streams are present.  For
//  each one, there must be a stream header chunk and a stream format
//  chunk, enlosed in a 'strl' LIST chunk.  The 'strf' chunk contains
//  type-specific format information; for a video stream, this should
//  be a BITMAPINFO structure, including palette.  For an audio stream,
//  this should be a WAVEFORMAT (or PCMWAVEFORMAT) structure.
//
//  The actual data is contained in subchunks within the 'movi' LIST 
//  chunk.  The first two characters of each data chunk are the
//  stream number with which that data is associated.
//
//  Some defined chunk types:
//           Video Streams:
//                  ##db:   RGB DIB bits
//                  ##dc:   RLE8 compressed DIB bits
//                  ##pc:   Palette Change
//
//           Audio Streams:
//                  ##wb:   waveform audio bytes
//
// The grouping into LIST 'rec' chunks implies only that the contents of
//   the chunk should be read into memory at the same time.  This
//   grouping is used for files specifically intended to be played from 
//   CD-ROM.
//
// The index chunk at the end of the file should contain one entry for 
//   each data chunk in the file.
//
// Limitations for the current software:
//  Only one video stream and one audio stream are allowed.
//  The streams must start at the beginning of the file.
//
//
// To register codec types please obtain a copy of the Multimedia
// Developer Registration Kit from:
//
//  Microsoft Corporation
//  Multimedia Systems Group
//  Product Marketing
//  One Microsoft Way
//  Redmond, WA 98052-6399
//

{-- form types, list types and chunk types -----------------------------------}

const
    formtypeAVI                 = $20495641; // mmioFOURCC('A', 'V', 'I', ' ')
    listtypeAVIHEADER           = $6C726468; // mmioFOURCC('h', 'd', 'r', 'l')
    ckidAVIMAINHDR              = $68697661; // mmioFOURCC('a', 'v', 'i', 'h')
    listtypeSTREAMHEADER        = $6C727473; // mmioFOURCC('s', 't', 'r', 'l')
    ckidSTREAMHEADER            = $68727473; // mmioFOURCC('s', 't', 'r', 'h')
    ckidSTREAMFORMAT            = $66727473; // mmioFOURCC('s', 't', 'r', 'f')
    ckidSTREAMHANDLERDATA       = $64727473; // mmioFOURCC('s', 't', 'r', 'd')
    ckidSTREAMNAME              = $6E727473; // mmioFOURCC('s', 't', 'r', 'n')

    listtypeAVIMOVIE            = $69766F6D; // mmioFOURCC('m', 'o', 'v', 'i')
    listtypeAVIRECORD           = $20636572; // mmioFOURCC('r', 'e', 'c', ' ')

    ckidAVINEWINDEX             = $31786469; // mmioFOURCC('i', 'd', 'x', '1')

{-- Stream types for the <fccType> field of the stream header ----------------}

    streamtypeVIDEO             = $73646976; // mmioFOURCC('v', 'i', 'd', 's')
    streamtypeAUDIO             = $73647561; // mmioFOURCC('a', 'u', 'd', 's')
    streamtypeMIDI              = $7364696D; // mmioFOURCC('m', 'i', 'd', 's')
    streamtypeTEXT              = $73747874; // mmioFOURCC('t', 'x', 't', 's')

{-- Basic chunk types --------------------------------------------------------}

    cktypeDIBbits               = $6264; // aviTWOCC('d', 'b')
    cktypeDIBcompressed         = $6364; // aviTWOCC('d', 'c')
    cktypePALchange             = $6370; // aviTWOCC('p', 'c')
    cktypeWAVEbytes             = $6277; // aviTWOCC('w', 'b')

{-- Chunk id to use for extra chunks for padding -----------------------------}

    ckidAVIPADDING              = $4B4E554A; // mmioFOURCC('J', 'U', 'N', 'K')

{== Useful macros ============================================================}

{-- Macro to get stream number out of a FOURCC ckid --------------------------}

function    FromHex(n: BYTE): BYTE;
function    StreamFromFOURCC(fcc: DWORD): BYTE;

{-- Macro to get TWOCC chunk type out of a FOURCC ckid -----------------------}

function    TWOCCFromFOURCC(fcc: DWORD): WORD;

{-- Macro to make a ckid for a chunk out of a TWOCC and a stream num (0-255) -}

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              = 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            = 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              = 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               = record
        bFirstEntry             : BYTE;         // first entry to change
        bNumEntries             : BYTE;         // # entries to change (0 if 256)
        wFlags                  : WORD;         // Mostly to preserve alignment...
        // peNew                : array[0..-1] of PALETTEENTRY ;
                                                // 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             = 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;

⌨️ 快捷键说明

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