The capDriverGetCaps macro returns the hardware capabilities of the capture driver currently connected to a capture window.呼叫了這個函數後, 我們的應用程式就會得知你的電腦中代表該視訊驅動程式的索引值, 你的視訊裝置有沒有提供影像 Overlay 模式, 提供了哪些對話盒供你呼叫使用...等等。
capDriverGetCaps(
hwnd,
psCaps,
wSize
);
Parameters
hwnd Handle of a capture window.
psCaps Address of the CAPDRIVERCAPS structure to contain the hardware capabilities.
wSize Size, in bytes, of the structure referenced by s.
Return Values
Returns TRUE if successful or FALSE if the capture window is not connected to a capture driver.
Remarks
The capabilities returned in CAPDRIVERCAPS are constant for a given capture driver. Applications need to retrieve this information once when the capture driver is first connected to a capture window.
既然這個函數要告訴我們這麼多資料, 顯然呼叫時, 就要設定很多個輸入或輸出的參數。為了方便我們使用, VFW 所採用的作法就是在 vfw.h, line 3493 起, 宣告了 tagCapDriverCaps 結構資料型態
typedef struct tagCapDriverCaps {因此, 我們只要在程式中宣告一個變數 s 屬於 tagCapDriverCaps 資料型態, 我們就可以將 s 的位址 &s 放到 capDriverGetCaps 的參數之中來用了。
UINT 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?
// following always NULL on Win32.
HANDLE hVideoIn; // Driver In channel
HANDLE hVideoOut; // Driver Out channel
HANDLE hVideoExtIn; // Driver Ext In channel
HANDLE hVideoExtOut; // Driver Ext Out channel
} CAPDRIVERCAPS, *PCAPDRIVERCAPS, FAR *LPCAPDRIVERCAPS;
範例程式:
// 宣告部份:
tagCapDriverCaps s;
// 呼叫與傳回值使用部份
if (capDriverGetCaps(hwndVideo,&s,sizeof(s)))
{
if ( s.fHasOverlay )
lblOverlay->Caption = AnsiString("Overlay: Yes");
else
lblOverlay->Caption = AnsiString("Overlay: No");
}
No comments:
Post a Comment