MCI (media control interface) Knowledge

Source: Internet
Author: User

Media Control Interface (MCI) Media Control Interface is a set of standard interfaces for multimedia devices and files provided by MircroSoft, its advantage is that it can easily control the vast majority of multimedia devices, including audio, video, album, video and other multimedia devices, without the need to know their internal working conditions. But the ancient saying goes: success and failure. Although it seems to be a great deal, it is far from enough for some advanced applications.

Control Mode of MCI:

Generally, programmers can use two functions to deal with MCI:

MCIERROR mciSendCommand (MCIDEVICEID wDeviceID, UINT uMsg, DWORD dwFlags, DWORD dwParam );

The command string method sends control commands in a way similar to everyday terms. It is suitable for advanced programming, such as VB and TOOLBOOK.

MCIERROR mciSendString (LPCTSTR lpszCommand, LPTSTR lpszReturnString, UINT cchReturn, HANDLE hwndCallback );

The command message method uses professional syntax to send control messages. It is applicable to programming in VC and other languages. This method is used to directly deal with the MCI device.

For mciSendCommand, the first parameter specifies the device identifier, which will be provided by the system when the programmer opens the MCI device. The second parameter specifies how to control the device. For details, refer to the "MCI command" column. The third parameter is the access identifier, and the fourth parameter is generally a data structure, which identifies some information required by the program to access the MCI. For more information, see the CD.

For mciSendString, the first parameter is a control string. The system fills in the returned information with the second parameter. The third parameter specifies the maximum length of the returned information, if the "Y" flag is set for the MCI device, enter the fourth parameter to return the window handle.

Example:

MciSendCommand (DeviceID, MCI_CLOSE, NULL, NULL); // closes an MCI device.

MciSendString ("open aaa. avi", 0, 0, 0); // open the file "aaa. avi"

The device type of MCI:

Device description string description

MCI_ALL_DEVICE_ID all devices

MCI_DEVTYPE_ANIMATIONAnimation animation Device

MCI_DEVTYPE_CD_AUDIOCdaudioCD audio

MCI_DEVTYPE_DATDat Digital Audio

MCI_DEVTYPE_DIGITAL_VIDEODigitalvideo Digital Video

MCI_DEVTYPE_OTHEROther undefined Device

MCI_DEVTYPE_OVERLAYOverlay overlapping video

Mci_devtype_scanner.pdf Scanner

MCI_DEVTYPE_SEQUENCERSequencer MIDI sequencer

MCI_DEVTYPE_VCRVcr video recorder

MCI_DEVTYPE_VIDEODISCVideodisc laser disk

MCI_DEVTYPE_WAVEFORM_AUDIOwaveaudio Wave audio

For an MCI device that is not defined above, you can view the [mci] section in the system. ini file, for example:

[Mci]

Cdaudio = mcicda. drv

Sequencer = mciseq. drv

Waveaudio = mciwave. drv

Avivideo = mciavi. drv

Videodisc = mcipionr. drv

Vcr = mcivisca. drv

ActiveMovie = mciqtz. drv

QTWVideo = mciqtw. drv

MPEGVideo = C: PROGRA ~ 1XINGXINGMP ~ 1xmdrv95. dll

The last two sentences respectively indicate Apple's QuickTime device, which is named "QTWVidio" and MPEG image device, and the device name is "MPEGVideo ".

//------------------------------

// Ad time:

// Welcome to C ++ Builder research-http://www.ccrun.com

//------------------------------

In MCI Programming, you can either describe a device as a device name or describe a string as a device name. One extreme lazy way is that programmers do not specify a device name in the program, windows automatically identifies the device type based on the file extension.

For example, there are three methods to open a multimedia file:

[1]: Automatic Identification: open a "WAV" File

MCI_OPEN_PARMS mciOpen;

MciOpen. lpstrDeviceType = 0;

MciOpen. lpstrElementName = "aaa.wav ";

MciSendCommand (NULL, MCI_OPEN, MCI_OPEN_ELEMENT, (DWORD) & mciOpen );

[2]: Specify the device Description: enable the CD player.

MCI_OPEN_PARMS mciOpen;

MciOpen. lpstrDeviceType = (LPSTR) MCI_DEVTYPE_CD_AUDIO;

MciSendCommand (NULL, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID, (DWORD) & mciOpen );

[3]: Specify the description string: open an AVI file

MCI_OPEN_PARMS mciOpen;

MciOpen. lpstrDeviceType = "avivideo ";

MciOpen. lpstrElementName = "aaa. avi ";

MciSendCommand (NULL, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_ELEMENT, (DWORD) & mciOpen );

Note the difference between the third parameter of the function in the three open methods, which will be discussed later.

MCI command

MCI_BREAK: Specifies the interrupt key. The default value is CTRL + BREAK"

MCI_CAPTURE captures the current frame and saves it to a specified file. It is only used for digital videos.

MCI_CLOSE

The MCI_CONFIGURE pop-up configuration dialog box is only used for digital videos.

MCI_COPY copy data to clipboard

MCI_CUE delayed playback or recording

MCI_CUT delete data

MCI_DELETE delete data

MCI_ESCAPE is only used for laser videos

MCI_FREEZE will show frozen

MCI_GETDEVCAPS: Get device information

Whether or not MCI_INDEX is displayed on the current screen. It is only used for VCR devices.

MCI_INFO

MCI_LIST: gets the number of input devices. It supports digital videos and VCR devices.

MCI_LOAD load a file

MCI_MARK cancels or makes a mark to match MCI_SEEK

MCI_MARK cancels or makes a mark to match MCI_SEEK

MCI_MONITOR specifies a report device for a digital video

MCI_OPEN open the device

MCI_PASTE paste data

MCI_PAUSE: Pause the current action

MCI_PLAY

MCI_PUT: Set the source, destination, and border rectangle.

MCI_QUALITY defines the default Device Quality

MCI_RECORD start recording

MCI_RESERVE allocating hard disk space

MCI_RESTORE: copy a bmp file to the frame buffer.

MCI_RESUME enables a paused device to restart

MCI_SAVE save data

MCI_SEEK

MCI_SET

MCI_SETAUDIO

MCI_SETTIMECODE enable or cancel the time code of the VCR Device

MCI_SETTUNER: set VCR device channels

MCI_SETVIDEO

MCI_SIGNAL: Set the specified space in the Workspace

MCI_STATUS

MCI_STEP enables the playback device to frame

MCI_STOP

MCI_SYSINFO

MCI_UNDO cancel Operation

MCI_UNFREEZE restores motion using the MCI_UNFREEZE video buffer

MCI_UPDATE

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.