Chapter 2 Digital Video Command Strings

The digitalvideo command set supports the display and capture of motion video sequences. As important limiting cases, it also supports the display and capture of digital audio and still images.

A command string has the following form:

command device_id arguments

Although not explicitly listed with each command string, all commands accept the optional items wait and notify. All commands except open and close accept the optional item test.

Digitalvideo devices support at least the following command set:

Command

Description


capability item

Fills an application supplied buffer with a string containing information about the capabilities of the digitalvideo device. The item is one of the following:


can eject

Returns false.

can freeze

Returns true is the device can freeze data in the frame buffer.

can lock

Returns true if the device supports a lock mask. This implies the device can lock portions of the image with the freeze and unfreeze commands.

can play

Digital video devices return true. Overlay devices return false.

can record

Returns true if the device can digitize audio data, video data, or both. It returns false otherwise.

can reverse

Returns true if the device can play files in reverse.

can save

Returns true if the device can store digitized images, audio, and/or video to disk. It returns false otherwise.

can stretch

Returns true if the device can (even if only to a limited extent) resize an image or motion video in the process of writing it from the frame buffer to the display. It returns false otherwise.

can stretch input

Returns true if the device can (even if only to a limited extent) resize an image or motion video in the process of digitizing it into the frame buffer. It returns false otherwise.

can test

Returns true if the device recognizes the test keyword. It returns false otherwise.

compound device

Digital video devices returns true. Overlay devices return false.

device type

Returns digitalvideo or overlay depending on how the device was opened.

has audio

Returns true if the device supports audio playback. It returns false otherwise.

has still

Returns true if the device treats files with a single image more efficiently than motion video files. It returns false otherwise.

has video

Returns true if the device supports video playback. It returns false otherwise.

maximum play rate

Returns the maximum play rate in frames per second.

minimum play rate

Returns the minimum play rate in frames per second.

uses files

Returns true.

uses palettes

Returns true if images and video use a palette for display. It returns false otherwise.

windows

Returns the maximum number of simultaneous display windows the device can support. The actual value might be less depending on what the device is doing. All windows might not be able to play motion video at the same time.


capture items

Copies the contents of the frame buffer and stores it in the specified file. This command might fail if the device is currently playing motion video or executing some other resource intensive operation. If the frame buffer is being updated in real time, the updating momentarily pauses so that a complete image is captured. If the device pauses the updating, there might be a visual or audible effect. If the file format, compression algorithm, and quality levels have not been set, their defaults are used. The following items modify this command:


as pathname

Specifies the destination path and filename for the captured image. This item is required.

at rectangle

Specifies the rectangular region within the frame buffer the device crops and saves to disk. If omitted, the cropped region defaults to the rectangle specified or defaulted on a previous put source command for this device instance.


close

Closes an instance of the digitalvideo device and releases all resources associated with it. If the window is a default window, it is destroyed; otherwise the contents of the window are not defined. If the workspace contains unsaved data, or there is a save in progress, then the associated data will be lost. The commands status device name unsaved and status device name file mode, can be used to detect these situations.

configure

Displays a device specific dialog box used to change device specific features. The dialog box should not allow changes to parameters covered elsewhere in this specification. This ensures that applications provide only one way to modify standard parameters.

copy items

Copies multimedia data onto the Clipboard without modifying the workspace. The following items modify this command.


at rectangle

Specifies the portion of each frame that will be copied. If omitted, it defaults to the entire frame.

audio stream stream

Specifies the audio stream in the workspace affected by the command. If you use this flag and also want to copy video, you must also use the video stream flag. (If neither flag is specified, all audio and video streams are copied.)

from position

Specifies the start of the range copied. If omitted, it defaults to the current position.

to position

Specifies the end of the range copied. The audio and video data copied are exclusive of this position. If omitted, it defaults to the end of the workspace.

video stream stream

Specifies the video stream in the workspace affected by the command. If you use this flag and also want to copy audio, you must also use the audio stream flag. (If neither flag is specified, all audio and video streams are copied.)


cue items

Prepares a device instance for playback or recording. When a device is cued, the device performs whatever time consuming operations it can do in advance so that the play or record commands will start quickly. This command switches a device instance in a stopped state to a paused state. This command is modified by the following optional items:


input

Prepares the device instance for recording. If a previous reserve or cue command has not been used, recording will perform an implied reserve (if applicable) using device-specific default parameters. Input can be omitted if the current presentation source is already the external input. (This command has no effect on selecting the presentation source.)

output

Prepares the device instance for playing. If the workspace is paused, no positioning occurs. If the workspace is stopped, the position might change to a previous key frame image. The output flag can be omitted if the current presentation source is already the workspace.

to position

Specifies the position in the workspace. Unlike seek to position, cue to position always finishes in paused mode. The default is the current position.

noshow

Positions the workspace without changing the displayed image or the contents of the frame buffer. However, it changes the current position to that specified in the to parameter and gets ready to display that frame. For example, the cue to 5 noshow command positions the device at frame 5 without displaying the image of frame 5. Subsequently, sending cue without noshow displays the image.


cut items

Cuts multimedia data from the workspace and copies it onto the Clipboard. The change only becomes permanent when the data is explicitly saved. However, playback acts as if the data had actually been removed. This command is modified by the following items:


at rectangle

Specifies the portion of each frame cut. If omitted, it defaults to the entire frame. When this item is specified, frames are not actually deleted. Instead the area inside the rectangle becomes black.

audio stream stream

Specifies the audio stream in the workspace affected by the command. If you use this flag and also want to cut video, you must also use the video stream flag. (If neither flag is specified, all audio and video streams are cut.)

from position

Specifies the start of the range cut. If omitted, it defaults to the current position.

to position

Specifies the end of the range cut. The audio and video data cut are exclusive of this position. If omitted it defaults to the end of the workspace.

video stream stream

Specifies the video stream in the workspace affected by the command. If you use this flag and also want to cut audio, you must also use the audio stream flag. (If neither flag is specified, all audio and video streams are cut.)


delete items

Deletes multimedia data from the workspace without affecting the Clipboard. The change becomes permanent only when the data is explicitly saved. Playback, however, acts as if the data had actually been removed. This command is useful for recording with devices that do not support recording into a file containing existing data. This command is modified by the following items.


at rectangle

Specifies the portion of each frame deleted. If omitted, it defaults to the entire frame. When this item is specified, frames are not actually deleted. Instead the area inside the rectangle becomes black.

audio stream stream

Specifies the audio stream in the workspace affected by the command. If you use this flag and also want to delete video, you must also use the video stream flag. (If neither flag is specified, all audio and video streams are deleted.)

from position

Specifies the start of the range deleted. If omitted, it defaults to the current position.

to position

Specifies the last frame deleted. The audio and video data deleted are exclusive of this position. If omitted, data up to, and including the last frame of the workspace is deleted.

video stream stream

Specifies the video stream in the workspace affected by the command. If you use this flag and also want to delete audio, you must also use audio stream flag. (If neither flag is specified, all audio and video streams are deleted.)


freeze item

Stops the updating of the frame buffer from the presentation source. It has no effect on the presentation source itself, which can continue to generate images that are discarded. The following optional items modify freeze.


at rectangle

Specifies a rectangular region within the frame buffer. Unless the outside flag is used, all of the pixels within the rectangle will have their lock mask bit turned on. If this item is not specified, it defaults to the entire frame buffer. The specified pixels will not be updated until their lock mask bit is turned off. This item is supported only if capability device name can lock is true.

outside

Indicates the area outside the region specified with the at flag is frozen.


info items

Fills a user supplied buffer with a string containing information about the device or driver instance. The following optional items modify info:


audio algorithm

Returns the name of the current audio compression algorithm.

audio quality

Returns the name for the current audio quality descriptor. This might return unknown if the application has set parameters to specific values that do not correspond to defined qualities.

file

Returns the full path of the file specified with the last open or load. If the device is opened without a file and the load command has not been used, then a null string is returned.

product

Returns the product name. This should be a descriptive name, typically giving manufacturer and model number. This name must be 31 characters or less.

still algorithm

Returns the name of the current still image compression algorithm.

still quality

Returns the name for the current still image quality descriptor. This might return unknown if the application has set parameters to specific values that do not correspond to defined qualities.

usage

Returns a string describing usage restrictions that might be imposed by the owner of the visual or audio data in the workspace.

version

Returns the release level of the device driver and hardware. Device-driver developers must document the syntax of the returned string.

video algorithm

Returns the name of the current video compression algorithm.

video quality

Returns the name for the current video quality descriptor. This might return unknown if the application has set parameters to specific values that do not correspond to defined qualities.

window text

Returns the text string in the title bar of the window associated with the device instance.


list items

Returns information describing the compression algorithms, video sources, audio streams, and video streams supported by the device. This is an enumerated list. The count flag is used to determine the number of items in the list. The number flag specifies the index into the list. When used with the number flag, the list command returns information about the item corresponding to the index. The items are defined as follows:

_


audio algorithm

Specifies the command should retrieve audio algorithm names.

audio quality

Specifies the command should

algorithm algorithm

retrieve quality levels associated with the specified algorithm. If algorithm is current then the quality level of the current algorithm is returned.

audio stream

Specifies the command should retrieve the names of the audio streams associated with the workspace. These are strings (such as "English" or "German") are embedded in the file and identify the stream.

count

Returns the number of options of the specified type.

number index

Returns a string describing a specific option (as identified by index) of the specified option type. Index must be an integer between 1 and the value returned by count.

still algorithm

Specifies the command should retrieve still algorithm names.

still quality

Specifies the command should

algorithm algorithm

retrieve quality levels associated with the specified still algorithm. If algorithm is current then the quality level of the current algorithm is returned.

video algorithm

Specifies the command should retrieve video algorithm names.

video quality

Specifies the command should retrieve

algorithm algorithm

quality levels associated with the specified video algorithm. If algorithm is current then the quality level of the current algorithm is returned.

video source

Specifies the command should return information about the video sources. When used with the count flag, it returns the number of video sources. When used with the number flag, it returns the type of a video source. MCI defines the following constants for type: ntsc, rgb, pal, secam, svideo, and generic. There might be more than one source of each type returned. The generic source type is used when more than one signal is allowed for that connector.

video stream

Specifies the command should retrieve the names of video streams associated with the workspace. These are strings (for example, "funny ending" or "sad ending") are embedded in the file and identify the stream.


load item

Loads a file into the workspace for the device instance. Files loaded using this command cannot be shared. Loading a file cancels any signals set for the device instance. After loading a file, the return value of status mode stopped.

When a device is opened as a digital video device, it loads a still or motion video file into the workspace. When a device is opened as an overlay device, it loads a still image into the frame buffer. Overlay devices should use the restore command rather than load.

This command is modified by the following item:


filename

Specifies the path and filename for the file loaded into the workspace. This item is required.


monitor items

Specifies the presentation source. (The default presentation source is the workspace.) Switching the presentation source switches all audio and video streams in the source. The presentation source automatically switches to the workspace after a play, step, pause, cue output, or seek command. The record command does not automatically switch presentation sources. This gives your application the option of not showing video while it is being recorded. This command is modified by the following items:


input

Specifies that the external input is the presentation source. If a play command is in progress, it is first paused. If setvideo is on, this flag displays a default hidden window. Devices might limit what other device instances can do while monitoring input.

file

Specifies that the workspace is the presentation source. This is the default source.

method method

When used with monitor input, this flag selects the method of monitoring. Method is either pre, post, or direct. Direct monitoring requests that the device be configured for optimum display quality during monitoring. The direct monitoring method might be incompatible with motion video recording.

Pre- and post-monitoring both allow motion video recording. Pre-monitoring shows the external input prior to compression, while post-monitoring shows the external input after compression. Typically, different monitoring methods have different hardware implications. The default monitoring method is selected by the device.


open items

Initializes an instance of the digitalvideo device driver. Each open creates an independent instance of the device, which can be referenced by its device name. There might be device specific restrictions on how many instances can be opened simultaneously. The following items modify open:


alias alias

Specifies an alias used to reference this instance of the device. The open is rejected if the alias is already in use by this application. If this item is omitted, the default device name is the specified filename.

nostatic

Indicates that the device should reduce the number of static (system) colors in the palette. Reducing the number of static colors increases the number of colors available for rendering the video stream. This item only applies to devices that share a palette with Windows.

parent hwnd

Specifies the parent of the default window. This item is only used with a window style that requires the specification of a parent or owner. hwnd is the ASCII decimal equivalent of the parent window's handle.

shareable

Specifies that a single instance of the associated file can be accessed by two or more device instances. That is, file positioning commands directed towards one of these instances will affect the position in all the instances. Each instance can, however, have an independent window as well as other characteristics not directly related to file positioning. If the device uses only a single instance of digitizer hardware, then this flag also lets a single digitizer frame buffer be shared by multiple device instances.

style StyleValue

Specifies the style used for the default window. The StyleValue is the ASCII decimal value corresponding to a Windows style used by the CreateWindow function. The default value for StyleValue is WS_OVERLAPPED. In addition, the following constants are defined for StyleValue: overlapped, popup, and child.

type device_type

Specifies the device type of the device element. If omitted, MCI selects the device based on the filename extensions listed in the [mci extensions] section of the WIN.INI file. This flag is required when new is specified.


paste items

Copies the contents of the Clipboard into the workspace. No signals are present in the data copied from the Clipboard. The change becomes permanent only when the data is explicitly saved. However, playback acts as if the data had actually been added. This command is modified by the following items:


at rectangle

Specifies the location within the frame where the data is pasted. The upper left corner of the rectangle corresponds to the upper left corner of the added data. If the rectangle has a non-zero size in X or Y, the contents of the Clipboard are scaled in those dimensions when they are pasted into the frame. If omitted, the rectangle defaults to the entire frame. If this item is specified in insert mode (the default), then any region outside the rectangle is painted a solid color.

audio stream stream

Specifies the audio stream in the workspace affected by the command. If only one audio stream exists on the Clipboard, the audio data is pasted into the designated stream. If more than one audio stream exists on the Clipboard, the stream indicates the starting number for the stream sequences. If you use this flag and also want to paste video, you must also use the video stream flag. (If neither flag is specified, all audio and video streams are pasted and retain their original stream numbers.)

insert

Specifies that the data is inserted into the workspace. Any data after the insertion point is moved forward in the workspace to make room. This is the default value.

overwrite

Specifies that the data is copied into the workspace by writing over any existing data after the insertion point. The insert and overwrite flags affect whether frames are destroyed or moved during the paste operation, not how the data is pasted within each frame.

to position

Specifies the position in the workspace at which the data is pasted. If omitted, it defaults to the current position.

video stream stream

Specifies the video stream in the workspace affected by the command. If only one video stream exists on the Clipboard, the video data is pasted into the designated stream. If more than one video stream exists on the Clipboard, the stream indicates the starting number for the stream sequences. If you use this flag and also want to paste audio, you must also use the audio stream flag. (If neither flag is specified, all audio and video streams are pasted and retain their original stream numbers.)


pause

Pauses the playing or recording of motion video or audio. The last displayed image remains visible and the device instance remains cued. The play, record, and resume commands continue the operation of a paused device. If pause follows a play notify, the notification is not aborted

If the hold flag was specified for a record in process, pausing a device also executes the monitor file command. This stops the presentation of audio and video data from the external input providing a visual cue that recording is paused.

play items

Starts the generation of audio and/or video signals from the data in the workspace. Play causes an implied selection of the workspace as the presentation source. If setvideo is on, play displays a default hidden window. When a device finishes playing, its mode is the same as defined for seek. There might be device specific restrictions on what activities can occur simultaneously in other device instances. The following optional items modify play:


from position

Specifies the position to seek to before beginning playback. The position value is specified in the current time format. The position the device uses is affected by whether seek exactly is on or off.

If this flag is omitted and playing is currently paused or the device is cued, playing starts at the current position. If it is omitted and playing is stopped, the resulting seek might require changing the position to a previous key frame image.

repeat

Specifies that the playback should repeat until it is paused or stopped. Each iteration uses all the flags specified for the play command. If a from position is not specified using this command, the second and subsequent iterations start at the beginning of the media.

Pausing play does not cancel the repeat flag.

reverse

Specifies playing should occur in reverse. A device might support reverse playback only for certain files (for example, files consisting of still images). If a file cannot play in reverse, or a device is incapable of playing the file in reverse, the command is rejected. If possible, the device plays any accompanying audio if audio output is enabled.

to position

Specifies the position to stop playing. When the current time format is frames, the position value is the number of the frame displayed when the motion video stops. Audio associated with the frame specified for to is not played by most devices. The to position is not affected by the seek exactly state. If to is not specified, playing continues until the last valid position is reached. In either case, when playing is done, the workspace has an image displayed in the window.


put items

Specifies a rectangular region that describes a cropping or scaling option. A flag indicating the video source or destination (for example, destination, frame, video, source, or window) must be specified with this command. The following items modify put:


at rectangle

Specifies the rectangle used for one of the modifier items for this command.

If a rectangle is not specified for a video source or destination, it defaults to the full image. A rectangle consists of four integer values denoting the coordinates of the upper-left pixel and the width and height of the rectangle. Each integer is delimited by one or more spaces. The pixel origin is defined such that pixel (0,0) is in the upper-left corner of the client rectangle, frame buffer or input depending on the specified region.

Some devices might recognize negative values used for the height and width. The interpretation of these values is device dependent.

destination

Specifies the portion of the client window used to show the image or video. The destination rectangle is specified relative to the upper-left corner of the client window in pixel coordinates. The default rectangle is the full client area.

The device instance will, to the best of its ability, linearly scale the rectangle specified by put source to the specified portion of the display. Devices that do not support a capability of can stretch, or cannot perform the specific stretch indicated, might display a different sized image starting at the designated upper-left pixel. If the specified rectangle is outside the client region, then no pixels are drawn. Devices that cannot shrink the image to the requested size crop the right and bottom of the image or video to avoid drawing outside the destination rectangle.

frame

Specifies which portion of the frame buffer, in frame buffer coordinates, the video rectangle should be scaled to fit within. The default rectangle is the full frame buffer. Specifying this rectangle lets the hardware scale the data as it is digitized. Devices that cannot do this scaling operation reject the command with MCIERR_UNSUPPORTED_FUNCTION. (A device cannot stretch the input if it returns false to capability can stretch input.)

source

Specifies which portion of the frame buffer, in frame buffer coordinates, is scaled to fit in the destination rectangle.

video

Specifies which portion of the current presentation source is stored in the frame buffer. The coordinates are in the natural coordinates for the presentation source. This rectangle specifies cropping that occurs prior to storing images and video in the frame buffer. The default rectangle is the full active scan area or the full decompressed images and video area.

window

Changes the size and location of the display window. The rectangle specified with the at flag is relative to the parent window of the display window (usually the desktop). If the rectangle is not specified, it defaults to the initial window size and position. (This is usually set to an optimum size and aspect ratio.)

window client

Changes the size and location of the client window. This is the same as put window except that the specified rectangle is the position of the client rectangle rather than the position of the display window. See the Windows AdjustWindowRect function for more information about client rectangles.


quality items

This command defines a custom quality level for either audio, video or still image data compression. It defines a string name for the quality level, which can then be used in a setvideo quality, setvideo still quality, or setaudio quality command to establish it as the current video, still or audio compression quality level. Precisely one of the three flags audio, still, and video must be present.


algorithm

algorithm

Associates the quality level with the specified algorithm. This algorithm must be supported by the device, and must be compatible with the audio, still, or video flag that is used. If omitted, the current algorithm is used.

audio name

Indicates this command specifies an audio quality level identified with name.

dialog

Requests that the device display a dialog box. This dialog box has algorithm-specific fields that are used internally by the device to create the data structure describing a specific quality level.

handle handle

Specifies a handle to a data structure that contains algorithmic-specific data describing a specific quality level. The data structures for the data referenced by this handle are device specific.

still name

Indicates the command specifies a still quality level identified with name.

video name

Indicates the command specifies a video quality level identified with name.


realize items

Tells the device to select and realize its palette into a display context of the displayed window. This command applies only to devices that use palettes. For more information, see the description of SelectPalette in the Windows 3.1 Programmer's Reference. One of the following items modifies realize:


background

Realizes the palette as a background palette.

normal

Realizes the palette normally. This is the default.


record items

Compresses and stores audio and/or video data into the workspace. Recording uses a contiguous disk file allocated by a previous or implied reserve or cue input command. If you have not used reserve or cue input previously, record performs an implied reserve (with device specific default parameters) when necessary. If you have not set the file format, compression algorithm, and quality levels, their defaults are used. There can be device specific limitations on what other device instances might be doing during a record. The following items modify the behavior of record.


at rectangle

Specifies a rectangular region of the external input used as the source for the pixels compressed and saved. If not specified, the rectangle defaults to the rectangle specified (or defaulted) for put video. When it is set differently than the video rectangle, the displayed image is not what is recorded.

audio stream stream

Specifies the audio stream used for recording. If this flag is not specified and the file format does not define a default, it is recorded into the physically first stream.

from position

Specifies the position in the workspace where recording should begin. If this item is omitted, the default is the current position in the workspace.

hold

Specifies that when recording stops, there should be an automatic monitor file. When someone is monitoring the input, this provides immediate visual feedback that recording is complete or is suspended.

insert

Indicates the recorded data should be inserted in the existing workspace file at the position specified with the from flag. Whatever data is presently in the workspace is preserved. This is the default. The duration of recording is specified by the difference between the to and from flags. Devices that support inserting data do not change the contents of the original file until the data is explicitly saved with the save command. The device will, however, display the modified data with the play command. If a file in the workspace has data following the explicit or implied from position, and the device cannot guarantee it will preserve this data, it should reject the command.

overwrite

Specifies recorded data should replace data already present in the workspace. The frames replaced are designated by the from and to flags. Devices that support overwriting data do not change the contents of the original file until the data is explicitly saved using the save command. The device will, however, display the modified data with the play command. If a file in the workspace has data following the explicit or implied to position, and the device cannot guarantee it will preserve this data, it should reject the command.

to position

Specifies the frame in the recorded file where recording should end. The audio and video data recorded are exclusive of this position. When recording is complete the device is at the specified position and the mode is the same as defined for seek. If the to parameter is omitted then recording continues until a pause or stop command is sent.

video stream stream

Specifies the video stream used for recording. If this is not specified and the file format does not define a default, then it is recorded into the physically first stream.


reserve items

Allocates contiguous disk space for the device instance's workspace. If needed, the space reserved is used by subsequent record or save commands. If the workspace contains unsaved data, the data is lost. For some devices, reserve is not required and will be ignored. If disk space is not reserved prior to recording, the record command will perform an implied reserve with device specific default parameters. Use an explicit reserve command if you want better control of when the delay for disk allocation occurs, control of how much space is allocated, and control of where the disk space is allocated. The amount and location of already reserved disk space for the device instance can be changed by subsequent reserve commands. Any allocated, and still unused, disk space is not deallocated until any recorded data is saved, or until the device instance is closed. The following optional items modify reserve:


in path

Specifies the drive and directory path (but not the name) of a temporary file used to hold recorded data. The name of this file is specified by the device. The temporary file is deleted when the device is closed. If this flag is omitted, the device specifies the location of the disk space.

size duration

Specifies the approximate amount of disk space to reserve in the workspace. The duration value is specified in the current time format. The device bases its estimate of the required disk space on the following parameters: the requested time, the file format, the video and audio compression algorithm, and the compression quality values in effect. If setvideo record is off then space is reserved for audio only. If setaudio record is off then space is reserved for video only. If both are off or if duration is zero then no space is reserved and any existing reserved space is deallocated. If this flag is omitted, the device will use a device defined default.


restore

Copies a still image from a file to the frame buffer. This is the reverse of capture. Devices can recognize a variety of image formats and a Windows DIB is always accepted. The following items modify restore:


at rectangle

Specifies a rectangle relative to the frame buffer origin. The rectangle is specified as X1 Y1 X2 Y2. The coordinates X1, Y1 specify the top, left corner and the coordinates X2, Y2 specify the width and height of the rectangle.

If this flag is not used, the image is copied to the upper-left corner of the frame buffer.

from filename

Specifies the image filename to recall. This flag is required.


resume

Specifies playing or recording should continue from where it was interrupted by a pause or stop command. The to position specified using the original play or record command is remembered, as well as any other flags that were specified. Resume is always allowed, even if play or record has not been previously used. In this case, it is the same as a play with no parameters.

If any commands used notify between the pause and the resume commands, it supersedes any pending notify from the original play or record command. When the notify flag is used with resume, MCI notifies the application when the resumed play or record completes.

save item

Makes a permanent copy of the contents of the workspace or frame buffer. If the device is opened as an overlay device, this command saves the contents of the frame buffer. If the device is opened as a digital video device, this command saves the contents of the workspace. Save deallocates any unused disk space from the reserve. The current position is not affected by the progress of the save operation. The following items modify save:


abort

Stops a save operation in progress. If used, this must be the only item present.

at rectangle

Specifies a rectangle relative to the frame buffer origin. The rectangle is specified as X1 Y1 X2 Y2. The coordinates X1, Y1 specify the top, left corner and the coordinates X2, Y2 specify the width and height of the rectangle. This parameter is allowed only when the device is opened as an overlay device.

For a digital video devices, capture is used to capture the contents of the frame buffer. Overlay devices should use the capture command to capture the frame-buffer contents.

filename

Specifies the filename to assign to the data file. If a path is not specified, the file will be placed on the disk and in the directory previously specified on the explicit or implicit reserve. If reserve has not been issued, the default drive and directory are those associated with the application's task. If a path is specified, the device might require it to be on the disk drive specified by the explicit or implicit reserve. The filename is a required item.

keepreserve

Specifies that unused disk space left over from the original reserve command is not deallocated.


seek items

Positions the workspace. At the end of the seek, the device shows the specified frame. Depending on the device, the mode after a seek is either paused or stopped. (Devices might make a tradeoff between the need to begin play quickly and the need to conserve resources used while paused.) If a device is stopped after seek then an image must be shown in stopped mode. The following items modify seek:


to position

Specifies the desired new position in units of the current time format. If seek exactly is set off, seek positions the workspace at approximately the requested frame. In general, if the requested frame is interframe encoded, seek positions the workspace at a nearby, previous key frame image. There are two exceptions to this positioning rule.

The first exception is if the to position follows the current position but is before the next key frame image. In this case, the device maintains the current position.

The second exception applies to newly recorded files that have not been saved. In this case, some devices may position the workspace at the first frame of the new data.

to end

Positions the workspace to the last frame. If seek exactly is off, this might seek to the last key frame image.

to start

Positions the workspace to the first frame.


set items

Sets the state of various control items. One of the following items must be included:


door closed

Returns MCIERR_UNSUPPORTED_FUNCTION.

door open

Returns MCIERR_UNSUPPORTED_FUNCTION.

file format format

Specifies the file format used for save. The device developer should document the supported file formats and the default file format. If the specified file format conflicts with the currently selected algorithm and quality then they are changed to the defaults for the file format.

seek exactly on

Selects one of two seek modes. If seek

seek exactly off

exactly is on, then the seek, play from, and record from commands will precisely access the requested frame. This might cause an extra delay if the requested frame is not a key frame. (In this case, the device must decode previous frames to decode the requested frame.)

If seek exactly is off, the device will seek to a key frame image that precedes the requested frame. For some devices, and some files, this might be the first frame of the file.

The default for seek exactly is device dependent.

speed factor

Sets the relative speed of video and audio playback from the workspace. Factor is the ratio between the nominal frame rate and the desired frame rate where the nominal frame rate is designated as 1000. For example, half speed is 500 and double speed is 2000. The allowable speed range is device and possibly file dependent.

still file

Specifies the file format used for capture

format format

commands. The device developer should document the supported file formats and the default file format. If the specified file format conflicts with the currently selected algorithm and quality then they are changed to the defaults for the file format.

time format format

Sets the time format to format. All position information is specified in this format following this command. A digitalvideo driver must support a time format of frames and should support a time format of milliseconds. The default time format is frames. Milliseconds can be abbreviated ms.


setaudio items

Sets various values associated with audio playback and capture. Some parameters used in the items list are specified as a factor. For these items, 0 represents a minimal amount of the specified characteristic, and 1000 represents the maximum value. To determine the value that indicates no change from the presentation source use the nominal flag with the status command. The linearity of these values is device specific. If a device cannot set the requested factor, it uses the closest value it supports. You can use the status command to determine the actual values set by the device. The setaudio command is modified by the following items (only one of these items can be present in a single command unless otherwise noted):


alignment

Sets the alignment of data blocks relative

to integer

to the start of input waveform data.

algorithm algorithm

Selects a specific audio compression algorithm for use by a subsequent reserve or record command. The algorithms supported are device specific. MCI defines the values g711, g721, g722, g728, pcm, cdxa, adpcm, adpcm4e for algorithm. If a device supports the algorithm names pcm, cdxa, and adpcm4e, they adhere to standard definitions. The cdxa algorithm has been defined by Sony Corporation. The adpcm4e algorithm has been defined by Intel Corporation. The g711, g721, g722, and g728 values represent audio algorithms recommended by the CCITT.

If the specified algorithm conflicts with the current file format, the file format is changed to the default format for the algorithm.

bass to factor

Sets the audio low frequency level.

bitspersample

to bit_count

Sets the number of bits per sample recorded. The file is saved in this format. This flag applies only to devices supporting the pcm algorithm

bytespersec

to integer

Sets the average number of bytes per second for recording in the pcm and adpcm algorithms. The file is saved in this format.

clocktime

Indicates the time specified in the over parameter is in milliseconds. This time is absolute and not in step with the playing of the workspace.

input

Modifies the bass, treble, or volume flag so that it affects the input signal and modifies what is recorded. If possible, this is the default when monitoring the input.

left off

left on

Enables or disables audio output on the left channel. The audio presentation source can be the external input or the workspace. The default is left on. If there is only one channel is set on or off.

left volume to factor

Sets the audio volume of the left audio channel. If there is only one channel it sets its volume

off

on

Enables or disables audio. The audio presentation source can either be the external input or the workspace. This command affects the left and right audio channel simultaneously. The default is setaudio on.

output

Modifies the bass, treble, or volume flag so that it modifies only the played signal and not what is recorded. If possible, this is the default when monitoring file.

over duration

Specifies how long it should take to make a change that uses a factor parameter. The units for duration are in the current time format. Changes occur in step with the playing of workspace. When playing is suspended, the change is also suspended until the play continues. If over is not used or not supported, the change occurs immediately.

quality descriptor

Specifies the characteristics of the audio compression performed when audio is recorded to a file. All devices support the three descriptors low, medium, and high. The default is device specific.

If the algorithm flag is not specified, the quality adjustment applies to the current algorithm.

The device-driver developer must determine and document the significance of the descriptor names used by the device. While a device can define its own descriptor names, the following additional naming conventions should be used to minimize confusion:For cdxa, low, medium and high denote the Sony-defined levels C, B, and A.

The quality command can be used to define additional descriptor names.

record on

record off

Enables or disables recording of audio data. The default is to record audio data.

right off

right on

Enables or disables audio output on the right channel. The audio presentation source can be the external input or the workspace. The default is right on. If there is only one channel, this flag has no effect.

right volume

to factor

Sets the audio volume to the right audio channel. If there is only one channel, it has no effect.

samplespersec

to integer

Sets the sample rate for recording with the pcm and adpcm algorithms. The file is saved in this format.

source to

sourcename

Specifies the source for the audio input digitizer. The constants defined for sourcename include: left, right, average, and stereo. The first three specify monophonic recording using the left input only, the right input only, and the average of the two inputs.

stream to number

Specifies the audio stream played back from the workspace. If the stream is not specified and the file format does not define a default, then the physically first interleaved audio stream will be played.

treble to factor

Sets the audio high-frequency level.

volume to factor

Sets the average audio volume for both audio channels. If the left and right volumes have been set to different values, then the ratio of left-to-right volume is approximately unchanged.


setvideo items

Sets various values associated with video and still playback and capture. Some of the parameters in the items list are specified as a factor. For these items, 0 represents a minimal amount of the specified characteristic, and 1000 represents the maximum value. To determine the value that indicates no change from the presentation source, use the nominal flag with the status command. The linearity of these values is device specific. If a device cannot set the requested factor, it uses a value as close as possible to that specified. You can use the status command to determine the actual values set by the device. The setvideo command is modified by the following items (only one of these items can be present in a single command unless otherwise noted):


algorithm algorithm

Specifies a video compression algorithm for use by a subsequent reserve or record command. Algorithms support by a device are device specific. MCI defines the constants mpeg and h261 for algorithm.

If the specified algorithm conflicts with the current file format, the file format is changed to the default format for the algorithm.

bitsperpel to count

Sets the number of bits-per-pixel for saving data with capture or record.

brightness to factor

Sets the video brightness level.

clocktime

Indicates that the time specified in the over parameter is in milliseconds. The time is absolute and not in step with the playing of the workspace.

color to factor

Sets the color-saturation level.

contrast to factor

Sets the video-contrast level.

gamma to value

Specifies the gamma correction exponent multiplied by 1000. For example, to specify an exponent of 2.2, use 2200 for value. A gamma value of 1.0 (1000) indicates no gamma correction is applied. Gamma correction adjusts the mapping between the intensity encoded in the presentation source and the displayed brightness.

input

Modifies the brightness, color, contrast, gamma, sharpness, or tint flag so that it affects the input signal and modifies what is recorded. If possible, this is the default when monitoring the input.

key color to r:g:b

Sets the key color. The r:g:b parameter is a Windows RGB value. Colons (:) separate the individual red, green, and blue values.

key index to index

Sets the key index. The index parameter is a physical palette index.

off

on

Enables or disables display of video. Disabling video sets the pixels in the put destination rectangle (or its default, the client region of the current window) to a solid color. It has no effect on the frame buffer

The video source, whether the workspace or an external input, might continue to store new images in the frame buffer. They are not displayed until video is enabled. If desired, you can use the window state command to hide the window. The default is setvideo on.

output

Modifies the brightness, color, contrast, gamma, sharpness, or tint flag so that it modifies only the displayed signal and not what is recorded. If possible, this is the default when monitoring file.

over duration

Specifies how long it should take to make a change that uses a factor parameter. The units for duration are in the current time format. Changes occur in step with the playing of workspace. When playing is suspended, the change is also suspended until the play continues. If over is not used or not supported, the change occurs immediately.

palette handle

to handle

Specifies the handle to a palette the device must use for rendering. This item is only supported by devices that use palettes. If handle is zero then the default palette is used.

Digital-video devices should not free the palette passed with this command. Applications should free it after they close the device

quality descriptor

Specifies the characteristics of the video compression performed when video is recorded to a file. All devices support the three descriptors: low, medium, and high. The default is device specific. The significance of these names depends on the algorithm and the device. Devices might define additional descriptor names. The quality command can be used to define additional descriptor names.

If the algorithm flag is not used, the descriptor applies to the current algorithm

record frame

Sets the recording for motion video. The

rate to rate

recording rate is specified in units of frames per second multiplied by 1000. For example, the NTSC frame rate of 29.97 frames per second is represented as 29970.

record on

record off

Enables or disables recording of video data. Recording video data is the default.

sharpness to factor

Sets the video sharpness level.

source to source

number value

Sets the source of the video input. This usually corresponds to external connectors. The constants defined for source include rgb, pal, ntsc, svideo, and secam. If more than one input of the specified type exists, the optional number value indicates the desired input. For example, set source to ntsc number 2 specifies the second NTSC input.

If to source is omitted then the absolute source is used as defined by the list video source command.

still algorithm

algorithm

Specifies the still image compression algorithm used by the capture command. Every device must support an algorithm of none, which means no compression, and this is the default. In this case, digital video devices save still images as RGB format DIBs. Devices might also support a device-specific list of additional algorithms.


still quality

Specifies the characteristics of the still


descriptor

image compression performed while capturing a still image. All devices support the descriptors low, medium, and high. The default is device specific. The device developer must determine and document the significance of the descriptor names for each algorithm the device supports. A device might also define descriptor names in addition to those already defined.

If the algorithm flag is not used, the descriptor applies to the current algorithm.

The quality command can be used to define other descriptor names.

stream to number

Specifies the video stream played back from the workspace. If the stream is not specified and a default stream is not defined by the file format, the physically first interleaved video stream is played.

tint to factor

Sets the image tint. Typically, this adjustment is modeled after the tint control of many color television sets, with 250 meaning green, 750 meaning red, and 0 (or 1000) meaning blue. The nominal value is always 500.


signal items

Marks positions in the workspace. The signals are valid until another signal command moves or disables them, or the contents of the workspace change. Whenever data at a signal is presented (the device plays or steps to it), the device sends a Windows message to the application. The message identifies the device and a user value; optionally, it identifies the position. Although the window used for notify will receive the signal messages, the signal mechanism is entirely independent of the behavior of the notify and wait flags.


at position

Specifies the location of the signal. The position value is in the current time format.

cancel

Removes signals from the workspace. An individual signal is specified using the uservalue flag. If the uservalue flag is not specified using cancel, the device cancels all signals. The cancel flag is incompatible with the at, every, position, and return position flags.

every interval

Specifies the period of the signals. The interval value is specified in the current time format.

If used with at position, signals are placed throughout the workspace with one signal mark placed at position.

Without the at flag, signals are places throughout the workspace with one signal at the current position.

If this flag is omitted, only the position indicated by the at flag is marked.

If the interval value is less than the minimum frequency supported by a device, it will use its minimum value.

return position

Indicates the device should send the position value instead of the uservalue ID in the signalling message. The uservalue ID can still be used to cancel or to redefine the signal marks.

uservalue id

Specifies an ID that is reported back with the signaling message. This ID acts as an identifier that can be used with other signal commands to reference this signal setting. If omitted, the default value is zero.


status item

Returns status information about a device instance. One of the following items modifies status:


audio

Returns on or off depending on the most recent setaudio on or off command. It returns on if either or both speakers are enabled, and off otherwise.

audio alignment

Returns the alignment of data blocks relative to the start of input waveform data.

audio bitspersample

Returns the number of bits per sample the device uses for recording. This flag applies only to devices supporting the pcm algorithm.

audio bytespersec

Returns the average number of bytes per second used for recording.

audio input

Returns the approximate instantaneous audio level of the analog input audio signal. A value greater than 1000 implies clipping distortion. Some devices can return this value only while recording audio. The value has no associated set or setaudio command. This value is related to, but normalized differently than, the waveaudio command status level.

audio record

Returns on or off, reflecting the state set by setaudio record.

audio source

Returns the current audio digitizer source: left, right, average, or stereo.

audio samplespersec

Returns the number of samples per second recorded.

audio stream

Returns the current audio-stream number.

bass

Returns the current video-bass level.

bitsperpel

Returns the number of bits per pixel for saving captured or recorded data.

brightness

Returns the current video-brightness level.

color

Returns the current-color level.

contrast

Returns the current-contrast level.

current track

Typically returns 1.

disk space drive

Returns the approximate disk space that can be obtained by a reserve command for the specified disk drive. The space available is measured in units of the current time format. The drive is usually specified as a single letter or a single letter followed by a colon (:). However, some devices might use a path.

file completion

Returns the estimated percentage a load, save, capture, cut, copy, delete, paste, or undo operation has progressed. (Applications can use this to provide a visual indicator of progress.) This flag is not supported by all devices.

file format

Returns the current file format for record or save.

file mode

Returns loading, saving, editing, or idle. During a load operation, it returns loading. During save and capture operations, it returns saving. During cut, copy, delete, paste, or undo operations, it returns editing.

forward

Returns true if the play direction is forward or if the device is not playing. Returns false otherwise.

gamma

Returns the value set with setvideo gamma to value.

input

Modifies the bass, treble, volume, brightness, color, contrast, gamma, sharpness, or tint flag so that it applies only to the input. This is the default when monitoring the input.

left volume

Returns the volume set for the left audio channel.

length

Returns the duration of the file in the workspace. The value returned is the length of the longest active stream. This is in units of the current time format. The flag returns zero if the workspace is empty.

length track

TrackNo

Returns the same value as status length if TrackNo is 1. Most devices reject this flag if TrackNo is not 1.

media present

Returns true.

mode

Returns the mode of the device: not ready, paused, playing, recording, or stopped. If it returns not ready, then retrying the command eventually returns one of the other values unless there is a hardware error. During a record operation, it returns recording. During a step or play operation, it returns playing. After a cue operation has completed, it returns paused. After a stop or load operation, and immediately after an open operation, it returns stopped. After a seek, step, play, or record operation it returns either stopped or paused depending on the device.

monitor

Returns file or input. The returned value indicates the current presentation source.

monitor method

Returns pre, post, or direct. The returned value indicates the method used for input monitoring.

nominal

The item modifies the bass, brightness, color, contrast, gamma, sharpness, tint, treble, and volume flags to return the nominal value instead of the current setting.

nominal frame rate

Returns the nominal frame rate associated with the file. The units are in frames per second multiplied by 1000.

nominal record

frame rate

Returns the nominal frame rate associated with the input video signal. The units are in frames per second multiplied by 1000.

number of tracks

Typically returns 1.

output

Modifies the bass, treble, volume, brightness, color, contrast, gamma, sharpness, or tint flag so that it applies only to the output. This is the default when monitoring file.

palette handle

Returns the palette handle used for display of motion video in the low-order word of the return value. This flag is supported only by devices that use palettes.

pause mode

Returns recording if the device is paused while recording. It returns playing if the device is paused while playing. It returns the error Action not applicable in current mode if the device is not paused.

position

Returns the current position in the workspace. This is in units of the current time format.

position track

TrackNo

Returns the same value as status position if TrackNo is 1. Most devices reject this flag for other values for TrackNo

ready

Returns true if this device instance is ready to accept another command. It returns false for a short interval immediately after initiating some commands, or in the case of a hardware error. The commands that cause a device to return false temporarily is device specific.

record frame rate

Returns the frame rate used for compression. This is in units of frames per second multiplied by 1000.

reference frame

Returns the frame number for the nearest key frame image that precedes the specified frame.

reserved size

Returns the size of the reserved workspace. This value is in units of the current time format. The size corresponds to the approximate time it would take to play the compressed data from a full workspace. It returns zero if there is no reserved disk space. This flag returns the approximate size because the precise disk space for compressed data cannot, in general, be predicted until after the data has been compressed.

right volume

Returns the volume set for the right audio channel.

seek exactly

Returns on or off indicating whether or not seek exactly is set.

sharpness

Returns the current sharpness level of the device.

smpte

Returns the SMPTE (Society of Motion Picture Engineers) time code associated with the current position in the workspace. This is a string with the form dd:dd:dd:dd, where each d denotes a digit from 0 to 9. If the workspace data does not include timecode data, then this flag returns 00:00:00:00.

speed

Returns the current playback speed in the same format used in set speed.

start position

Returns the frame number for the first frame in the workspace. It is typically zero or one.

still file format

Returns the current file format for the capture command.

time format

Returns the current time format.

tint

Returns the current video-tint level.

treble

Returns the current audio-treble level.

unsaved

Returns true if there is recorded data in the workspace that might be lost as a result of a close, load, record, reserve, cut, delete, or paste command. Returns false otherwise.

video

Returns on or off, reflecting the state set by setvideo.

video key index

Returns the value for the key index.

video key color

Returns the value for the key color.

video record

Returns on or off, reflecting the current state set by setvideo record.

video source

Returns the current video-source type.

video source

number

Returns a number corresponding to the video source of the type in use. For example, status video source number returns 2 if the second NTSC video source input is being used.

video stream

Returns the current video-stream number.

volume

Returns the average of the volume to the left and right speakers.

window handle

Returns the ASCII decimal value for the current window handle associated with this device instance.

window visible

Returns true if the window is not hidden.

window minimized

Returns true if the window is minimized.

window maximized

Return true if the window is maximized.


step items

Advances the position in the workspace. In addition to moving to a following image, this command selects the workspace as the presentation source, and stores the new image in the frame buffer for display. This command always operates on whole frames regardless of the current time format. The step command is not affected by the state of seek exactly. This command always functions as if seek exactly is on. A step command without any flags always advances to the next frame. Audio is muted during the step. After a step command, the mode of the device is the same as defined for seek. There might be device specific limitations on what other digital video instances can do during a step. This command is modified by the following items:


by frames

Specifies the number of frames to advance before showing another image. The default value is one which steps to the next image. Any images between the current image and the target image are not stored in the frame buffer. The value of frames might be negative, in which case the reverse flag cannot be used.

reverse

Indicates the step is in the reverse direction.


stop item

Stops playing or recording motion video or audio. Stopping a device might free resources allowing other device instances to play or record. Unless this command includes the hold flag, the display might turn a solid color. If stop follows a play notify, the notification is aborted. This command supports the following optional item:


hold

Prevents the release of resources required to redraw a still image on the screen. The frame buffer remains available for use in updating the display when, for example, the window is moved.


undo

Reverses the action taken by the most recent successful copy, cut, delete, undo, or paste command.

unfreeze item

Enables the update of the frame buffer from the presentation source. The following optional item modifies unfreeze:


at rectangle

Specifies a rectangle within the frame buffer whose pixels should have their lock mask bit turned off. If omitted, the rectangle defaults to the entire frame buffer. By using a sequence of freeze and unfreeze commands with different rectangles, arbitrary patterns of lock mask bits can be described.

A rectangle consists of four integer values denoting the coordinates of the upper-left pixel and the width and height of the rectangle. Each integer is delimited by one or more spaces. The pixel origin is defined such that pixel (0,0) is in the upper-left corner of the client rectangle, frame buffer, or input depending on the specified region.


update items

Repaints the current frame into the specified display context. When the application owns the window ( it has used window handle hwnd), it must call update whenever the window must be painted; for example, when responding to a WM_PAINT message. The following items modify update:


at rect

Specifies the clipping rectangle relative to the client rectangle.

hdc hdc

Specifies the handle of the display context to paint. If this parameter is not present then the device will render into the display context for the display window.

paint

An application uses the paint flag with update when it receives a WM_PAINT message intended for a display DC. A frame buffer device will usually paint the key color. A device that does not have a frame buffer may ignore update when the paint flag is used if it is currently playing because the display will be repainted during the play operation.

If the hdc flag is used without paint, the device renders the current frame into the provided hdc. Device supporting this feature will render a full bitmap and not just update the key color.

If both hdc and paint are omitted, the contents of the frame buffer of the video overlay device are refreshed. This is useful to show new live video data after an unfreeze is sent to the device from a paused state.


where items

Returns the rectangular region that has been previously specified (or defaulted) for the put command. The return string consists of four space separated integers that describe the X, Y coordinates of the upper left pixel, and the rectangle width and height. When the max flag is used, the command returns the maximum width and height of the region. The upper left pixel of the maximum region is always 0, 0. The following items modify where:


destination

Returns a description of the rectangular region used to display video and images. This region is a portion of the client rectangle of the current window.

destination max

Returns the current size of the client window.

frame

Returns a description of the rectangular region of the frame buffer. Images from the video rectangle are scaled into this region.

frame max

Returns the maximum size of the frame buffer.

source

Returns a description of the rectangular region of the frame buffer used as the source of video images. The device uses this rectangle to crop the image before it is stretched to fit the destination rectangle on the display.

source max

Returns the maximum size of the frame buffer.

video

Returns a description of the rectangular region of the presentation source used to fill the frame rectangle in the frame buffer.

video max

Returns the maximum size of the input.

window

Returns the current size and position of the display window frame.

window max

Returns the size of the entire display.


window items

Changes attributes of the window used to display images or motion video. If a window command is not used, the default window created when the device instance was opened is used. The default window has a style defined or defaulted on the open command and is initially invisible. It is possible to change windows at any time by using the window command. The default window is not destroyed until the device instance is closed; it is also possible to switch back to it.

If the current window is not visible and it is the default window, it becomes visible automatically whenever a play or monitor input command is used and when the state of setvideo is on. It is also possible to use the window state command to request the device to issue a ShowWindow call for the current window. The default window continues to show and play video when it is iconic.

The following items modify window:


handle hwnd

Specifies a window to be used with this device-driver instance. The hwnd parameter contains the ASCII numeric equivalent of the window handle returned by the CreateWindow function. Two device instances can use the same window handle provided, that each instance updates the video and image pixels in the window as if the other instance did not exist. When video output is disabled with setvideo off, an update command will make the destination rectangle a solid color.

handle default

Specifies that the window associated with the device instance should be the default window created when it was opened. The default window has no owner unless a parent window is specified on open.

state ShowValue

Executes the ShowWindow
function for the current window. The following constants are defined for ShowValue:
hide
minimize
restore
show
show maximized
show
minimized
show
min noactive
show
na
show
noactivate
show
normal

For a description of the behavior of these options, see the description for the ShowWindow function. In addition, the constants no action (for show na) and minimized (for show minimized) are also recognized.

text caption

Specifies the text placed in the current title bar of the window. If this text contains embedded blanks, the entire caption must be enclosed in quotation marks. The default caption for the default window is blank.