视频采集: 编码属性页面

下面这个示例程序将演示如何使用 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.