This commit is contained in:
2024-08-07 09:12:07 -04:00
parent ca445435a0
commit fdfadd5c7e
1021 changed files with 73601 additions and 0 deletions

380
avifile/DOCS/AVICAP.H Normal file
View File

@@ -0,0 +1,380 @@
/****************************************************************************
*
* avicap.h
*
* Main include file.
*
* Microsoft Video for Windows Sample Capture Class
*
* Copyright (c) 1992, 1993 Microsoft Corporation. All Rights Reserved.
*
* You have a royalty-free right to use, modify, reproduce and
* distribute the Sample Files (and/or any modified version) in
* any way you find useful, provided that you agree that
* Microsoft has no warranty obligations or liability for any
* Sample Application Files which are modified.
*
***************************************************************************/
#ifndef _INC_AVICAP
#define _INC_AVICAP
#ifndef VFWAPI
#ifdef WIN32
#define VFWAPI _stdcall
#define VFWAPIV _stdcall
#else
#define VFWAPI FAR PASCAL
#define VFWAPIV FAR CDECL
#endif
#endif
#ifdef __cplusplus
#define AVICapSM ::SendMessage /* SendMessage in C++*/
#else
#define AVICapSM SendMessage /* SendMessage in C */
#endif /* __cplusplus */
#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
#ifndef RC_INVOKED
#pragma pack(1) /* Assume byte packing throughout */
#endif /* RC_INVOKED */
#ifndef RC_INVOKED
// ------------------------------------------------------------------
// Window Messages WM_CAP... which can be sent to an AVICAP window
// ------------------------------------------------------------------
// Defines start of the message range
#define WM_CAP_START WM_USER
#define WM_CAP_GET_CAPSTREAMPTR (WM_CAP_START+ 1)
#define WM_CAP_SET_CALLBACK_ERROR (WM_CAP_START+ 2)
#define WM_CAP_SET_CALLBACK_STATUS (WM_CAP_START+ 3)
#define WM_CAP_SET_CALLBACK_YIELD (WM_CAP_START+ 4)
#define WM_CAP_SET_CALLBACK_FRAME (WM_CAP_START+ 5)
#define WM_CAP_SET_CALLBACK_VIDEOSTREAM (WM_CAP_START+ 6)
#define WM_CAP_SET_CALLBACK_WAVESTREAM (WM_CAP_START+ 7)
#define WM_CAP_GET_USER_DATA (WM_CAP_START+ 8)
#define WM_CAP_SET_USER_DATA (WM_CAP_START+ 9)
#define WM_CAP_DRIVER_CONNECT (WM_CAP_START+ 10)
#define WM_CAP_DRIVER_DISCONNECT (WM_CAP_START+ 11)
#define WM_CAP_DRIVER_GET_NAME (WM_CAP_START+ 12)
#define WM_CAP_DRIVER_GET_VERSION (WM_CAP_START+ 13)
#define WM_CAP_DRIVER_GET_CAPS (WM_CAP_START+ 14)
#define WM_CAP_FILE_SET_CAPTURE_FILE (WM_CAP_START+ 20)
#define WM_CAP_FILE_GET_CAPTURE_FILE (WM_CAP_START+ 21)
#define WM_CAP_FILE_ALLOCATE (WM_CAP_START+ 22)
#define WM_CAP_FILE_SAVEAS (WM_CAP_START+ 23)
#define WM_CAP_FILE_SET_INFOCHUNK (WM_CAP_START+ 24)
#define WM_CAP_FILE_SAVEDIB (WM_CAP_START+ 25)
#define WM_CAP_EDIT_COPY (WM_CAP_START+ 30)
#define WM_CAP_SET_AUDIOFORMAT (WM_CAP_START+ 35)
#define WM_CAP_GET_AUDIOFORMAT (WM_CAP_START+ 36)
#define WM_CAP_DLG_VIDEOFORMAT (WM_CAP_START+ 41)
#define WM_CAP_DLG_VIDEOSOURCE (WM_CAP_START+ 42)
#define WM_CAP_DLG_VIDEODISPLAY (WM_CAP_START+ 43)
#define WM_CAP_GET_VIDEOFORMAT (WM_CAP_START+ 44)
#define WM_CAP_SET_VIDEOFORMAT (WM_CAP_START+ 45)
#define WM_CAP_DLG_VIDEOCOMPRESSION (WM_CAP_START+ 46)
#define WM_CAP_SET_PREVIEW (WM_CAP_START+ 50)
#define WM_CAP_SET_OVERLAY (WM_CAP_START+ 51)
#define WM_CAP_SET_PREVIEWRATE (WM_CAP_START+ 52)
#define WM_CAP_SET_SCALE (WM_CAP_START+ 53)
#define WM_CAP_GET_STATUS (WM_CAP_START+ 54)
#define WM_CAP_SET_SCROLL (WM_CAP_START+ 55)
#define WM_CAP_GRAB_FRAME (WM_CAP_START+ 60)
#define WM_CAP_GRAB_FRAME_NOSTOP (WM_CAP_START+ 61)
#define WM_CAP_SEQUENCE (WM_CAP_START+ 62)
#define WM_CAP_SEQUENCE_NOFILE (WM_CAP_START+ 63)
#define WM_CAP_SET_SEQUENCE_SETUP (WM_CAP_START+ 64)
#define WM_CAP_GET_SEQUENCE_SETUP (WM_CAP_START+ 65)
#define WM_CAP_SET_MCI_DEVICE (WM_CAP_START+ 66)
#define WM_CAP_GET_MCI_DEVICE (WM_CAP_START+ 67)
#define WM_CAP_STOP (WM_CAP_START+ 68)
#define WM_CAP_ABORT (WM_CAP_START+ 69)
#define WM_CAP_SINGLE_FRAME_OPEN (WM_CAP_START+ 70)
#define WM_CAP_SINGLE_FRAME_CLOSE (WM_CAP_START+ 71)
#define WM_CAP_SINGLE_FRAME (WM_CAP_START+ 72)
#define WM_CAP_PAL_OPEN (WM_CAP_START+ 80)
#define WM_CAP_PAL_SAVE (WM_CAP_START+ 81)
#define WM_CAP_PAL_PASTE (WM_CAP_START+ 82)
#define WM_CAP_PAL_AUTOCREATE (WM_CAP_START+ 83)
#define WM_CAP_PAL_MANUALCREATE (WM_CAP_START+ 84)
// Defines end of the message range
#define WM_CAP_END WM_CAP_PAL_MANUALCREATE
// ------------------------------------------------------------------
// Message crackers for above
// ------------------------------------------------------------------
#define capSetCallbackOnError(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_ERROR, 0, (LPARAM)(LPVOID)(fpProc)))
#define capSetCallbackOnStatus(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_STATUS, 0, (LPARAM)(LPVOID)(fpProc)))
#define capSetCallbackOnYield(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_YIELD, 0, (LPARAM)(LPVOID)(fpProc)))
#define capSetCallbackOnFrame(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_FRAME, 0, (LPARAM)(LPVOID)(fpProc)))
#define capSetCallbackOnVideoStream(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, (LPARAM)(LPVOID)(fpProc)))
#define capSetCallbackOnWaveStream(hwnd, fpProc) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_WAVESTREAM, 0, (LPARAM)(LPVOID)(fpProc)))
#define capSetUserData(hwnd, lUser) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_USER_DATA, 0, (LPARAM)lUser))
#define capGetUserData(hwnd) (AVICapSM(hwnd, WM_CAP_GET_USER_DATA, 0, 0))
#define capDriverConnect(hwnd, i) ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_CONNECT, (WPARAM)(i), 0L))
#define capDriverDisconnect(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_DISCONNECT, (WPARAM)0, 0L))
#define capDriverGetName(hwnd, szName, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_GET_NAME, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPSTR)(szName)))
#define capDriverGetVersion(hwnd, szVer, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_GET_VERSION, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPSTR)(szVer)))
#define capDriverGetCaps(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_GET_CAPS, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPCAPDRIVERCAPS)(s)))
#define capFileSetCaptureFile(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_SET_CAPTURE_FILE, 0, (LPARAM)(LPVOID)(LPSTR)(szName)))
#define capFileGetCaptureFile(hwnd, szName, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_GET_CAPTURE_FILE, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPSTR)(szName)))
#define capFileAlloc(hwnd, dwSize) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_ALLOCATE, 0, (LPARAM)(DWORD)(dwSize)))
#define capFileSaveAs(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_SAVEAS, 0, (LPARAM)(LPVOID)(LPSTR)(szName)))
#define capFileSetInfoChunk(hwnd, lpInfoChunk) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_SET_INFOCHUNK, (WPARAM)0, (LPARAM)(LPCAPINFOCHUNK)(lpInfoChunk)))
#define capFileSaveDIB(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_FILE_SAVEDIB, 0, (LPARAM)(LPVOID)(LPSTR)(szName)))
#define capEditCopy(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_EDIT_COPY, 0, 0L))
#define capSetAudioFormat(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_AUDIOFORMAT, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPWAVEFORMATEX)(s)))
#define capGetAudioFormat(hwnd, s, wSize) ((DWORD)AVICapSM(hwnd, WM_CAP_GET_AUDIOFORMAT, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPWAVEFORMATEX)(s)))
#define capGetAudioFormatSize(hwnd) ((DWORD)AVICapSM(hwnd, WM_CAP_GET_AUDIOFORMAT, (WPARAM)0, (LPARAM) NULL))
#define capDlgVideoFormat(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_DLG_VIDEOFORMAT, 0, 0L))
#define capDlgVideoSource(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_DLG_VIDEOSOURCE, 0, 0L))
#define capDlgVideoDisplay(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_DLG_VIDEODISPLAY, 0, 0L))
#define capDlgVideoCompression(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_DLG_VIDEOCOMPRESSION, 0, 0L))
#define capGetVideoFormat(hwnd, s, wSize) ((DWORD)AVICapSM(hwnd, WM_CAP_GET_VIDEOFORMAT, (WPARAM)(wSize), (LPARAM)(LPVOID)(s)))
#define capGetVideoFormatSize(hwnd) ((DWORD)AVICapSM(hwnd, WM_CAP_GET_VIDEOFORMAT, 0, NULL))
#define capSetVideoFormat(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_VIDEOFORMAT, (WPARAM)(wSize), (LPARAM)(LPVOID)(s)))
#define capPreview(hwnd, f) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_PREVIEW, (WPARAM)(BOOL)(f), 0L))
#define capPreviewRate(hwnd, wMS) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_PREVIEWRATE, (WPARAM)(wMS), 0))
#define capOverlay(hwnd, f) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_OVERLAY, (WPARAM)(BOOL)(f), 0L))
#define capPreviewScale(hwnd, f) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_SCALE, (WPARAM)(BOOL)f, 0L))
#define capGetStatus(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_GET_STATUS, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPCAPSTATUS)(s)))
#define capSetScrollPos(hwnd, lpP) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_SCROLL, (WPARAM)0, (LPARAM)(LPPOINT)(lpP)))
#define capGrabFrame(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_GRAB_FRAME, (WPARAM)0, (LPARAM)0L))
#define capGrabFrameNoStop(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_GRAB_FRAME_NOSTOP, (WPARAM)0, (LPARAM)0L))
#define capCaptureSequence(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_SEQUENCE, (WPARAM)0, (LPARAM)0L))
#define capCaptureSequenceNoFile(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_SEQUENCE_NOFILE, (WPARAM)0, (LPARAM)0L))
#define capCaptureStop(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_STOP, (WPARAM)0, (LPARAM)0L))
#define capCaptureAbort(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_ABORT, (WPARAM)0, (LPARAM)0L))
#define capCaptureSingleFrameOpen(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_SINGLE_FRAME_OPEN, (WPARAM)0, (LPARAM)0L))
#define capCaptureSingleFrameClose(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_SINGLE_FRAME_CLOSE, (WPARAM)0, (LPARAM)0L))
#define capCaptureSingleFrame(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_SINGLE_FRAME, (WPARAM)0, (LPARAM)0L))
#define capCaptureGetSetup(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_GET_SEQUENCE_SETUP, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPCAPTUREPARMS)(s)))
#define capCaptureSetSetup(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_SEQUENCE_SETUP, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPCAPTUREPARMS)(s)))
#define capSetMCIDeviceName(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_MCI_DEVICE, 0, (LPARAM)(LPVOID)(LPSTR)(szName)))
#define capGetMCIDeviceName(hwnd, szName, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_GET_MCI_DEVICE, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPSTR)(szName)))
#define capPaletteOpen(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_OPEN, 0, (LPARAM)(LPVOID)(LPSTR)(szName)))
#define capPaletteSave(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_SAVE, 0, (LPARAM)(LPVOID)(LPSTR)(szName)))
#define capPalettePaste(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_PASTE, (WPARAM) 0, (LPARAM)0L))
#define capPaletteAuto(hwnd, iFrames, iColors) ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_AUTOCREATE, (WPARAM)(iFrames), (LPARAM)(DWORD)(iColors)))
#define capPaletteManual(hwnd, fGrab, iColors) ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_MANUALCREATE, (WPARAM)(fGrab), (LPARAM)(DWORD)(iColors)))
// ------------------------------------------------------------------
// Structures
// ------------------------------------------------------------------
typedef struct tagCapDriverCaps {
WORD wDeviceIndex; // Driver index in system.ini
BOOL fHasOverlay; // Can device overlay?
BOOL fHasDlgVideoSource; // Has Video source dlg?
BOOL fHasDlgVideoFormat; // Has Format dlg?
BOOL fHasDlgVideoDisplay; // Has External out dlg?
BOOL fCaptureInitialized; // Driver ready to capture?
BOOL fDriverSuppliesPalettes; // Can driver make palettes?
HVIDEO hVideoIn; // Driver In channel
HVIDEO hVideoOut; // Driver Out channel
HVIDEO hVideoExtIn; // Driver Ext In channel
HVIDEO hVideoExtOut; // Driver Ext Out channel
} CAPDRIVERCAPS, *PCAPDRIVERCAPS, FAR *LPCAPDRIVERCAPS;
typedef struct tagCapStatus {
UINT uiImageWidth; // Width of the image
UINT uiImageHeight; // Height of the image
BOOL fLiveWindow; // Now Previewing video?
BOOL fOverlayWindow; // Now Overlaying video?
BOOL fScale; // Scale image to client?
POINT ptScroll; // Scroll position
BOOL fUsingDefaultPalette; // Using default driver palette?
BOOL fAudioHardware; // Audio hardware present?
BOOL fCapFileExists; // Does capture file exist?
DWORD dwCurrentVideoFrame; // # of video frames cap'td
DWORD dwCurrentVideoFramesDropped;// # of video frames dropped
DWORD dwCurrentWaveSamples; // # of wave samples cap'td
DWORD dwCurrentTimeElapsedMS; // Elapsed capture duration
HPALETTE hPalCurrent; // Current palette in use
BOOL fCapturingNow; // Capture in progress?
DWORD dwReturn; // Error value after any operation
WORD wNumVideoAllocated; // Actual number of video buffers
WORD wNumAudioAllocated; // Actual number of audio buffers
} CAPSTATUS, *PCAPSTATUS, FAR *LPCAPSTATUS;
// Default values in parenthesis
typedef struct tagCaptureParms {
DWORD dwRequestMicroSecPerFrame; // Requested capture rate
BOOL fMakeUserHitOKToCapture; // Show "Hit OK to cap" dlg?
WORD wPercentDropForError; // Give error msg if > (10%)
BOOL fYield; // Capture via background task?
DWORD dwIndexSize; // Max index size in frames (32K)
WORD wChunkGranularity; // Junk chunk granularity (2K)
BOOL fUsingDOSMemory; // Use DOS buffers?
WORD wNumVideoRequested; // # video buffers, If 0, autocalc
BOOL fCaptureAudio; // Capture audio?
WORD wNumAudioRequested; // # audio buffers, If 0, autocalc
WORD vKeyAbort; // Virtual key causing abort
BOOL fAbortLeftMouse; // Abort on left mouse?
BOOL fAbortRightMouse; // Abort on right mouse?
BOOL fLimitEnabled; // Use wTimeLimit?
WORD wTimeLimit; // Seconds to capture
BOOL fMCIControl; // Use MCI video source?
BOOL fStepMCIDevice; // Step MCI device?
DWORD dwMCIStartTime; // Time to start in MS
DWORD dwMCIStopTime; // Time to stop in MS
BOOL fStepCaptureAt2x; // Perform spatial averaging 2x
WORD wStepCaptureAverageFrames; // Temporal average n Frames
DWORD dwAudioBufferSize; // Size of audio bufs (0 = default)
BOOL fDisableWriteCache; // Attempt to disable write cache
} CAPTUREPARMS, *PCAPTUREPARMS, FAR *LPCAPTUREPARMS;
typedef struct tagCapInfoChunk {
FOURCC fccInfoID; // Chunk ID, "ICOP" for copyright
LPVOID lpData; // pointer to data
LONG cbData; // size of lpData
} CAPINFOCHUNK, *PCAPINFOCHUNK, FAR *LPCAPINFOCHUNK;
// ------------------------------------------------------------------
// Callback Definitions
// ------------------------------------------------------------------
typedef LRESULT (CALLBACK* CAPYIELDCALLBACK) (HWND hWnd);
typedef LRESULT (CALLBACK* CAPSTATUSCALLBACK) (HWND hWnd, int nID, LPCSTR lpsz);
typedef LRESULT (CALLBACK* CAPERRORCALLBACK) (HWND hWnd, int nID, LPCSTR lpsz);
typedef LRESULT (CALLBACK* CAPVIDEOCALLBACK) (HWND hWnd, LPVIDEOHDR lpVHdr);
typedef LRESULT (CALLBACK* CAPWAVECALLBACK) (HWND hWnd, LPWAVEHDR lpWHdr);
// ------------------------------------------------------------------
// The only exported functions from AVICAP.DLL
// ------------------------------------------------------------------
HWND VFWAPI capCreateCaptureWindow (
LPCSTR lpszWindowName,
DWORD dwStyle,
int x, int y, int nWidth, int nHeight,
HWND hwndParent, int nID);
BOOL VFWAPI capGetDriverDescription (WORD wDriverIndex,
LPSTR lpszName, int cbName,
LPSTR lpszVer, int cbVer);
#endif /* RC_INVOKED */
// ------------------------------------------------------------------
// New Information chunk IDs
// ------------------------------------------------------------------
#define infotypeDIGITIZATION_TIME mmioFOURCC ('I','D','I','T')
#define infotypeSMPTE_TIME mmioFOURCC ('I','S','M','P')
// ------------------------------------------------------------------
// String IDs from status and error callbacks
// ------------------------------------------------------------------
#define IDS_CAP_BEGIN 300 /* "Capture Start" */
#define IDS_CAP_END 301 /* "Capture End" */
#define IDS_CAP_INFO 401 /* "%s" */
#define IDS_CAP_OUTOFMEM 402 /* "Out of memory" */
#define IDS_CAP_FILEEXISTS 403 /* "File '%s' exists -- overwrite it?" */
#define IDS_CAP_ERRORPALOPEN 404 /* "Error opening palette '%s'" */
#define IDS_CAP_ERRORPALSAVE 405 /* "Error saving palette '%s'" */
#define IDS_CAP_ERRORDIBSAVE 406 /* "Error saving frame '%s'" */
#define IDS_CAP_DEFAVIEXT 407 /* "avi" */
#define IDS_CAP_DEFPALEXT 408 /* "pal" */
#define IDS_CAP_CANTOPEN 409 /* "Cannot open '%s'" */
#define IDS_CAP_SEQ_MSGSTART 410 /* "Select OK to start capture\nof video sequence\nto %s." */
#define IDS_CAP_SEQ_MSGSTOP 411 /* "Hit ESCAPE or click to end capture" */
#define IDS_CAP_VIDEDITERR 412 /* "An error occurred while trying to run VidEdit." */
#define IDS_CAP_READONLYFILE 413 /* "The file '%s' is a read-only file." */
#define IDS_CAP_WRITEERROR 414 /* "Unable to write to file '%s'.\nDisk may be full." */
#define IDS_CAP_NODISKSPACE 415 /* "There is no space to create a capture file on the specified device." */
#define IDS_CAP_SETFILESIZE 416 /* "Set File Size" */
#define IDS_CAP_SAVEASPERCENT 417 /* "SaveAs: %2ld%% Hit Escape to abort." */
#define IDS_CAP_DRIVER_ERROR 418 /* Driver specific error message */
#define IDS_CAP_WAVE_OPEN_ERROR 419 /* "Error: Cannot open the wave input device.\nCheck sample size, frequency, and channels." */
#define IDS_CAP_WAVE_ALLOC_ERROR 420 /* "Error: Out of memory for wave buffers." */
#define IDS_CAP_WAVE_PREPARE_ERROR 421 /* "Error: Cannot prepare wave buffers." */
#define IDS_CAP_WAVE_ADD_ERROR 422 /* "Error: Cannot add wave buffers." */
#define IDS_CAP_WAVE_SIZE_ERROR 423 /* "Error: Bad wave size." */
#define IDS_CAP_VIDEO_OPEN_ERROR 424 /* "Error: Cannot open the video input device." */
#define IDS_CAP_VIDEO_ALLOC_ERROR 425 /* "Error: Out of memory for video buffers." */
#define IDS_CAP_VIDEO_PREPARE_ERROR 426 /* "Error: Cannot prepare video buffers." */
#define IDS_CAP_VIDEO_ADD_ERROR 427 /* "Error: Cannot add video buffers." */
#define IDS_CAP_VIDEO_SIZE_ERROR 428 /* "Error: Bad video size." */
#define IDS_CAP_FILE_OPEN_ERROR 429 /* "Error: Cannot open capture file." */
#define IDS_CAP_FILE_WRITE_ERROR 430 /* "Error: Cannot write to capture file. Disk may be full." */
#define IDS_CAP_RECORDING_ERROR 431 /* "Error: Cannot write to capture file. Data rate too high or disk full." */
#define IDS_CAP_RECORDING_ERROR2 432 /* "Error while recording" */
#define IDS_CAP_AVI_INIT_ERROR 433 /* "Error: Unable to initialize for capture." */
#define IDS_CAP_NO_FRAME_CAP_ERROR 434 /* "Warning: No frames captured.\nConfirm that vertical sync interrupts\nare configured and enabled." */
#define IDS_CAP_NO_PALETTE_WARN 435 /* "Warning: Using default palette." */
#define IDS_CAP_MCI_CONTROL_ERROR 436 /* "Error: Unable to access MCI device." */
#define IDS_CAP_MCI_CANT_STEP_ERROR 437 /* "Error: Unable to step MCI device." */
#define IDS_CAP_NO_AUDIO_CAP_ERROR 438 /* "Error: No audio data captured.\nCheck audio card settings." */
#define IDS_CAP_AVI_DRAWDIB_ERROR 439 /* "Error: Unable to draw this data format." */
#define IDS_CAP_COMPRESSOR_ERROR 440 /* "Error: Unable to initialize compressor." */
#define IDS_CAP_AUDIO_DROP_ERROR 441 /* "Error: Audio data was lost during capture, reduce capture rate." */
/* status string IDs */
#define IDS_CAP_STAT_LIVE_MODE 500 /* "Live window" */
#define IDS_CAP_STAT_OVERLAY_MODE 501 /* "Overlay window" */
#define IDS_CAP_STAT_CAP_INIT 502 /* "Setting up for capture - Please wait" */
#define IDS_CAP_STAT_CAP_FINI 503 /* "Finished capture, now writing frame %ld" */
#define IDS_CAP_STAT_PALETTE_BUILD 504 /* "Building palette map" */
#define IDS_CAP_STAT_OPTPAL_BUILD 505 /* "Computing optimal palette" */
#define IDS_CAP_STAT_I_FRAMES 506 /* "%d frames" */
#define IDS_CAP_STAT_L_FRAMES 507 /* "%ld frames" */
#define IDS_CAP_STAT_CAP_L_FRAMES 508 /* "Captured %ld frames" */
#define IDS_CAP_STAT_CAP_AUDIO 509 /* "Capturing audio" */
#define IDS_CAP_STAT_VIDEOCURRENT 510 /* "Captured %ld frames (%ld dropped) %d.%03d sec." */
#define IDS_CAP_STAT_VIDEOAUDIO 511 /* "Captured %d.%03d sec. %ld frames (%ld dropped) (%d.%03d fps). %ld audio bytes (%d,%03d sps)" */
#define IDS_CAP_STAT_VIDEOONLY 512 /* "Captured %d.%03d sec. %ld frames (%ld dropped) (%d.%03d fps)" */
#define IDS_CAP_STAT_FRAMESDROPPED 513 /* "Dropped %ld of %ld frames (%d.%02d%%) during capture." */
#ifndef RC_INVOKED
#pragma pack() /* Revert to default packing */
#endif /* RC_INVOKED */
#ifdef __cplusplus
} /* End of extern "C" { */
#endif /* __cplusplus */
#endif /* INC_AVICAP */

466
avifile/DOCS/AVIFILE.H Normal file
View File

@@ -0,0 +1,466 @@
/****************************************************************************
*
* AVIFILE.H
*
* routines for reading Standard AVI files
*
* Copyright (c) 1992, 1993 Microsoft Corporation. All Rights Reserved.
*
* You have a royalty-free right to use, modify, reproduce and
* distribute the Sample Files (and/or any modified version) in
* any way you find useful, provided that you agree that
* Microsoft has no warranty obligations or liability for any
* Sample Application Files which are modified.
*
***************************************************************************/
#if !defined( _AVIFILE_H_ )
#define _AVIFILE_H_
#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
#define CreateStream CS // !!!ack
#ifndef mmioFOURCC
#define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
#endif
#ifndef streamtypeVIDEO
#define streamtypeVIDEO mmioFOURCC('v', 'i', 'd', 's')
#define streamtypeAUDIO mmioFOURCC('a', 'u', 'd', 's')
#define streamtypeMIDI mmioFOURCC('m', 'i', 'd', 's')
#define streamtypeTEXT mmioFOURCC('t', 'x', 't', 's')
#endif
#ifndef AVIIF_KEYFRAME
#define AVIIF_KEYFRAME 0x00000010L // this frame is a key frame.
#endif
//
// Structures used by AVIStreamInfo & AVIFileInfo.
//
// These are related to, but not identical to, the header chunks
// in an AVI file.
//
typedef struct _AVISTREAMINFO {
DWORD fccType;
DWORD fccHandler;
DWORD dwFlags; /* Contains AVITF_* flags */
DWORD dwCaps;
WORD wPriority;
WORD wLanguage;
DWORD dwScale;
DWORD dwRate; /* dwRate / dwScale == samples/second */
DWORD dwStart;
DWORD dwLength; /* In units above... */
DWORD dwInitialFrames;
DWORD dwSuggestedBufferSize;
DWORD dwQuality;
DWORD dwSampleSize;
RECT rcFrame;
DWORD dwEditCount;
DWORD dwFormatChangeCount;
char szName[64];
} AVISTREAMINFO, FAR * LPAVISTREAMINFO;
#define AVISTREAMINFO_DISABLED 0x00000001
#define AVISTREAMINFO_FORMATCHANGES 0x00010000
typedef struct _AVIFILEINFO {
DWORD dwMaxBytesPerSec; // max. transfer rate
DWORD dwFlags; // the ever-present flags
DWORD dwCaps;
DWORD dwStreams;
DWORD dwSuggestedBufferSize;
DWORD dwWidth;
DWORD dwHeight;
DWORD dwScale;
DWORD dwRate; /* dwRate / dwScale == samples/second */
DWORD dwLength;
DWORD dwEditCount;
char szFileType[64]; // descriptive string for file type?
} AVIFILEINFO, FAR * LPAVIFILEINFO;
// Flags for dwFlags
#define AVIFILEINFO_HASINDEX 0x00000010
#define AVIFILEINFO_MUSTUSEINDEX 0x00000020
#define AVIFILEINFO_ISINTERLEAVED 0x00000100
#define AVIFILEINFO_WASCAPTUREFILE 0x00010000
#define AVIFILEINFO_COPYRIGHTED 0x00020000
// Flags for dwCaps
#define AVIFILECAPS_CANREAD 0x00000001
#define AVIFILECAPS_CANWRITE 0x00000002
#define AVIFILECAPS_ALLKEYFRAMES 0x00000010
#define AVIFILECAPS_NOCOMPRESSION 0x00000020
typedef BOOL (FAR PASCAL * AVISAVECALLBACK)(int);
/************************************************************************/
/* Declaration for the AVICOMPRESSOPTIONS structure. Make sure it */
/* matches the AutoDoc in avisave.c !!! */
/************************************************************************/
typedef struct {
DWORD fccType; /* stream type, for consistency */
DWORD fccHandler; /* compressor */
DWORD dwKeyFrameEvery; /* keyframe rate */
DWORD dwQuality; /* compress quality 0-10,000 */
DWORD dwBytesPerSecond; /* bytes per second */
DWORD dwFlags; /* flags... see aviopts.h */
LPVOID lpFormat; /* save format */
DWORD cbFormat;
LPVOID lpParms; /* compressor options */
DWORD cbParms;
DWORD dwInterleaveEvery; /* for non-video streams only */
} AVICOMPRESSOPTIONS, FAR *LPAVICOMPRESSOPTIONS;
//
// 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.
//
#define AVICOMPRESSF_INTERLEAVE 0x00000001 // interleave
#define AVICOMPRESSF_DATARATE 0x00000002 // use a data rate
#define AVICOMPRESSF_KEYFRAMES 0x00000004 // use keyframes
#define AVICOMPRESSF_VALID 0x00000008 // has valid data?
#ifdef __cplusplus
} /* End of extern "C" { */
#endif /* __cplusplus */
#include "aviiface.h"
#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
//
// functions
//
STDAPI_(void) AVIFileInit(void); // Call this first!
STDAPI_(void) AVIFileExit(void);
STDAPI_(ULONG) AVIFileAddRef (PAVIFILE pfile);
STDAPI_(ULONG) AVIFileRelease (PAVIFILE pfile);
STDAPI AVIFileOpen (PAVIFILE FAR * ppfile, LPCSTR szFile,
UINT uMode, LPCLSID lpHandler);
STDAPI AVIFileInfo (PAVIFILE pfile, AVIFILEINFO FAR * pfi, LONG lSize);
STDAPI AVIFileGetStream (PAVIFILE pfile, PAVISTREAM FAR * ppavi, DWORD fccType, LONG lParam);
STDAPI AVIFileCreateStream (PAVIFILE pfile,
PAVISTREAM FAR *ppavi,
AVISTREAMINFO FAR *psi);
STDAPI AVIFileWriteData (PAVIFILE pfile,
DWORD ckid,
LPVOID lpData,
LONG cbData);
STDAPI AVIFileReadData (PAVIFILE pfile,
DWORD ckid,
LPVOID lpData,
LONG FAR *lpcbData);
STDAPI AVIFileEndRecord (PAVIFILE pfile);
STDAPI_(ULONG) AVIStreamAddRef (PAVISTREAM pavi);
STDAPI_(ULONG) AVIStreamRelease (PAVISTREAM pavi);
STDAPI AVIStreamInfo (PAVISTREAM pavi, AVISTREAMINFO FAR * psi, LONG lSize);
STDAPI_(LONG) AVIStreamFindSample(PAVISTREAM pavi, LONG lPos, LONG lFlags);
STDAPI AVIStreamReadFormat (PAVISTREAM pavi, LONG lPos,LPVOID lpFormat,LONG FAR *lpcbFormat);
STDAPI AVIStreamSetFormat (PAVISTREAM pavi, LONG lPos,LPVOID lpFormat,LONG cbFormat);
STDAPI AVIStreamReadData (PAVISTREAM pavi, DWORD fcc, LPVOID lp, LONG FAR *lpcb);
STDAPI AVIStreamWriteData (PAVISTREAM pavi, DWORD fcc, LPVOID lp, LONG cb);
STDAPI AVIStreamRead (PAVISTREAM pavi,
LONG lStart,
LONG lSamples,
LPVOID lpBuffer,
LONG cbBuffer,
LONG FAR * plBytes,
LONG FAR * plSamples);
#define AVISTREAMREAD_CONVENIENT (-1L)
STDAPI AVIStreamWrite (PAVISTREAM pavi,
LONG lStart, LONG lSamples,
LPVOID lpBuffer, LONG cbBuffer, DWORD dwFlags,
LONG FAR *plSampWritten,
LONG FAR *plBytesWritten);
// Right now, these just use AVIStreamInfo() to get information, then
// return some of it. Can they be more efficient?
STDAPI_(LONG) AVIStreamStart (PAVISTREAM pavi);
STDAPI_(LONG) AVIStreamLength (PAVISTREAM pavi);
STDAPI_(LONG) AVIStreamTimeToSample (PAVISTREAM pavi, LONG lTime);
STDAPI_(LONG) AVIStreamSampleToTime (PAVISTREAM pavi, LONG lSample);
STDAPI AVIStreamBeginStreaming(PAVISTREAM pavi, LONG lStart, LONG lEnd, LONG lRate);
STDAPI AVIStreamEndStreaming(PAVISTREAM pavi);
//
// helper functions for using IGetFrame
//
STDAPI_(PGETFRAME) AVIStreamGetFrameOpen(PAVISTREAM pavi,
LPBITMAPINFOHEADER lpbiWanted);
STDAPI_(LPVOID) AVIStreamGetFrame(PGETFRAME pg, LONG lPos);
STDAPI AVIStreamGetFrameClose(PGETFRAME pg);
// !!! We need some way to place an advise on a stream....
// STDAPI AVIStreamHasChanged (PAVISTREAM pavi);
// Shortcut function
STDAPI AVIStreamOpenFromFile(PAVISTREAM FAR *ppavi, LPCSTR szFile,
DWORD fccType, LONG lParam,
UINT mode, CLSID FAR *pclsidHandler);
// Use to create disembodied streams
STDAPI AVIStreamCreate(PAVISTREAM FAR *ppavi, LONG lParam1, LONG lParam2,
CLSID FAR *pclsidHandler);
// PHANDLER AVIAPI AVIGetHandler (PAVISTREAM pavi, PAVISTREAMHANDLER psh);
// PAVISTREAM AVIAPI AVIGetStream (PHANDLER p);
//
// flags for AVIStreamFindSample
//
#define FIND_DIR 0x0000000FL // direction
#define FIND_NEXT 0x00000001L // go forward
#define FIND_PREV 0x00000004L // go backward
#define FIND_TYPE 0x000000F0L // type mask
#define FIND_KEY 0x00000010L // find key frame.
#define FIND_ANY 0x00000020L // find any (non-empty) sample
#define FIND_FORMAT 0x00000040L // find format change
#define FIND_RET 0x0000F000L // return mask
#define FIND_POS 0x00000000L // return logical position
#define FIND_LENGTH 0x00001000L // return logical size
#define FIND_OFFSET 0x00002000L // return physical position
#define FIND_SIZE 0x00003000L // return physical size
#define FIND_INDEX 0x00004000L // return physical index position
//
// stuff to support backward compat.
//
#define AVIStreamFindKeyFrame AVIStreamFindSample
#define FindKeyFrame FindSample
#define AVIStreamClose AVIStreamRelease
#define AVIFileClose AVIFileRelease
#define AVIStreamInit AVIFileInit
#define AVIStreamExit AVIFileExit
#define SEARCH_NEAREST FIND_PREV
#define SEARCH_BACKWARD FIND_PREV
#define SEARCH_FORWARD FIND_NEXT
#define SEARCH_KEY FIND_KEY
#define SEARCH_ANY FIND_ANY
//
// helper macros.
//
#define AVIStreamSampleToSample(pavi1, pavi2, l) \
AVIStreamTimeToSample(pavi1,AVIStreamSampleToTime(pavi2, l))
#define AVIStreamNextSample(pavi, l) \
AVIStreamFindSample(pavi,l+1,FIND_NEXT|FIND_ANY)
#define AVIStreamPrevSample(pavi, l) \
AVIStreamFindSample(pavi,l-1,FIND_PREV|FIND_ANY)
#define AVIStreamNearestSample(pavi, l) \
AVIStreamFindSample(pavi,l,FIND_PREV|FIND_ANY)
#define AVIStreamNextKeyFrame(pavi,l) \
AVIStreamFindSample(pavi,l+1,FIND_NEXT|FIND_KEY)
#define AVIStreamPrevKeyFrame(pavi, l) \
AVIStreamFindSample(pavi,l-1,FIND_PREV|FIND_KEY)
#define AVIStreamNearestKeyFrame(pavi, l) \
AVIStreamFindSample(pavi,l,FIND_PREV|FIND_KEY)
#define AVIStreamIsKeyFrame(pavi, l) \
(AVIStreamNearestKeyFrame(pavi,l) == l)
#define AVIStreamPrevSampleTime(pavi, t) \
AVIStreamSampleToTime(pavi, AVIStreamPrevSample(pavi,AVIStreamTimeToSample(pavi,t)))
#define AVIStreamNextSampleTime(pavi, t) \
AVIStreamSampleToTime(pavi, AVIStreamNextSample(pavi,AVIStreamTimeToSample(pavi,t)))
#define AVIStreamNearestSampleTime(pavi, t) \
AVIStreamSampleToTime(pavi, AVIStreamNearestSample(pavi,AVIStreamTimeToSample(pavi,t)))
#define AVIStreamNextKeyFrameTime(pavi, t) \
AVIStreamSampleToTime(pavi, AVIStreamNextKeyFrame(pavi,AVIStreamTimeToSample(pavi, t)))
#define AVIStreamPrevKeyFrameTime(pavi, t) \
AVIStreamSampleToTime(pavi, AVIStreamPrevKeyFrame(pavi,AVIStreamTimeToSample(pavi, t)))
#define AVIStreamNearestKeyFrameTime(pavi, t) \
AVIStreamSampleToTime(pavi, AVIStreamNearestKeyFrame(pavi,AVIStreamTimeToSample(pavi, t)))
#define AVIStreamStartTime(pavi) \
AVIStreamSampleToTime(pavi, AVIStreamStart(pavi))
#define AVIStreamLengthTime(pavi) \
AVIStreamSampleToTime(pavi, AVIStreamLength(pavi))
#define AVIStreamEnd(pavi) \
(AVIStreamStart(pavi) + AVIStreamLength(pavi))
#define AVIStreamEndTime(pavi) \
AVIStreamSampleToTime(pavi, AVIStreamEnd(pavi))
#define AVIStreamSampleSize(pavi, lPos, plSize) \
AVIStreamRead(pavi,lPos,1,NULL,0,plSize,NULL)
#define AVIStreamFormatSize(pavi, lPos, plSize) \
AVIStreamReadFormat(pavi,lPos,NULL,plSize)
#define AVIStreamDataSize(pavi, fcc, plSize) \
AVIStreamReadData(pavi,fcc,NULL,plSize)
/****************************************************************************
*
* AVISave routines and structures
*
***************************************************************************/
#ifndef comptypeDIB
#define comptypeDIB mmioFOURCC('D', 'I', 'B', ' ')
#endif
STDAPI AVIMakeCompressedStream(
PAVISTREAM FAR * ppsCompressed,
PAVISTREAM ppsSource,
AVICOMPRESSOPTIONS FAR * lpOptions,
CLSID FAR *pclsidHandler);
EXTERN_C HRESULT CDECL AVISave (LPCSTR szFile,
CLSID FAR *pclsidHandler,
AVISAVECALLBACK lpfnCallback,
int nStreams,
PAVISTREAM pfile,
LPAVICOMPRESSOPTIONS lpOptions,
...);
STDAPI AVISaveV(LPCSTR szFile,
CLSID FAR *pclsidHandler,
AVISAVECALLBACK lpfnCallback,
int nStreams,
PAVISTREAM FAR * ppavi,
LPAVICOMPRESSOPTIONS FAR *plpOptions);
STDAPI_(BOOL) AVISaveOptions(HWND hwnd,
UINT uiFlags,
int nStreams,
PAVISTREAM FAR *ppavi,
LPAVICOMPRESSOPTIONS FAR *plpOptions);
STDAPI AVISaveOptionsFree(int nStreams,
LPAVICOMPRESSOPTIONS FAR *plpOptions);
// FLAGS FOR uiFlags:
//
// Same as the flags for ICCompressorChoose (see compman.h)
// These determine what the compression options dialog for video streams
// will look like.
STDAPI AVIBuildFilter(LPSTR lpszFilter, LONG cbFilter, BOOL fSaving);
STDAPI AVIMakeFileFromStreams(PAVIFILE FAR * ppfile,
int nStreams,
PAVISTREAM FAR * papStreams);
STDAPI AVIMakeStreamFromClipboard(UINT cfFormat, HANDLE hGlobal, PAVISTREAM FAR *ppstream);
/****************************************************************************
*
* Clipboard routines
*
***************************************************************************/
STDAPI AVIPutFileOnClipboard(PAVIFILE pf);
STDAPI AVIGetFromClipboard(PAVIFILE FAR * lppf);
STDAPI AVIClearClipboard(void);
/****************************************************************************
*
* Editing routines
*
***************************************************************************/
STDAPI CreateEditableStream(
PAVISTREAM FAR * ppsEditable,
PAVISTREAM psSource);
STDAPI EditStreamCut(PAVISTREAM pavi, LONG FAR *plStart, LONG FAR *plLength, PAVISTREAM FAR * ppResult);
STDAPI EditStreamCopy(PAVISTREAM pavi, LONG FAR *plStart, LONG FAR *plLength, PAVISTREAM FAR * ppResult);
STDAPI EditStreamPaste(PAVISTREAM pavi, LONG FAR *plPos, LONG FAR *plLength, PAVISTREAM pstream, LONG lStart, LONG lEnd);
STDAPI EditStreamClone(PAVISTREAM pavi, PAVISTREAM FAR *ppResult);
STDAPI EditStreamSetName(PAVISTREAM pavi, LPCSTR lpszName);
STDAPI EditStreamSetInfo(PAVISTREAM pavi, AVISTREAMINFO FAR * lpInfo, LONG cbInfo);
#ifdef __cplusplus
} /* End of extern "C" { */
#endif /* __cplusplus */
#endif
/* - - - - - - - - */
#ifndef AVIERR_OK
#define AVIERR_OK 0L
#define MAKE_AVIERR(error) MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x4000 + error)
// !!! Questions to be answered:
// How can you get a string form of these errors?
// Which of these errors should be replaced by errors in SCODE.H?
#define AVIERR_UNSUPPORTED MAKE_AVIERR(101)
#define AVIERR_BADFORMAT MAKE_AVIERR(102)
#define AVIERR_MEMORY MAKE_AVIERR(103)
#define AVIERR_INTERNAL MAKE_AVIERR(104)
#define AVIERR_BADFLAGS MAKE_AVIERR(105)
#define AVIERR_BADPARAM MAKE_AVIERR(106)
#define AVIERR_BADSIZE MAKE_AVIERR(107)
#define AVIERR_BADHANDLE MAKE_AVIERR(108)
#define AVIERR_FILEREAD MAKE_AVIERR(109)
#define AVIERR_FILEWRITE MAKE_AVIERR(110)
#define AVIERR_FILEOPEN MAKE_AVIERR(111)
#define AVIERR_COMPRESSOR MAKE_AVIERR(112)
#define AVIERR_NOCOMPRESSOR MAKE_AVIERR(113)
#define AVIERR_READONLY MAKE_AVIERR(114)
#define AVIERR_NODATA MAKE_AVIERR(115)
#define AVIERR_BUFFERTOOSMALL MAKE_AVIERR(116)
#define AVIERR_CANTCOMPRESS MAKE_AVIERR(117)
#define AVIERR_USERABORT MAKE_AVIERR(198)
#define AVIERR_ERROR MAKE_AVIERR(199)
#endif

250
avifile/DOCS/AVIFMT.H Normal file
View File

@@ -0,0 +1,250 @@
/****************************************************************************/
/* */
/* AVIFMT.H - Include file for working with AVI files */
/* */
/* Note: You must include WINDOWS.H and MMSYSTEM.H before */
/* including this file. */
/* */
/* Copyright (c) 1991-1993, Microsoft Corp. All rights reserved. */
/* */
/* */
/****************************************************************************/
#ifndef _INC_AVIFMT
#define _INC_AVIFMT 100 /* version number * 100 + revision */
#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
#ifdef _MSC_VER
#pragma warning(disable:4200)
#endif
/* 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
*
*/
#ifndef mmioFOURCC
#define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
#endif
/* Macro to make a TWOCC out of two characters */
#ifndef aviTWOCC
#define aviTWOCC(ch0, ch1) ((WORD)(BYTE)(ch0) | ((WORD)(BYTE)(ch1) << 8))
#endif
typedef WORD TWOCC;
/* form types, list types, and chunk types */
#define formtypeAVI mmioFOURCC('A', 'V', 'I', ' ')
#define listtypeAVIHEADER mmioFOURCC('h', 'd', 'r', 'l')
#define ckidAVIMAINHDR mmioFOURCC('a', 'v', 'i', 'h')
#define listtypeSTREAMHEADER mmioFOURCC('s', 't', 'r', 'l')
#define ckidSTREAMHEADER mmioFOURCC('s', 't', 'r', 'h')
#define ckidSTREAMFORMAT mmioFOURCC('s', 't', 'r', 'f')
#define ckidSTREAMHANDLERDATA mmioFOURCC('s', 't', 'r', 'd')
#define ckidSTREAMNAME mmioFOURCC('s', 't', 'r', 'n')
#define listtypeAVIMOVIE mmioFOURCC('m', 'o', 'v', 'i')
#define listtypeAVIRECORD mmioFOURCC('r', 'e', 'c', ' ')
#define ckidAVINEWINDEX mmioFOURCC('i', 'd', 'x', '1')
/*
** Stream types for the <fccType> field of the stream header.
*/
#define streamtypeVIDEO mmioFOURCC('v', 'i', 'd', 's')
#define streamtypeAUDIO mmioFOURCC('a', 'u', 'd', 's')
#define streamtypeTEXT mmioFOURCC('t', 'x', 't', 's')
/* Basic chunk types */
#define cktypeDIBbits aviTWOCC('d', 'b')
#define cktypeDIBcompressed aviTWOCC('d', 'c')
#define cktypePALchange aviTWOCC('p', 'c')
#define cktypeWAVEbytes aviTWOCC('w', 'b')
/* Chunk id to use for extra chunks for padding. */
#define ckidAVIPADDING mmioFOURCC('J', 'U', 'N', 'K')
/*
** Useful macros
**
** Warning: These are nasty macro, and MS C 6.0 compiles some of them
** incorrectly if optimizations are on. Ack.
*/
/* Macro to get stream number out of a FOURCC ckid */
#define FromHex(n) (((n) >= 'A') ? ((n) + 10 - 'A') : ((n) - '0'))
#define StreamFromFOURCC(fcc) ((WORD) ((FromHex(LOBYTE(LOWORD(fcc))) << 4) + \
(FromHex(HIBYTE(LOWORD(fcc))))))
/* Macro to get TWOCC chunk type out of a FOURCC ckid */
#define TWOCCFromFOURCC(fcc) HIWORD(fcc)
/* Macro to make a ckid for a chunk out of a TWOCC and a stream number
** from 0-255.
*/
#define ToHex(n) ((BYTE) (((n) > 9) ? ((n) - 10 + 'A') : ((n) + '0')))
#define MAKEAVICKID(tcc, stream) \
MAKELONG((ToHex((stream) & 0x0f) << 8) | \
(ToHex(((stream) & 0xf0) >> 4)), tcc)
/*
** Main AVI File Header
*/
/* flags for use in <dwFlags> in AVIFileHdr */
#define AVIF_HASINDEX 0x00000010 // Index at end of file?
#define AVIF_MUSTUSEINDEX 0x00000020
#define AVIF_ISINTERLEAVED 0x00000100
#define AVIF_WASCAPTUREFILE 0x00010000
#define AVIF_COPYRIGHTED 0x00020000
/* The AVI File Header LIST chunk should be padded to this size */
#define AVI_HEADERSIZE 2048 // size of AVI header list
typedef struct
{
DWORD dwMicroSecPerFrame; // frame display rate (or 0L)
DWORD dwMaxBytesPerSec; // max. transfer rate
DWORD dwPaddingGranularity; // pad to multiples of this
// size; normally 2K.
DWORD dwFlags; // the ever-present flags
DWORD dwTotalFrames; // # frames in file
DWORD dwInitialFrames;
DWORD dwStreams;
DWORD dwSuggestedBufferSize;
DWORD dwWidth;
DWORD dwHeight;
DWORD dwReserved[4];
} MainAVIHeader;
/*
** Stream header
*/
#define AVISF_DISABLED 0x00000001
#define AVISF_VIDEO_PALCHANGES 0x00010000
typedef struct {
FOURCC fccType;
FOURCC fccHandler;
DWORD dwFlags; /* Contains AVITF_* flags */
WORD wPriority;
WORD wLanguage;
DWORD dwInitialFrames;
DWORD dwScale;
DWORD dwRate; /* dwRate / dwScale == samples/second */
DWORD dwStart;
DWORD dwLength; /* In units above... */
DWORD dwSuggestedBufferSize;
DWORD dwQuality;
DWORD dwSampleSize;
RECT rcFrame;
} AVIStreamHeader;
/* Flags for index */
#define AVIIF_LIST 0x00000001L // chunk is a 'LIST'
#define AVIIF_KEYFRAME 0x00000010L // this frame is a key frame.
#define AVIIF_NOTIME 0x00000100L // this frame doesn't take any time
#define AVIIF_COMPUSE 0x0FFF0000L // these bits are for compressor use
typedef struct
{
DWORD ckid;
DWORD dwFlags;
DWORD dwChunkOffset; // Position of chunk
DWORD dwChunkLength; // Length of chunk
} AVIINDEXENTRY;
/*
** Palette change chunk
**
** Used in video streams.
*/
typedef struct
{
BYTE bFirstEntry; /* first entry to change */
BYTE bNumEntries; /* # entries to change (0 if 256) */
WORD wFlags; /* Mostly to preserve alignment... */
PALETTEENTRY peNew[]; /* New color specifications */
} AVIPALCHANGE;
#ifdef __cplusplus
} /* End of extern "C" { */
#endif /* __cplusplus */
#endif /* _INC_AVIFMT */

224
avifile/DOCS/AVIIFACE.H Normal file
View File

@@ -0,0 +1,224 @@
/****************************************************************************
*
* AVIIFACE.H
*
* Interface definitions for AVIFile
*
* Copyright (c) 1992, 1993 Microsoft Corporation. All Rights Reserved.
*
* You have a royalty-free right to use, modify, reproduce and
* distribute the Sample Files (and/or any modified version) in
* any way you find useful, provided that you agree that
* Microsoft has no warranty obligations or liability for any
* Sample Application Files which are modified.
*
***************************************************************************/
#include <compobj.h>
#ifndef RIID
#if defined(__cplusplus)
#define RIID IID FAR&
#define RCLSID CLSID FAR&
#else
#define RIID IID FAR*
#define RCLSID CLSID FAR*
#endif
#endif
/* - - - - - - - - */
/****** AVI Stream Interface *******************************************/
#undef INTERFACE
#define INTERFACE IAVIStream
DECLARE_INTERFACE_(IAVIStream, IUnknown)
{
// *** IUnknown methods ***
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// *** IAVIStream methods ***
STDMETHOD(Create) (THIS_ LPARAM lParam1, LPARAM lParam2) PURE ;
STDMETHOD(Info) (THIS_ AVISTREAMINFO FAR * psi, LONG lSize) PURE ;
STDMETHOD_(LONG, FindSample)(THIS_ LONG lPos, LONG lFlags) PURE ;
STDMETHOD(ReadFormat) (THIS_ LONG lPos,
LPVOID lpFormat, LONG FAR *lpcbFormat) PURE ;
STDMETHOD(SetFormat) (THIS_ LONG lPos,
LPVOID lpFormat, LONG cbFormat) PURE ;
STDMETHOD(Read) (THIS_ LONG lStart, LONG lSamples,
LPVOID lpBuffer, LONG cbBuffer,
LONG FAR * plBytes, LONG FAR * plSamples) PURE ;
STDMETHOD(Write) (THIS_ LONG lStart, LONG lSamples,
LPVOID lpBuffer, LONG cbBuffer,
DWORD dwFlags,
LONG FAR *plSampWritten,
LONG FAR *plBytesWritten) PURE ;
STDMETHOD(Delete) (THIS_ LONG lStart, LONG lSamples) PURE;
STDMETHOD(ReadData) (THIS_ DWORD fcc, LPVOID lp, LONG FAR *lpcb) PURE ;
STDMETHOD(WriteData) (THIS_ DWORD fcc, LPVOID lp, LONG cb) PURE ;
STDMETHOD(Reserved1) (THIS) PURE;
STDMETHOD(Reserved2) (THIS) PURE;
STDMETHOD(Reserved3) (THIS) PURE;
STDMETHOD(Reserved4) (THIS) PURE;
STDMETHOD(Reserved5) (THIS) PURE;
};
typedef IAVIStream FAR* PAVISTREAM;
#undef INTERFACE
#define INTERFACE IAVIStreaming
DECLARE_INTERFACE_(IAVIStreaming, IUnknown)
{
// *** IUnknown methods ***
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// *** IAVIStreaming methods ***
STDMETHOD(Begin) (THIS_
LONG lStart, // start of what we expect
// to play
LONG lEnd, // expected end, or -1
LONG lRate) PURE; // Should this be a float?
STDMETHOD(End) (THIS) PURE;
};
typedef IAVIStreaming FAR* PAVISTREAMING;
#undef INTERFACE
#define INTERFACE IAVIEditStream
DECLARE_INTERFACE_(IAVIEditStream, IUnknown)
{
// *** IUnknown methods ***
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// *** IAVIEditStream methods ***
STDMETHOD(Cut) (THIS_ LONG FAR *plStart,
LONG FAR *plLength,
PAVISTREAM FAR * ppResult) PURE;
STDMETHOD(Copy) (THIS_ LONG FAR *plStart,
LONG FAR *plLength,
PAVISTREAM FAR * ppResult) PURE;
STDMETHOD(Paste) (THIS_ LONG FAR *plPos,
LONG FAR *plLength,
PAVISTREAM pstream,
LONG lStart,
LONG lEnd) PURE;
STDMETHOD(Clone) (THIS_ PAVISTREAM FAR *ppResult) PURE;
STDMETHOD(SetInfo) (THIS_ AVISTREAMINFO FAR * lpInfo,
LONG cbInfo) PURE;
};
typedef IAVIEditStream FAR* PAVIEDITSTREAM;
/****** AVI File Interface *******************************************/
#undef INTERFACE
#define INTERFACE IAVIFile
#define PAVIFILE IAVIFile FAR*
DECLARE_INTERFACE_(IAVIFile, IUnknown)
{
// *** IUnknown methods ***
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// *** IAVIFile methods ***
STDMETHOD(Open) (THIS_
LPCSTR szFile,
UINT mode) PURE;
STDMETHOD(Info) (THIS_
AVIFILEINFO FAR * pfi,
LONG lSize) PURE;
STDMETHOD(GetStream) (THIS_
PAVISTREAM FAR * ppStream,
DWORD fccType,
LONG lParam) PURE;
STDMETHOD(CreateStream) (THIS_
PAVISTREAM FAR * ppStream,
AVISTREAMINFO FAR * psi) PURE;
STDMETHOD(Save) (THIS_
LPCSTR szFile,
AVICOMPRESSOPTIONS FAR *lpOptions,
AVISAVECALLBACK lpfnCallback) PURE;
STDMETHOD(WriteData) (THIS_
DWORD ckid,
LPVOID lpData,
LONG cbData) PURE;
STDMETHOD(ReadData) (THIS_
DWORD ckid,
LPVOID lpData,
LONG FAR *lpcbData) PURE;
STDMETHOD(EndRecord) (THIS) PURE;
STDMETHOD(Reserved1) (THIS) PURE;
STDMETHOD(Reserved2) (THIS) PURE;
STDMETHOD(Reserved3) (THIS) PURE;
STDMETHOD(Reserved4) (THIS) PURE;
STDMETHOD(Reserved5) (THIS) PURE;
};
#undef PAVIFILE
typedef IAVIFile FAR* PAVIFILE;
/****** GetFrame Interface *******************************************/
#undef INTERFACE
#define INTERFACE IGetFrame
#define PGETFRAME IGetFrame FAR*
DECLARE_INTERFACE_(IGetFrame, IUnknown)
{
// *** IUnknown methods ***
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// *** IGetFrame methods ***
STDMETHOD_(LPVOID,GetFrame) (THIS_ LONG lPos) PURE;
// STDMETHOD_(LPVOID,GetFrameData) (THIS_ LONG lPos) PURE;
STDMETHOD(Begin) (THIS_ LONG lStart, LONG lEnd, LONG lRate) PURE;
STDMETHOD(End) (THIS) PURE;
STDMETHOD(SetFormat) (THIS_ LPBITMAPINFOHEADER lpbi, LPVOID lpBits, int x, int y, int dx, int dy) PURE;
// STDMETHOD(DrawFrameStart) (THIS) PURE;
// STDMETHOD(DrawFrame) (THIS_ LONG lPos, HDC hdc, int x, int y, int dx, int dy) PURE;
// STDMETHOD(DrawFrameEnd) (THIS) PURE;
};
#undef PGETFRAME
typedef IGetFrame FAR* PGETFRAME;
/****** GUIDs *******************************************/
#define DEFINE_AVIGUID(name, l, w1, w2) \
DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46)
DEFINE_AVIGUID(IID_IAVIFile, 0x00020020, 0, 0);
DEFINE_AVIGUID(IID_IAVIStream, 0x00020021, 0, 0);
DEFINE_AVIGUID(IID_IAVIStreaming, 0x00020022, 0, 0);
DEFINE_AVIGUID(IID_IGetFrame, 0x00020023, 0, 0);
DEFINE_AVIGUID(IID_IAVIEditStream, 0x00020024, 0, 0);
DEFINE_AVIGUID(CLSID_AVISimpleUnMarshal, 0x00020009, 0, 0);
#define AVIFILEHANDLER_CANREAD 0x0001
#define AVIFILEHANDLER_CANWRITE 0x0002
#define AVIFILEHANDLER_CANACCEPTNONRGB 0x0004