In this two-part post, we will cover WIA support for cameras on Windows Vista, and the migration from WIA to WPD for richer applications.
WIA-WPD Compatibility Layer
On Windows XP, Picture Transfer Protocol (PTP) cameras are accessible through the WIndows Image Acquisition (WIA) infrastructure. This is still supported on Windows Vista through the WIA-WPD Compatibility Layer (PortableDeviceWiaCompat.dll). This component is a WIA mini-driver that communicates to the inbox Media Transfer Protocol (MTP) class driver using the WPD API.
The following classes of devices have the WIA-WPD Compatibility Layer enabled:
1. PTP Cameras
2. MTP devices that report WPD_DEVICE_TYPE_CAMERA (subcomp = 2) or WPD_DEVICE_TYPE_VIDEO (subcomp = 6)
3. WPD devices that support WPD_CONTENT_TYPE_VIDEO or WPD_CONTENT_TYPE_IMAGE, and with the lowest bit set in the EnableLegacySupport entry under Device Parameters. This can be set in the driver INF:
WIA Event Registration for Cameras
On Windows Vista, WIA imaging applications communicate to PTP cameras via the WPD-WIA Compatibility Layer and the Media Transfer Protocol (MTP) class driver. Windows Autoplay is supported, third party applications can register for WIA device-connected events and appear in the autoplay dialog. Note that some third-party WIA applications may require Elevation (“Run as Administrator”) at first launch to in order to successfully register for WIA events.
1. Only Global WIA Event Registration for WIA_EVENT_DEVICE_CONNECTED is supported. Any WIA application that registers for this event will be listed in the Windows Autoplay dialog when any WIA-compatible PTP camera is connected.
2. Supported registration mechanisms: STI Proxy registration (IStillImage::RegisterLaunchApplication), WIA CLSID registration (IWiaDevMgr::RegisterEventCallbackCLSID), and WIA Program registration (IWiaDevMgr::RegisterEventCallbackProgram).
Custom Vendor Events
To enable Device-Specific WIA Event Registration for custom vendor events, there is an “opt-in” mechanism. There are 2 steps to this:
Step 1: The vendor camera driver INF will need to add the UseWiaAutoPlay setting in the Device Parameters section in the registry. This is a DWORD setting. If set to 1, the WPD-WIA Compatiliby Layer will mark “device connected” and custom vendor events as “action events.” If unset, the default value is 0 (WIA autoplay is disabled).
Step 2: The vendor’s application calls the IWiaDevMgr APIs to create a Device-specific WIA event registration for their custom WIA event.
The overall effect of enabling device-specific registration is the WIA Autoplay dialog will appear for the custom event. This XP-style dialog is implemented by the WIA Service. It is recommended that applications only register via Windows Autoplay or WIA Autoplay, but not both. Windows Autoplay registration is preferred.
Image and Video Acquisition
On Windows Vista, the camera image import functionality of the Scanner and Camera Wizard is replaced by the Photo Acquisition Wizard and the Windows Photo Gallery. This is also known as the “Importing Pictures and Videos” dialog.
The Photo Acquisition wizard communciates to PTP cameras using WPD APIs (more specifically, it uses the WPD Namespace Extension). It does not use the WIA APIs.
Video Content Support
Video content support is removed from WIA for Windows Vista. The effect is video content on your device will not appear in WIA applications running on Windows Vista.
To access video content from your device, we recommend migrating your applciation to use the WPD API. WPD provides broader content coverage (supports both video and image content) on Windows Vista for camera devices. For instance, the Vista Photo Acquisition Wizard uses WPD to retrieve pictures and video from PTP devices.
For ease of migration, there is usually a straighforward correlation from WIA metadata to WPD object properties. For example, WiaImgFmt_AVI corresponds to WPD_CONTENT_TYPE_VIDEO and WPD_OBJECT_FORMAT_AVI. For more details, refer to the WPD video properties and video format GUIDs on MSDN.
Watch the next post for more details on custom PTP vendor commands through the WIA Escape mechanism, custom WIA property and event codes.
This posting is provided “AS IS” with no warranties, and confers no rights.