Snap! Crack! Bang! With OS/2 2.1 Multimedia Support (Part 2)
In the previous issue of The Developer Connection News, we described the user interface aspect of the Audio portion to the OS/2 2.1 operating system's multimedia support. This quarter we continue with the description of the Video portion of multimedia. and conclude with an overview of programming for OS/2's rich multimedia platform.
To access the Video Support, select either the Digital Video or Digital Video 2 object from the Multimedia folder.
Video has been available in the personal computer arena for quite some time. The major drawback up to now has been cost. Most of the video delivery solutions have either relied on expensive video sources, such as laser video disc, or have required expensive video co-processor, such as the Digital Video Interactive (DVI) chips from Intel.
For quite some time, the search has been on for an inexpensive method for delivering quality video on desktop systems. Recent breakthroughs in this area have been fueled by dramatic increases in processor speed and advances in operating system technology.
The Software Motion Video Playback software that is included with OS/2 2.1 has been designed to allow pluggable Compressor/Decompressors, also known as CODECs. We have included two CODECs with OS/2, one for Indeo and the other for Ultimotion. Both of these video formats can be found in files with the .AVI extension.
Indeo is a CODEC that was developed by Intel and is based on the algorithms used in the DVI products. Much of the design of the Indeo CODEC was dictated by the existing algorithms used in the DVI chips.
Ultimotion is a CODEC developed by IBM. Ultimotion was designed specifically for software motion video playback, and was optimized for the personal computer instruction set.
Both of these algorithms are loosely based on a technique known as delta-frame encoding, a method of video compression. This video compression method compares each frame of video with the previous frame. As frames advance, only those pels that change need be stored.
For example, in a head shot of someone reporting the evening news, only the area of the video window around the reporter's face change from frame to frame. The pels that make up the backdrop need only be stored once at the beginning of the clip, and then simply left in place as the rest of the video is played. If something in the background does change, it is noted during the video-compression phase and those changed pels are included in the delta frames along with the facial gestures.
Generally, the more motion in a video clip, the more pel change there is from frame to frame. Ultimotion, for example, can easily handle a 320x240 frame size video clip at 15 frames per second on a standard desktop system.
Multimedia Programming with OS/2
What we've seen so far are all features of the sample applications that are shipped with OS/2. It is also quite easy to exploit all of the powerful underlying multimedia support in your own applications. The key to writing code to use OS/2 multimedia is a programming interface known as the Media Control Interface.
Media Control Interface is a high-level application programming interface (API) that allows easy access to all of the multimedia features described previously The concept behind the design of Media Control Interface was to provide a simple, consistent interface that allows control of a variety of multimedia devices. The same basic PLAY API is used for playback of Digital Audio, CD-DA, MIDI, and Software Motion Video.
The Media Control Interface commands are all also available as a string interface. This creation of a prototype allows for easy inclusion of multimedia content in existing applications. For example, the following string:
"PLAY CDAUDIO FROM 10000 TO 20000"
would cause the CD-ROM player to start playing at the 10-second point (10 seconds = 10,000 milliseconds) and stop at the 20-second point.
A REXX interface to Media Control Interface has also been included with the OS/2 multimedia support. Documentation, as well as some sample REXX command files, are included.
This article presents just a sample of the multimedia features available in OS/2 2.1. The OS/2 2.1 Developer's Toolkit, MMPM/2, and MMPM/2 Developer's Toolkit are available on your Developer Connection CD-ROM. In addition, an evaluation copy of the Video IN product is also included on the CD-ROM.
So, install the appropriate components and have a good time!
Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation