Release 2.12a
Copyright 1995 Hauppauge Computer Works, Inc. ALL RIGHTS RESERVED.
This document is copyrighted by Hauppauge Computer Works, Inc.
Restricted Rights Legend
Use, duplication, or disclosure by the Government is subject to restrictions set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at 252.277-7013.
Introduction to the Media Control Interface
MCI (Media Control Interface) is high-level control software that provides a device-independent interface to multimedia devices and media files. MCI includes a command-message interface and a command-string interface. These interfaces are supported by both IBM and Microsoft.
MCI command-strings are sent to MCI device drivers with the mciSendString and mciExecute functions, which translate the command strings into command-messages.
Using the MCI is one of the easist ways to control the Win/TV board. Many popular commercial Multimedia presentation packages such as Macromedia Authorware and Aymmetrix Toolbook allow the user to control multimedia devices by sending MCI commands at the command-string level. Others communicate with the hardware directly using the command-message interface.
This document describes the Hauppauge Computer Works Win/TV MCI command-string interface. These MCI functions will allow the multimedia developer to easily add Win/TV capabilites to their application, such as putting a live video window on their screen, freezing the live video, saving a video image to disk, changing the TV channel, etc.
Here is an example of a MCI command sequence to turn on the Win/TV, set the channel, freeze the video and save an image. This example might be run as a script from Authorware:
open overlay alias wintv put wintv destination at 100 100 50 80 set wintv channel to 7 freeze wintv save wintv test.bmp type 1 unfreeze wintv close wintvThe MCI command set described for the Win/TV is largely a subset of commands described in the "Digital Video Command Set for the Media Control Interface" (Microsoft Part No. 098-37538). For a more complete understanding of the MCI and its control of other devices besides the Win/TV video overlay device, you can download a file called "MCI.EXE" from the Microsoft FTP server in the directory: /softlib/mslfiles. This file contains an example of the MCI control of a CD player.
MCI command strings are sent to MCI device drivers with the mciSendString and mciExecute functions. The commands divide into the following categories:
System Commands - Interpreted directly by MCI rather than being
relayed to a device.
Required Commands - Are supported by all MCI devices.
Basic Commands- Are optional commands.
Extended Commands - Are specific to a device type or device class. These
extended commands contain both unique commands and extensions to the
required and basic commands. The Win/TV supports several extended commands to
control the TV tuner and TV audio.
This document will discuss only those Required, Basic and Extended commands that relate to the Win/TV boards, which are video overlay class devices. It is assumed that an understanding of Multimedia programming for Windows and of MCI System commands already exist.
Command Brief Description ============================================================== capability Obtains the capabilities of a device. close Closes the device. freeze Disables video acquisition to the frame buffer. info Obtains textual information from a device. load Recalls data from a disk file. open Initializes the device. put Defines the source, destination and frame windows. save Saves data to a disk file. set Sets the operating state of a device. status Obtains status information from the device. unfreeze Enables the frame buffer to acquire video data. where Obtains the rectangle specifying the source, destination or frame area. window Sets the window for the display of overlay video.Extended commands recognized by the Win/TV
Set For setting audio volume and changing channels. Setaudio This command sets he audio volume,bass, trebles,balance and source. Setvideo This command will set color, tint, contrast, brightness and video source.
In order to put together a command string you need to be familiar with some basic rules of syntax. A command string is made up of three pieces of information: the command element, the device_id element, and the arguments element.
A command string takes the form:
command device_id arguments
Example 1: A sample MCI command string
In this example, the capability command
instructs the overlay device to return information about its ability to
freeze live video. The Win/TV would return the value "True" since it can freeze
the video.
capability overlay can freeze
where:
capability is the command element
overlay is the device_id element
can freeze is the arguments element
Every MCI command string must begin with an MCI command. The command includes a command from the system, required, basic or extended command set. Examples of commands includes open, close, and play.
Depending on the device you are using, the device_id element must specify different information. Some devices (such as a CD audio player) are known as simple devices because they require only the name of the device as the device_id element. Other devices (such as animation players) are known as compound devices because they require the name of the device and the name of the filename used by the device.
Example 2: The save command
For example, one of the basic commands is the save command. You can use
the save command with the at flag and the rectangle parameter to specify
the block of data that is to be saved. The command would appear as follows:
save overlay xxx.bmp at 0 0 50 50where:
MCI commands that need parameters typically require you to provide the
following kinds information::
Integers - Make sure to use a blank space before and after an integer. Unless otherwise specified, integers can be positive or negative. If you are using a negative integer do not leave a space between the negative sign and the first digit. As an example, you specify an integer when you use the samplespersec command to set the sample rate for playing and recording wave audio.
Rectangle - Some commands will require that you specify four integer values
that describe a rectangular area. The first two integers are the coordinates of
the top left corner of the rectangle and the second two integers are the width
and height of the rectangle. For example, you specify a rectangle when you
use the freeze command to freeze a video image via an overlay device.
Device Description Device Name Simple or Compound ================================================================== Animation player animation compound CD audio player cdaudio simple Overlay device overlay compound MIDI sequencer sequencer compound Videodisc player videodisc simple Audio device that plays digitized waveform files waveaudio compoundThe [mci] section of the SYSTEM.INI file lists the device types installed on your system. If you have a device type installed more than once, the device type names have numbers attached to them. For example, if you have two cdaudio type devices installed on your system they will be identified as cdaudio1 and cdaudio2. Here is an example of what the [mci] section might look like after the Win/TV video overlay driver is installed:
Example 3: Simple Devices
CD audio devices and videodisc players are simple devices. As mentioned
previously, when you are using a simple device, you need only specify the
device name as the device_id element of the command string. For example,
before you can use a device, you need to initialize it with the open command.
You could specify the following command to initialize a CD audio player you
plan to work with.
open cdaudiowhere:
Example 4: Compound Devices
MIDI sequencers, waveform audio devices, animation players, and overlay
cards are compound devices. As mentioned previously, when you are using a
compound device, such as a MIDI sequencer, you have to specify additional
information as the device_id element of the command string. You need to
specify the full path and filename for the MIDI file you are using and you have
to specify the type flag, and then the the actual device name.
Note: Flags are keywords supported by an MCI command. For example, when
you use the play command with a CD audio player, you can also use the from
and to flags to play a particular portion of the CD.
When you initialize a MIDI sequencer, you might specify the command string:
open d:\music\sonata1.mid type sequencerwhere:
capability overlay freezeThis command returns true to indicate that the device is capable of freezing video in the frame buffer.
open overlay alias wintv window wintv . . . close wintvIn this example, the first command string uses the alias flag to assign the alias wintv to the video overlay device, path, and filename. From that point on, the expression wintv is used as the device_id element in command strings.
close allcloses all open devices. Because MCI sequentially sends the commands to the MCI devices, there is a delay between when the first device receives the command and when the last device receives the command.
command device_id argumentsThe device_id for all video overlay device commands is overlay. If multiple drivers of the same type are installed, a numeral will be added to the device_id argument. For example, if three Win/TV boards were installed in your system, the first would have device_id overlay, the second would have device_id overlay1 and the third would have device_id overlay2.
capability
Requests information about the capabilities of a video overlay device. This command requires one of the following argument elements. can eject Returns false. can freeze Returns true, since the device can freeze data in the frame buffer. can play Returns false. can record Returns false. can save Returns true, since the device can save the current contents of the frame buffer to disk. can stretch Returns false. compound device Returns false, since multiple windows are not supported, and the device does not support and element name. device type Returns overlay device type. has audio Returns false, since the device does not support audio playback. has video Returns true. uses files Returns false. windows Returns the number of simultaneous display windows the device can support, 1.close
Closes a video overlay element and any resources associated with it. This command does not use an arguments element.freeze
Disables video acquisition to the frame buffer. This is supported only if capability can freeze returns true.info
Fills a user-supplied buffer with information. This command requires an arguments element. file Returns the name of the file used by the video overlay device. This argument is valid only if capability uses files returns true. product Returns the product name and model of the current device, Hauppauge Computer Works Win/TV Video Overlay Device. window text Returns the caption of the window used by the device, Hauppauge Computer Works Win/TV.load
Loads the contents of the video buffer in a device specific format. This command requires an arguments element. filename Specifies the file and pathname used to load the data. at rectangle Specifies the rectangle relative to the video buffer origin. The rectangle is specified as X1 Y1 X2 Y2. The coordinates X1 Y1 describe the top, left corner of the rectangle and X2 Y2 describe the width and height.open
Initializes the video overlay device. This command requires an arguments element. alias device_alias Specifies an alternate name for the video overlay device. If specified, it must also be used for subsequent references. (See "Using Flags" earlier in this manual) parent hwnd Specifies the window handle of the parent window. shareable Initializes a device element as shareable. Subsequent attempts to open it fail unless you specify shareable in both the original and subsequent open commands. MCI returns an invalid device error if it is already open and not shareable. (See "Hints for Using Flags" earlier in this manual.) style style_type Indicates a window style. style child Opens a window with a child window style. style overlapped Opens a window with an overlapped window style. style popup Opens a window with a popup window style. type device_type Specifies the device type of the device element. MCI reserves overlay for the video overlay device type. As an alternative to type, MCI can use the [mci extension] entries in the SYSTEM.INI file to select the controlling device based on the extension used by the device element.put
Defines the source, destination, and frame windows. This command requires an arguments element. destination Sets the whole window as the destination window. This completed command defines the VGA window. destination at rectangle Specify a rectangle for the area of the window used to display the image. The rectangle coordinates are relative to the window origin and are specified as X1 Y1 X2 Y2. The coordinates X1 Y1 describe the top left corner of the rectangle and the coordinates X2 Y2 describe the width and height of the rectangle. When an area of the display window is specified and the device supports stretching, the source image is stretched to fill the destination rectangle. frame Specifies that the whole video buffer is used to capture the video image. This completed command defines the capture rectangle in the video buffer. frame at rectangle Specify a rectangle for the area of the video buffer used to capture the video image. The rectangle coordinates are relative to the video buffer origin and are specified as X1 Y1 X2 Y2. The coordinates X1 Y1 describe the top left corner of the rectangle and the coordinates X2 Y2 describe the width and height of the rectangle. If the device supports stretching, the video image is stretched to fill the rectangle. source Selects the whole video buffer for display in the destination window. This completed command defines the source rectangle in the frame buffer. source at rectangle Specifies a rectangle for the video buffer area used to obtain the image for display. The rectangle coordinates are relative to the video buffer origin and are specified as X1 Y1 X2 Y2. The coordinates X1 Y1 describe the top left corner of the rectangle and the coordinates X2 Y2 describe the width and height of the rectangle. When an area of the source image is specified and the device supports stretching, the source image is stretched to fill the destination rectangle. video Selects the whole video source for display in the destination window. This completed command defines the acquisition window. video at rectangle Specifies a rectangle for the input video source area used to obtain the image for display. The rectangle coordinates are relative to the video buffer origin and are specified as X1 Y1 X2 Y2. The coordinates X1 Y1 describe the top left corner of the rectangle and the coordinates X2 Y2 describe the width and height of the rectangle. When an area of the source image is specified and the device supports stretching, the source image is stretched to fill the destination rectangle.save
Saves the contents of the video buffer in a device specific format. This command requires an arguments element. filename Specifies the file and pathname used to save the data. at rectangle Describes a rectangle relative to the video buffer origin, specified as X1 Y1 X2 Y2. The coordinates X1 Y1 describe the top left corner of the rectangle and the coordinates X2 Y2 describe the width and height of the rectangle. type x type x values 0-18. The type setting is an extended command. It allows you to choose one of nineteen different file formats for saving frames. The following are: NOTE: If type is not used, the default is 256 color dib. x file type ================== 0 /* Windows DIB 24 bit true color */ 1 /* Windows DIB 8 bit palettized */ Default 2 /* Windows DIB 8 bit gray-scale */ 3 /* Windows DIB 4 bit dithered */ 4 /* Targa 32 bit true color */ 5 /* Targa 24 bit true color */ 6 /* Targa 16 bit true color */ 7 /* IBM MMotion format 4:1:1 YUV */ 8 /* TIFF 24 bit true color */ 9 /* TIFF 8 bit palettized */ 10 /* TIFF 8 bit gray-scale */ 11 /* PCX 8 bit palettized */ 12 /* PCX 8 bit gray-scale */ 13 /* PCX 4 bit dithered */ 14 /* GIF 8 bit palettized 15 /* GIF 8 bit gray-scale 16 /* JPEG compressed 4:2:2 YUV 17 /* BMP monochrome 18 /* BMP 16 colors palettizedstatus
Obtains status information for the device. This command requires an argument element. media present Returns true. mode Returns stopped. ready Returns true, indicating that the device is ready. window handle Returns the handle of the window whose client area is used for the destination video in the low-order word of the return value. stretch Returns false. Contrast Returns contrast value. Brightness Returns brightness value. Color Returns color value. Tint Returns tint value.unfreeze
Enables the acquisition of video data into the frame buffer. This command is usually preceeded by a freeze command.where
Obtains the rectangle specifing the source, destination, or frame area. This command requires an arguments element. destination Requests the offset and extent of the destination rectangle. frame Requests the offset and extent of the frame rectangle. source Requests the offset and extent of the source rectangle. video Requests the offset and extent of the video rectangle.window
The window command can be used to tell the video overlay device to use a given window for display instead of the default window created by the driver. By default, these devices should create a window when opened but should not display it until they receive the play command. Applications providing window handles should manage the display issues that result when the window is sized or when the window handle is switched during play. Several flags manipulate the window. Since the status command can obtain the handle to the current display window, you can use the standard window management functions to manipulate the window. This command requires an arguments element. handle window_handle Specifies the handle of the destination window used as an alternate to the default window. handle default Specifies that the video overlay device should create and manage its own destination window. This flag can be used to set the display back to the driver's default window. state hide Hides the current display destination window. state iconic Displays the destination window as an icon. state maximized Maximizes the current destination window. state minimize Minimizes the specified window and activates the top-level window in the window-manager's list. state minimized Minimizes the current destination window. state no action Displays the destination window in its recent size and state. The window that is currently active remains active. state normal Activates and displays the current display window in its original size and position, as it was created. state show Shows the current destination window, in response to a hide. text caption Specifies the caption for the display window.Extended Win/TV MCI Commands
set
on Turns Video Overlay On. off Turns Video Overlay OFF. Audio This command sets the volume level from 0 to 100. In some cases not audible until a setting of 50 or higher. Time format This function changes channels from 1-125, it is a temporary solution and currently hard coded for US catv (this can be changed- call 516-434-1600 x350 for modified driver). Source to xx This function selects the video format. Don't confuse this call with the setvideo source call. The ordinal values values 0-6 are as follows: 0 PAL_BGHI 1 NTSC_M 2 SECAM 3 PAL_M 4 PAL_N 5 NTSC_443 6 EXTERNAL_SRC channel to xxx This function set the channel number. This call is functional only if the WinTV board has a tuner. Values are from 1-125 (channels 1 to 125). tuner region to x This function sets the tuner for the proper RF Region. The ordinal values are 0 to 7 as follows: 0 USA 1 US_CATV 2 CCIR /* Western Europe */ 3 CCIR_CATV /* Western Europe */ 4 AUSTRALIA /* Austrilia */ 5 JAPAN /* Japan */ 6 JAPAN_CATV /* Japan */ 7 US_HRC /* US CATV HRC */setaudio
volume to xx This command sets the volume level from 0 to 100. If using the Celebrity Board the audio level may not be audible until a setting of 50 or higher. source to xx This Function selects the audio source. Setting the audio source to 2 selects the tuner, if set to 0 video input 1 is selected and if set to 1 video input 2 is selected. bass to xx This Function sets the BASS levels - values 0-100. treble to xx This function sets treble levels.- values 0-100 off Selecting OFF will MUTE the audio . on Selecting ON will UNMUTE the audio. stream to xx Sets the Balance between left and right. Where 0 = full left and 100 = full right.setvideo
on Turns Video Overlay On. off Turns Video Overlay OFF. source to xx If set to 0 video input 1 is selected, if set to 1 video input 2 selected, if set to 2 the tuner will be selected. brightness to xx sets brightness level.- values 1-255. contrast to xx sets contrast level- values 1-255. color to xx sets hue value - values 1-255. tint to xx sets saturation level - values 1-255.
To install the driver software you must have Multimedia Windows already installed on your system. Start up Windows and make sure that the driver diskette is in a floppy drive.
Go to the Windows Control Panel and double click on the Drivers icon. Select Add and Add Unknown. Select the driver to be installed and click on OK. The MCI driver is then installed. If multiple boards are installed in your system, you may want to install the corresponding MCI drivers by repeating the above process once for each driver.
The installation under Windows 3.0 will not use the new files on the floppy but will (quietly) use the (old) files on the hard disk if available.
The installation program under Windows 3.1 will ask if you would prefer to use the older version of the driver, etc. on your system.
To avoid these problems, if you have installed a previous version of
the MCI driver, please remove the driver first, using the Control
Panel, exit to DOS, and run the MCICLEAN.BAT provided on the install
floppy.
Questions, comments, or problems regarding this service?
Back to Tips Page
Copyright © 1995 Hauppauge Computer Works, Inc. All rights reserved.
The Hauppauge logo and Win/TV are registered trademarks of Hauppauge Computer Works, Inc.
Windows, Windows 95 and Windows NT are trademarks of Microsoft Corp.