視頻採集: 編碼屬性頁面

下面這個示例程序將演示如何使用 IC Imaging Control 設置視頻編碼的屬性。
語言:.NET C#/Visual Basic
版本:3.0.3
发布于:2005年4月7日
作者:IC Imaging Control 技術支持部
需求:IC Imaging Control >2.1
由WDM數據流類驅動程序驅動的相機、視頻轉換器或圖像采集卡

Form of the Codec Properties sample.

首先,在窗體中放置一個 listbox 和 一個按鈕。 分別將它們命名為 lstCodecsbtnShowPropertyPage。 列表框用於顯示系統中所有的視頻編碼方式,按鈕用於顯示當前選中編碼的屬性對話框。

程序首先把操作系統中所有已安裝的編碼列於lstCodecs中, 這裏需要使用.AviCompressors集合,因為它包含了所有的AVI編碼方式。 程序只需把該集合賦值給 lstCodecsDataSource 屬性, 列表框 lstCodecs 即可顯示出所有的編碼了。

[C#]
private void Form1_Load(object sender, System.EventArgs e)
{
    lstCodecs.DataSource = icImagingControl1.AviCompressors;
}

當用戶點擊列表中的某種編碼後,列表框的事件處理程序將調用相應的 AviCompressor 對象,並通過AviCompressor.PropertyPageAvailable檢測該編碼方式是否提供屬性頁面。 如果 AviCompressor.PropertyPageAvailable 返回值為 true,按鈕 btnShowPropertyPage 變為可用, 否則為不可用狀態。

[C#]
private void lstCodecs_SelectedIndexChanged(object sender, System.EventArgs e)
{
    AviCompressor codec = lstCodecs.SelectedItem as AviCompressor;

    if( codec != null )
    {
        btnShowPropertyPage.Enabled = codec.PropertyPageAvailable;
    }
}

點擊btnShowPropertyPage按鈕,用戶將打開一個對話框,用以修改所選編碼的屬性。 在按鈕的事件處理程序中調用 AviCompressor.ShowPropertyPage() 方法,將打開編碼屬性對話框。

[C#]
private void btnShowPropertyPage_Click(object sender, System.EventArgs e)
{
    AviCompressor codec = lstCodecs.SelectedItem as AviCompressor;

    if( codec != null )
    {
        codec.ShowPropertyPage();
    }
}

相關源代碼示例

責任聲明
IC Imaging Control源代碼庫中的所有代碼均只用於教學目的,The Imaging Source Europe GmbH作為IC Imaging Control的開發製造商,不對任何由於使用本文或其中源代碼所產生的後果承擔責任。

该网站为The Imaging Source网络的一部分。其它的站点包括 公司, Imaging, 天文相機, Astronomy Cameras Blog, Blog caméras d'astronomie, 天文相機有獎競答, TX Text Control, LiveDocx, phpLiveDocxForum.