Identifying Video Sources
The toolbox defines a video source as one or more hardware inputs that are treated as a single entity. For example, an image acquisition device might support an RGB source that is made up of three physical connections. The toolbox would treat the three connections as a single video source. Read the documentation that came with your device to determine the video sources it supports.
When a user creates a video input object, the toolbox engine automatically creates a
video source object for each source supported by an adaptor. The Source
property of the video input object lists the available video sources. The video source
object that is used to acquire data is called the currently selected video source. By
default, the toolbox engine uses the first video source you define as the selected source,
but users can switch the selected source by setting the value of the video input object's
SelectedSourceName
property.
Suggested Algorithm
Your adaptor's getDeviceAttributes()
function must define all the
properties and sources of video data you want to make available to users. This section
only covers defining video sources, which means determining the text labels used to
identify the available video sources. For information about making device properties
available to users, see Defining Device-Specific Properties.
Note
Every adaptor must specify at least one video source; otherwise, you cannot create a video input object if a video source has not been specified.
You use the addAdaptorSource()
member function of the
IVideoSourceInfo
object that the toolbox engine passes to your
adaptor's getDeviceAttributes()
function to define a video source.
You specify the following two arguments:
Name you want to assign to the source
ID you want to assign to the source
The name is visible to users. Choose a name that clearly identifies the source. If
the device vendor assigns names to the sources, you can use the same names. For example,
Matrox some devices identify video sources by the labels ch0
,
ch1
, etc.
Because the ID is not exposed to users, you can specify any convenient value. For example, if the device's SDK uses numerical identifiers to indicate a video source, use these values for your source IDs.
For example, this code specifies a video source.
sourceContainer->addAdaptorSource("MyDeviceSource",1)
You can use IVideoSourceInfo
member functions to perform many
tasks, such as determining the currently selected source. For more information about
this class, see the Image Acquisition Toolbox™ Adaptor Kit API Reference documentation.