Video Acquisition: Codec Property Page

Short source code snippet that illustrates how to modify the properties of a codec using IC Imaging Control.
Language:.NET C#/Visual Basic
Version:3.0.3
Released on:April 7, 2005
Author:IC Imaging Control Support Department
Requirements:IC Imaging Control >2.1
Camera, converter or grabber with WDM Stream Class drivers.

Form of the Codec Properties sample.

First of all, a listbox and button are dragged onto the form. These are labeled lstCodecs and btnShowPropertyPage respectively. The listbox will be used to list all available codecs and the button will be used to show the property page of the currently selected codec.

The sample application fills the list lstCodecs with the names of all codecs that are installed on the computer (see dialog on the right). The collection .AviCompressors is used for this task. This collection contains all available AVI codecs. It is simply passed to the listbox's lstCodecs property DataSource. Thus, the data in the listbox lstCodecs will contain all information about the currently available codecs.

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

When the user clicks on one of the listed codecs, the event list box's handler calls the corresponding AviCompressor object and checks whether it provides a property page, by querying AviCompressor.PropertyPageAvailable. If AviCompressor.PropertyPageAvailable returns true, the button btnShowPropertyPage is enabled. Otherwise, it is disabled.

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

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

By clicking on the button btnShowPropertyPage, the user can open a dialog to modify the properties of the selected codec. The method AviCompressor.ShowPropertyPage() is called in the button event handler. This method shows the codec's property dialog.

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

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

Related Source Code Samples

Disclaimer
The source code that appears in the IC Imaging Control Source Code Library is indented for educational purposes only. The Imaging Source Europe GmbH, the manufacturer of IC Imaging Control, does not assume any kind of warranty expressed or implied, resulting from the use of the content of this page.

This site is part of The Imaging Source Network. Other sites include Company Portal, Image Processing, Astronomy Cameras, Astronomy Cameras Blog, Blog caméras d'astronomie, Astronomy Cameras Competition, TX Text Control, LiveDocx, phpLiveDocx and Forums.