How to select and configure a video capture device

One of the most significant features of the  MontiVision Smart Control is the ability to change a video source filter within a filter configuration. This function allows the use of different video sources and video formats in an application. To further assist fast and efficient project development, the MontiVision Development Kit provides a number of  helper controls.

Background information

The primary purpose of the MontiVision Smart Control  is to load and activate a filter configuration saved in a MontiVision Project File (*.mvp). This file contains information about the filters, connections, video formats and configurations, and theIMVSCFilterGraph::LoadConfig method uses this information to build a filter graph. Normally, due to the static media formats between the filters, you cannot change the video source filter without disrupting the rest of the filter graph (unless the new source use the same format and resolution). To overcome this limitation of DirectShow filter graphs, the  MontiVision Smart Control is enhanced with the ability to rebuild a filter configuration with even a different video source or resolution! .

How to use the Control

The MontiVision Smart Control contains the IMVSCSetSourceFilter  interface, exposing only one method: The SetSourceFilter method changes a source filter within a filter configuration. The best way to use this method is to call it before IMVSCFilterGraph::LoadConfig. It will need the source filter label as specified within the filter configuration (e.g. "VideoSource") in order to replace it with a new one. For this purpose, the method has a parameter for the display name of the source device. The display name is a long string that describes the source device in detail. To get more information about display names, see the relevant COM documentation. 

To get the display name for all available video devices the MontiVision Development Kit provides the MV VideoSourceComboBox. Some video devices such as capture cards contain more than one hardware input. To select the input from these sorts of video devices, use the  MV SelectInputComboBox.

Many of the MontiVision Smart Control sample applications use these controls to select the video device.

Video device configuration

To setup a video source device the  MontiVision Smart Control provides the IMVSCCameraControl interface. This interface exposes methods to setup camera settings such as contrast, brightness, zoom. Not all video source devices provide parameters you may hope or expect to be able to configure. For this reason, you will need to determine the available parameters and their range through use of the  IMVSCCameraControl::GetPropertyRange method.

To change a video source parameter use the  IMVSCCameraControl::GetProperty and IMVSCCameraControl::SetProperty . Last but not least, the  IMVSCCameraControl  interface contains methods to load and save the complete camera setup into the registry. These methods are  IMVSCCameraControl::Load and IMVSCCameraControl::Save.

Filter graph

If you want to create and distribute applications that will use different types of video sources you should replace all video sources within your filter graph with the  MV Demo Source Filter. This filter uses only RGB24 output format and so it does not require converters, crossbars or decompressor filters, making it the most efficient "stand-in" source filter for such a distributed application. Look at the samples application how to use the MV Demo Source Filter  as default video source.