X hits on this document

Word document

Designing Hardware and Drivers for the Microsoft® Windows® Family of Operating Systems - page 4 / 13





4 / 13

Digital Video Camcorder Support in Windows 4

To connect to the interfaces, the application enumerates devices on the system and obtains a pointer to the DV camcorder device, as described in the DirectShow SDK. Briefly, the application:

1.Creates a system hardware device enumerator by calling CoCreateInstance with CLSID_SystemDeviceEnum and IID_ICreateDevEnum.

2.Creates an enumerator for a specific type of hardware device by declaring an IEnumMoniker interface pointer and passing it to ICreateDevEnum::CreateClassEnumerator with a device GUID of CLSID_VideoInputDeviceCategory.

3.Enumerates the list of devices by calling IEnumMoniker::Next.

4.Calls IMoniker::BindToStorage to load the CLSID, FriendlyName, DevicePath, and Description for each device.

Developers are encouraged to display Description, if supported, instead of FriendlyName to users, because Description provides a more specific identification of the device.

5.Offers the user a list of friendly names that can be selected.

If a DV camcorder is connected to the system, Msdv.sys would appear in this list as “Microsoft DV Camera and VCR.” This string could be localized; check Msdv.inf files for localized versions of Windows.

6.Matches the user’s choice to the information cached in Step 4.

7.Calls IMoniker::BindToObject with the corresponding device path and the IID of one of the desired interfaces (for example, IID_IAMExtDevice). This creates the filter associated with the device and retrieves a pointer to that interface.

8.Calls QueryInterface on the interface obtained in Step 7 to get pointers to the other interfaces that the application will use.

To use the DV implementation of the DirectShow interfaces, an application must include Xprtdefs.h. This file contains all the definitions found in Edevdefs.h with additions that support DV camcorders.

For a complete discussion of enumerating and accessing hardware devices in DirectShow applications, see the DirectShow SDK.

Getting Information from a DV Camcorder Device

A video-editing application would get information from a DV camcorder device to initialize its user interface (for example, controls in a dialog box or on a property page) and to update it after issuing commands to the device. For example, an application might:

1.Determine device capabilities, device ID, and mode of operation (VCR or camera), and enable or disable controls accordingly.

2.Determine whether the transport contains media, the type of the media, and whether it is write-protected.

3.Determine whether the device supports DV (NTSC or PAL) or MPEG2TS signal mode.

4.Monitor the current state of the transport and update its user interface with fresh information—for example, whether the device is currently playing a tape.

Getting Device Capabilities

An application uses IAMExtDevice::GetCapability to find out the capabilities of the DV camcorder device—most importantly, whether the device is a full-fledged VCR or a DV camera that can only record or pause recording.

The following code fragment shows how an application would determine whether the device is a VCR or a camera and use that information to initialize dialog box controls.

September 28, 2001

Document info
Document views48
Page views48
Page last viewedThu Jan 19 03:05:40 UTC 2017