Miscellaneous device control (GPIO, VPD, etc...)
Vendor-specific features of some video capture devices, like the GPIO, VPD, etc., can be controlled:
- the current state or data can be retrieved by invoking GetMiscDeviceControl,
- the new state or data can be put or set by invoking PutMiscDeviceControl.
GPIO
Setting the GPIO output state
Invoke PutMiscDeviceControl (mdc_GPIO, ...):
- set the Index parameter to the output number (in the 0..3 range),
- set the Value parameter to 1 to activate the output, or 0 to deactivate it.
E.g.:
PutMiscDeviceControl (mdc_GPIO, 2, 0)deactivates the output 2,PutMiscDeviceControl (mdc_GPIO, 3, 1)activates the output 3.
This function returns true upon success (the preview or recording must be running).
Getting the current GPIO output state
Invoke GetMiscDeviceControl (mdc_GPIO, ...).
The Index parameter specifies the output number (in the 0..3 range).
This function returns:
- 1 if the output is active,
- 0 if the output is inactive,
- -1 if the device does not support this feature or if the preview or recording is not running.
E.g.:
if GetMiscDeviceControl (mdc_GPIO, 1) = 1 then
output is currently enabled
else
output is currently disabled
VPD
The VPD (Vital Private Data) is made of an array of 8 bytes and can be set individually for each output.
Writing the VPD
- Initialize each of the 8 bytes of the array individually by invoking PutMiscDeviceControl (mdc_VPD_Data, index in the array, value), with the index in the [0..7] range and the value in the [0..255] range (byte).
- Invoke PutMiscDeviceControl (mdc_VPD, 0, 0).
E.g. to initialize the VPD with 12, 240, 25, 54, 11, 66, 120, 211, invoke:
PutMiscDeviceControl (mdc_VPD_Data, 0, 12)
PutMiscDeviceControl (mdc_VPD_Data, 1, 240)
PutMiscDeviceControl (mdc_VPD_Data, 2, 25)
PutMiscDeviceControl (mdc_VPD_Data, 3, 54)
PutMiscDeviceControl (mdc_VPD_Data, 4, 11)
PutMiscDeviceControl (mdc_VPD_Data, 5, 66)
PutMiscDeviceControl (mdc_VPD_Data, 6, 120)
PutMiscDeviceControl (mdc_VPD_Data, 7, 211)
if PutMiscDeviceControl (mdc_VPD, 0, 0) then
MsgBox "success"
else
MsgBox "not supported"
end if
Verifying the VPD
- Initialize the VPD data array by invoking PutMiscDeviceControl (mdc_VPD_Data, ...) as above.
- Invoke GetMiscDeviceControl (mdc_VPD, 0).
E.g.:
PutMiscDeviceControl (mdc_VPD_Data, 0, 12)
PutMiscDeviceControl (mdc_VPD_Data, 1, 240)
PutMiscDeviceControl (mdc_VPD_Data, 2, 25)
PutMiscDeviceControl (mdc_VPD_Data, 3, 54)
PutMiscDeviceControl (mdc_VPD_Data, 4, 11)
PutMiscDeviceControl (mdc_VPD_Data, 5, 66)
PutMiscDeviceControl (mdc_VPD_Data, 6, 120)
PutMiscDeviceControl (mdc_VPD_Data, 7, 211)
if GetMiscDeviceControl (mdc_VPD, 0) = 1 then
MsgBox "VPD correct"
else
MsgBox "wrong VPD or feature not supported"
end if