/*
 * Copyright (c) 2010-2022 Belledonne Communications SARL.
 *
 * This file is part of mediastreamer2
 * (see https://gitlab.linphone.org/BC/public/mediastreamer2).
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef vfw_missing_h
#define vfw_missing_h

typedef struct videohdr_tag {
	LPBYTE lpData;           /* pointer to locked data buffer */
	DWORD dwBufferLength;    /* Length of data buffer */
	DWORD dwBytesUsed;       /* Bytes actually used */
	DWORD dwTimeCaptured;    /* Milliseconds from start of stream */
	DWORD_PTR dwUser;        /* for client's use */
	DWORD dwFlags;           /* assorted flags (see defines) */
	DWORD_PTR dwReserved[4]; /* reserved for driver */
} VIDEOHDR, NEAR *PVIDEOHDR, FAR *LPVIDEOHDR;

typedef struct tagCaptureParms {
	DWORD dwRequestMicroSecPerFrame; // Requested capture rate
	BOOL fMakeUserHitOKToCapture;    // Show "Hit OK to cap" dlg?
	UINT wPercentDropForError;       // Give error msg if > (10%)
	BOOL fYield;                     // Capture via background task?
	DWORD dwIndexSize;               // Max index size in frames (32K)
	UINT wChunkGranularity;          // Junk chunk granularity (2K)
	BOOL fUsingDOSMemory;            // Use DOS buffers?
	UINT wNumVideoRequested;         // # video buffers, If 0, autocalc
	BOOL fCaptureAudio;              // Capture audio?
	UINT wNumAudioRequested;         // # audio buffers, If 0, autocalc
	UINT vKeyAbort;                  // Virtual key causing abort
	BOOL fAbortLeftMouse;            // Abort on left mouse?
	BOOL fAbortRightMouse;           // Abort on right mouse?
	BOOL fLimitEnabled;              // Use wTimeLimit?
	UINT 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
	UINT wStepCaptureAverageFrames;  // Temporal average n Frames
	DWORD dwAudioBufferSize;         // Size of audio bufs (0 = default)
	BOOL fDisableWriteCache;         // Attempt to disable write cache
	UINT AVStreamMaster;             // Which stream controls length?
} CAPTUREPARMS, *PCAPTUREPARMS, FAR *LPCAPTUREPARMS;

typedef struct {
	UINT uiImageWidth;
	UINT uiImageHeight;
	BOOL fLiveWindow;
	BOOL fOverlayWindow;
	BOOL fScale;
	POINT ptScroll;
	BOOL fUsingDefaultPalette;
	BOOL fAudioHardware;
	BOOL fCapFileExists;
	DWORD dwCurrentVideoFrame;
	DWORD dwCurrentVideoFramesDropped;
	DWORD dwCurrentWaveSamples;
	DWORD dwCurrentTimeElapsedMS;
	HPALETTE hPalCurrent;
	BOOL fCapturingNow;
	DWORD dwReturn;
	UINT wNumVideoAllocated;
	UINT wNumAudioAllocated;
} CAPSTATUS, *PCAPSTATUS, FAR *LPCAPSTATUS;

#ifdef __cplusplus
/* SendMessage in C++*/
#define AVICapSM(hwnd, m, w, l) ((::IsWindow(hwnd)) ? ::SendMessage(hwnd, m, w, l) : 0)
#else
/* SendMessage in C */
#define AVICapSM(hwnd, m, w, l) ((IsWindow(hwnd)) ? SendMessage(hwnd, m, w, l) : 0)
#endif /* __cplusplus */

#define WM_CAP_START WM_USER

// start of unicode messages
#define WM_CAP_UNICODE_START WM_USER + 100

#define WM_CAP_GET_CAPSTREAMPTR (WM_CAP_START + 1)

#define WM_CAP_SET_CALLBACK_ERRORW (WM_CAP_UNICODE_START + 2)
#define WM_CAP_SET_CALLBACK_STATUSW (WM_CAP_UNICODE_START + 3)
#define WM_CAP_SET_CALLBACK_ERRORA (WM_CAP_START + 2)
#define WM_CAP_SET_CALLBACK_STATUSA (WM_CAP_START + 3)
#ifdef UNICODE
#define WM_CAP_SET_CALLBACK_ERROR WM_CAP_SET_CALLBACK_ERRORW
#define WM_CAP_SET_CALLBACK_STATUS WM_CAP_SET_CALLBACK_STATUSW
#else
#define WM_CAP_SET_CALLBACK_ERROR WM_CAP_SET_CALLBACK_ERRORA
#define WM_CAP_SET_CALLBACK_STATUS WM_CAP_SET_CALLBACK_STATUSA
#endif

#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_NAMEA (WM_CAP_START + 12)
#define WM_CAP_DRIVER_GET_VERSIONA (WM_CAP_START + 13)
#define WM_CAP_DRIVER_GET_NAMEW (WM_CAP_UNICODE_START + 12)
#define WM_CAP_DRIVER_GET_VERSIONW (WM_CAP_UNICODE_START + 13)
#ifdef UNICODE
#define WM_CAP_DRIVER_GET_NAME WM_CAP_DRIVER_GET_NAMEW
#define WM_CAP_DRIVER_GET_VERSION WM_CAP_DRIVER_GET_VERSIONW
#else
#define WM_CAP_DRIVER_GET_NAME WM_CAP_DRIVER_GET_NAMEA
#define WM_CAP_DRIVER_GET_VERSION WM_CAP_DRIVER_GET_VERSIONA
#endif

#define WM_CAP_DRIVER_GET_CAPS (WM_CAP_START + 14)

#define WM_CAP_FILE_SET_CAPTURE_FILEA (WM_CAP_START + 20)
#define WM_CAP_FILE_GET_CAPTURE_FILEA (WM_CAP_START + 21)
#define WM_CAP_FILE_SAVEASA (WM_CAP_START + 23)
#define WM_CAP_FILE_SAVEDIBA (WM_CAP_START + 25)
#define WM_CAP_FILE_SET_CAPTURE_FILEW (WM_CAP_UNICODE_START + 20)
#define WM_CAP_FILE_GET_CAPTURE_FILEW (WM_CAP_UNICODE_START + 21)
#define WM_CAP_FILE_SAVEASW (WM_CAP_UNICODE_START + 23)
#define WM_CAP_FILE_SAVEDIBW (WM_CAP_UNICODE_START + 25)
#ifdef UNICODE
#define WM_CAP_FILE_SET_CAPTURE_FILE WM_CAP_FILE_SET_CAPTURE_FILEW
#define WM_CAP_FILE_GET_CAPTURE_FILE WM_CAP_FILE_GET_CAPTURE_FILEW
#define WM_CAP_FILE_SAVEAS WM_CAP_FILE_SAVEASW
#define WM_CAP_FILE_SAVEDIB WM_CAP_FILE_SAVEDIBW
#else
#define WM_CAP_FILE_SET_CAPTURE_FILE WM_CAP_FILE_SET_CAPTURE_FILEA
#define WM_CAP_FILE_GET_CAPTURE_FILE WM_CAP_FILE_GET_CAPTURE_FILEA
#define WM_CAP_FILE_SAVEAS WM_CAP_FILE_SAVEASA
#define WM_CAP_FILE_SAVEDIB WM_CAP_FILE_SAVEDIBA
#endif

// out of order to save on ifdefs
#define WM_CAP_FILE_ALLOCATE (WM_CAP_START + 22)
#define WM_CAP_FILE_SET_INFOCHUNK (WM_CAP_START + 24)

#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_DEVICEA (WM_CAP_START + 66)
#define WM_CAP_GET_MCI_DEVICEA (WM_CAP_START + 67)
#define WM_CAP_SET_MCI_DEVICEW (WM_CAP_UNICODE_START + 66)
#define WM_CAP_GET_MCI_DEVICEW (WM_CAP_UNICODE_START + 67)
#ifdef UNICODE
#define WM_CAP_SET_MCI_DEVICE WM_CAP_SET_MCI_DEVICEW
#define WM_CAP_GET_MCI_DEVICE WM_CAP_GET_MCI_DEVICEW
#else
#define WM_CAP_SET_MCI_DEVICE WM_CAP_SET_MCI_DEVICEA
#define WM_CAP_GET_MCI_DEVICE WM_CAP_GET_MCI_DEVICEA
#endif

#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_OPENA (WM_CAP_START + 80)
#define WM_CAP_PAL_SAVEA (WM_CAP_START + 81)
#define WM_CAP_PAL_OPENW (WM_CAP_UNICODE_START + 80)
#define WM_CAP_PAL_SAVEW (WM_CAP_UNICODE_START + 81)
#ifdef UNICODE
#define WM_CAP_PAL_OPEN WM_CAP_PAL_OPENW
#define WM_CAP_PAL_SAVE WM_CAP_PAL_SAVEW
#else
#define WM_CAP_PAL_OPEN WM_CAP_PAL_OPENA
#define WM_CAP_PAL_SAVE WM_CAP_PAL_SAVEA
#endif

#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)

// Following added post VFW 1.1
#define WM_CAP_SET_CALLBACK_CAPCONTROL (WM_CAP_START + 85)

// Defines end of the message range
#define WM_CAP_UNICODE_END WM_CAP_PAL_SAVEW
#define WM_CAP_END WM_CAP_UNICODE_END

#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 capSetCallbackOnCapControl(hwnd, fpProc)                                                                       \
	((BOOL)AVICapSM(hwnd, WM_CAP_SET_CALLBACK_CAPCONTROL, 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)(LPTSTR)(szName)))
#define capDriverGetVersion(hwnd, szVer, wSize)                                                                        \
	((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_GET_VERSION, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPTSTR)(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)(LPTSTR)(szName)))
#define capFileGetCaptureFile(hwnd, szName, wSize)                                                                     \
	((BOOL)AVICapSM(hwnd, WM_CAP_FILE_GET_CAPTURE_FILE, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPTSTR)(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)(LPTSTR)(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)(LPTSTR)(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)0L))

#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, 0L))
#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)(LPTSTR)(szName)))
#define capGetMCIDeviceName(hwnd, szName, wSize)                                                                       \
	((BOOL)AVICapSM(hwnd, WM_CAP_GET_MCI_DEVICE, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPTSTR)(szName)))

#define capPaletteOpen(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_OPEN, 0, (LPARAM)(LPVOID)(LPTSTR)(szName)))
#define capPaletteSave(hwnd, szName) ((BOOL)AVICapSM(hwnd, WM_CAP_PAL_SAVE, 0, (LPARAM)(LPVOID)(LPTSTR)(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)))

#define AVSTREAMMASTER_AUDIO 0 /* Audio master (VFW 1.0, 1.1) */
#define AVSTREAMMASTER_NONE 1  /* No master */

#endif
