共用方式為


從 AVI 檔案中讀取串流

[與此頁面相關聯的功能,AVIFile 函式和巨集,是舊版功能。 來源讀取器已取代它。 來源讀取器 已針對 Windows 10 和 Windows 11 優化。 Microsoft強烈建議新程式碼盡可能使用 Source Reader,而不是 AVIFile 函式和巨集。 Microsoft建議使用舊版 API 的現有程式代碼,盡可能改寫成使用新的 API。]

下列子程式會從 AVI 檔案取得數據流資訊,並從 AVISTREAMINFO 結構判斷 AVIStreamInfo 函式所傳回的數據流類型。

// StreamTypes - opens the streams in an AVI file and determines 
// stream types. 
// 
// Global variables 
// gcpavi - count of streams in an AVI file 
// gapavi[] = array of stream-interface pointers 
 
void StreamTypes(HWND hwnd) 
{ 
    AVISTREAMINFO     avis; 
    LONG    r, lHeight = 0; 
    WORD    w; 
    int     i; 
    RECT    rc; 
 
// Walk through all streams. 
    for (i = 0; i < gcpavi; i++) { 
        AVIStreamInfo(gapavi[i], &avis, sizeof(avis)); 
 
        if (avis.fccType == streamtypeVIDEO) { 
 
        // Place video-processing functions here. 
 
        } 
        else if (avis.fccType == streamtypeAUDIO) { 
 
        // Place audio-processing functions here. 
 
        } 
        else if (avis.fccType == streamtypeTEXT) { 
 
        // Place text-processing functions here. 
 
        } 
    } 
}