MMPM/2 Device Driver Reference:PDD Sample for Video Capture Adapters

From EDM2
Jump to: navigation, search
MMPM/2 Device Driver Reference
  1. Adding Support for Audio and Video Adapters
  2. Audio Physical Device Driver Template
  3. Audio Virtual Device Driver Template
  4. MAD16 PDD and VDD Sample Device Drivers
  5. PDD Sample for Video Capture Adapters
  6. PDD Sample for MPEG Video Playback Devices
  7. Audio Sample for Vendor-Specific Drivers
  8. Using the High-Resolution Timer
  9. Real-Time MIDI Subsystem
  10. Audio Device Driver Exerciser (PMADDE) Tool
  11. AP2/P2STRING Tool
  12. Ultimotion Data Stream Specification
  13. DDCMD Messages
  14. SHD Messages
  15. Vendor-Specific Driver Commands
  16. IOCtl Functions
  17. Data Types
  18. Types of MIDI Messages
  19. Notices
  20. Glossary

By IBM

Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation

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.