Device Driver Instances

Like other MCI devices, a digital-video device is opened with the open command. If necessary, this loads the device driver into memory and locates any media resource (file) specified. Each open command creates an instance of the device driver. The device name acts as a handle to the instance of the device driver created. A device driver instance (or more simply, device instance) is simply the collection of status information that describes the net result of all the operations that have been performed using a single device name. Commands use the device name so that they can be issued in a specific context.

The digitalvideo device class lets applications open multiple device instances simultaneously. Each instance has its own context. For example, an application might have two files playing simultaneously in two different windows. Alternatively, an application can open the same file twice and position it differently in two device instances. While the same file can be used by two different instances, each instance must have been opened with a unique device name. (MCI returns an error when an application attempts a second open with the same device name.)

MCI also supports shared device instances. When the same file is opened with two or more different device names, and the shareable flag is used, then a single file context is shared by these device instances. That is, changing the position of the file affects its position in all the shared device instances. While a digital video device must check for the shareable flag when it is opened, it might refuse to accept such an open. Devices that support shareable could allow the same presentation source to be displayed in several different windows in different positions and sizes on the display.

Hardware or software constraints of digital-video devices can limit the number of simultaneously open device instances, or what they can do simultaneously. Application programmers can determine the device constraints by using the capability, info version, and info product commands, and by using the test flag with a command.