共用方式為


WIA Camera Support in Windows Vista (Part 1 of 2)

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:

HKR,,"EnableLegacySupport",0x10001,1

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).

HKR,,"UseWiaAutoPlay",0x10001,1 

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.

Next Post...

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.

Comments

  • Anonymous
    February 13, 2007
    In the previous post , we gave an overview of the WIA-WPD Compatibility Layer and how WIA Applications

  • Anonymous
    May 08, 2007
    A question came up about WIA Video support in Windows Vista. Taking a snapshot of a video stream from a digital video capture device from My Computer (Shell) is supported in Windows XP, but this feature is removed in Windows Vista. This is WIA Shell video support, and unrelated to WIA/WPD compatibility.  The XP shell add-on feature had shortcomings  (notably a lack of video format support) that a third party application could already acccomplish with the same or better functionality. Our recommendation is to use a third party application that is compatible with your video capture device, or use a digital still camera to capture and import the images in higher quality. The KB article for this is http://support.microsoft.com/kb/927833/en-us

  • Anonymous
    August 26, 2010
    It is absolutely unacceptable that Microsoft cannot name one single camera that allows programmatic shutter release through it's imaging control

  • Anonymous
    August 30, 2010
    @MP, feel proud.  You have just posted a rant on a post that is over 3 years old.  As for cameras that support PTP... sorry but your $100 point and shoot probably isn't on the list.  BTW, most any dSLR will work.

  • Anonymous
    July 29, 2011
    I've been trying to sort out enabling legacy support for WIA in windows 7 and this is the only info keeps coming up.  Lots of good stuff here but it sure isn't clear how to actually do it.