MMPM/2 Device Driver Reference:PDD Sample for Video Capture Adapters
By IBM
Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation
Contents
PDD Sample for Video Capture Adapters
This DDK provides a sample of a video capture physical device driver (PDD) to assist in the creation of physical device drivers (PDDs) for video capture adapters (VCAs).
Source Code
Source code for the physical device driver (PDD) sample is located in the \MMOS2\MMTOOLKT\SAMPLES\VCADDT subdirectory. Source files include documentation headers, which provide detailed descriptions of the programming concepts and routines used in incorporating the module.
The sample programs require MASM** 5.1 for assembly.
File | Description |
---|---|
README | Describes how to create the resource DLL containing the video adapter information and how to create the .SYS file containing the VCDD. |
VCA32.ASM | Contains the main entry point for IOCtl parsing. |
VCACAPT.ASM | Contains image copy and scale routines. |
VCAIDC.ASM | Contains device specific streaming routines. |
VCAINIT.ASM | Contains device initialization routines. |
VIDIDC.ASM | Contains generic device streaming routines. |
VIDIDC.INC | Contains streaming instances structures. |
VIDIN.INC | Contains the open instance structure. |
VIDVCI.INC | Contains the interface for the IOCtl. |
VIDVCIT.SYS | Is the compiled device driver. |
Program Flow
The following figure illustrates the program flow from the Media Device Manager (MDM) through the PDD and finally on to the video capture adapter.
+--------------+ +--------------+ | Media Device | (4) | SPI | | Manager |-------------- Interfaces | | | | SSM | +--------------+ +------ -------+ (1) | (5) | | | +------ -------+ +------ -------+ | Vendor- | | Video Capture| | Specific | | Stream | | Driver | | Handler | +--------------+ +------ -------+ (2) | (6) | | | +------ -------+ | | Physical | | | Device ---------------------+ | Driver | +--------------+ (3) | | +------ -------+ | Video |+ -- Video Input | Capture |+ | Adapter | +--------------+
1 Media Control Interface functions are passed from the MCD to the vendor- specific driver.
2 The VSD passes information to the PDD.
3 The PDD controls the video capture adapter. The sample provided works with the IBM VCA adapter. To modify the sample to work with a different adapter, you must replace all hardware-specific routines with routines that are specific to your adapter. If you update the PDD sample, make a backup copy first. In order for the generic install to work, you must update the RCDATA 12 parameters so that MINSTALL will install the correct PDD.
4 After the video capture adapter is initialized, the MCD passes control to the Video Capture Stream Handler through the SPI interface.
5 The SPI interface receives video data from the video capture stream handler.
6 The control video data from the Video Capture Stream Handler is passed to and from the PDD.
PDD Architecture
The following figure illustrates how the PDD fits in the overall MMPM/2 subsystem structure. The media device manager (MDM) uses Media Control Interface commands to pass information through the vendor-specific driver and on to the PDD. The PDD directly controls the video capture adapter and passed video adapter request to the video capture stream handler.
+-------------+ º º | Multimedia | º º --+ | Application | | +--- ---------+ PM Monitor | Notifications | | MCI Commands | +------+-----+------+ | +----+------------ ------+----+ | | | MDM | | | +----+-------------------+----+ | | +----------------+-------------------+ | +-------------+ +------ --------+ | mmioOpen +----|Digital Video| |Amplifier Mixer| | +--------------------|Media Driver|-+ +-| Media Driver |-----+ | | mmioSetHeader +----- -------+ | | +-------- ------+ | | | | | | | | | | | +----- - ------+ | | | | | |SPI Interfaces| | | | | | |--------------| | | | | +---| SSM |---+ | | | +------------- + --+ | | | audio data | | | | | +-----------+ +---------+ | +- -----+ +-------+| +---------+mmioWrite|Multi-track ------------+ ---+--|Audio --|Audio || | MMIO ---------|Stream | +-+ ++ |Stream | |Adapter|| | Manager |mmioSeek |Handler --+-| | |Handler| +-------+| +---------+ +-----------+ |-| uncompressed| +-------+ +---+ multi|track data+---+ compressed |-| +---------+ + +-------+ +---- --+ +---- ----------+-+ | data |-| +---------+ --|Video | |Capture| | AVI | | | + + | data |Capture --|DD | | IOProc | | | | | |Stream | |copy | +---------------+-+ | | +-----+ |Handler| |scale | | +------------+-+ | | | +-------+ +-------+ | | Ultimotion | | | | +----- -------+ +--- ---+ | | RT Codec | | | \---| Compression | |Video | | +------------+-+ +-------------------| Stream | |Adapter| +----------------------- Handler | +-------+ raw data compression +-------------+
Strategy Commands
There are several generic strategy commands that are supported by all physical device drivers, video or otherwise. These are documented in the OS/2 Physical Device Driver Reference. The generic strategy commands supported by video device drivers are described in the following table.
Functions | Description |
---|---|
INIT | Initializes the device. |
OPEN | Opens an instance of the device and prepares it for use. |
CLOSE | Closes an instance of the device. |