Compartilhar via


Device Mode

 
Microsoft DirectShow 9.0

Device Mode

IEEE 1394 and USB camcorders can switch between camera mode and video tape recorder (VTR) mode. When an IEEE 1394 camcorder switches modes, the device resets and the application must enumerate it again. There is no way for an application to switch the mode programmatically. USB camcorders, on the other hand, can switch between camera and VTR modes without resetting, and the application can change the mode.

MSDV Driver

To get the current mode on an IEEE 1394 device, call the IAMExtDevice::GetCapability method with the value ED_DEVCAP_DEVICE_TYPE. If the method returns the value ED_DEVTYPE_VCR, the device is in VTR mode and has functions such as pause, stop, fast-forward, and rewind. Otherwise, if the method returns ED_DEVTYPE_CAMERA, the device is in camera mode. The following code example shows how to query the device type:

if (MyDevCap.bHasDevice) 
{
    LONG lDeviceType = 0;
    MyDevCap.pDevice->GetCapability(ED_DEVCAP_DEVICE_TYPE, &lDeviceType, 0);

    if (lDeviceType == ED_DEVTYPE_VCR) 
    {
        // Device is a VTR. Enable all VTR functions.
    }
    else 
    {
        // Device is a camera. 
        // Enable record and record-pause; disable other functions.
    }
}

If the camcorder goes offline, you should query it again when it next becomes available. The filter graph manager posts an EC_DEVICE_LOST event when the device is removed.

UVC Driver

Because USB video devices can switch modes without resetting, the code shown in the previous examples is not reliable for USB devices. Instead, use the ISelector interface to get the current mode. You can also use this interface to switch modes programmatically if the device supports it.

See Also