Multimedia Standards Update MPEG Command Set for MCI June 2, 1994 Revision: .99 Information in this document is subject to change without notice and does not represent a commitment on the part of Microsoft Corporation. The software described in this document is furnished under license agreement or nondisclosure agreement. The software may be used or copied only in the accordance with the terms of the agreement. It is against the law to copy the software on any medium except as specifically allowed in the license or nondisclosure agreement. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying and recording, for any purpose without the express written permission of Microsoft Corporation. This standards update is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESSED OR IMPLIED IN THIS DOCUMENT. Microsoft, MS, MS-DOS, XENIX and the Microsoft logo are registered trademarks and Windows is a trademark of Microsoft Corporation. Other trade names mentioned herein are trademarks of their respective manufacturers. Copyright *1994 Microsoft Corporation. All Rights Reserved. Table of Contents OVERVIEW 3 Preface 3 Introduction 3 Where to Look for Information 3 Versions of this Document 3 MPEG COMMAND SET FOR MCI 4 Definitions 4 MpegVideo Command Set 4 State transition Model for the Driver 8 Notes on the New Calls 9 Overview Preface In late 1993 and early 1994, Microsoft was approached by several hardware and software companies interested in creating an industry standard for MPEG on PC’s. While commercial PC MPEG products are starting to appear many in the industry believe that a standard playback command set will speed widespread acceptance of MPEG on the PC. Along with others, Jim Anderson of Jazz Multimedia created the Open PC MPEG Consortium, eventually including participation of over 50 companies, including Microsoft. Our sincere thanks to Jim for his tireless organizing, chairing of meetings and faxing information. Our sincere thanks too to Partha Srivinasan and Prem Nath from Mediamatics who drafted the MCI MPEG command set, educated the participants on MCI and Windows, worked with Microsoft on the technical issues, and helped achieve consensus. Introduction This document addresses the topic of how to play back MPEG files under Windows. It is hoped that software developers will use this MPEG command set to develop any multimedia titles and games using MPEG data. It is hoped that PC hardware manufacturers will provide hardware and associated drivers that support this entire command set. In this way, customers will be assured that their titles will work on whatever MPEG add-on software or hardware they have in their system. We have limited this document to address the linear playback of MPEG data, and yet we understand that there are additional technical questions surrounding MPEG on PC’s. We expect to address additional requirements in future standards. Where to Look for Information This document is based on several other standards. This MPEG command set is a subset of the "Digital Video Command Set for the Media Control Interface" (Microsoft part# 098-37538). An electronic version of this document can be found on the MS Developers Network CD under the section "Specs and Strategy". The Media Control Interface is fully described in the Microsoft Windows 3.1 Software Developer Kit. The MPEG command set is meant to control System Bitstreams conforming to the ISO standard - 11172- 1. Microsoft expects to issue a final version of this doc by mid to late June, including header files. Please send any comments about this document before then to Heidib@Microsoft.com. Versions of this Document Version Date Who Comments 0.99 June 2, 1994 Heidi Breslauer First release. In final review. MPEG Command Set for MCI Definitions The MCI driver will support a subset of the MCI DV command set. All the commands will support the notify, test and wait modifiers. The proposed name for this device is: MpegVideo. This is the modifier to type that will be used by the open command. e.g. open compton.mpg type MpegVideo This is the name that will be used in the MCI section of system.ini e.g. [mci] .. AVIVideo=mciavi.drv .. MpegVideo=mymci.drv .. The driver will support the device type : digitalvideo. For details of the relevant keywords and their meanings see the Microsoft document "Digital Video Command Set for the Media Control Interface" - part# 098-37538. This document is meant to be an Appendix to the Microsoft Multimedia Standars Update titled above. An electronic version of this document can be found on the MS Developers Network CD under the section "Specs and Strategy". The PC-MPEG command set is meant to control System Bitstreams conforming to the ISO standard - 11172-1. MpegVideo Command Set The list of commands to be supported (MANDATORY) are presented in the order found in the DV spec: Note: The drivers must recogonize and generate a reply to all the capability queries. All mandatory reply values are indicated. Any values not specified are optional. If you reply TRUE to any of the optional capabilities such as "uses palettes", please make sure the additional messages required to support such a capability are also provided. It is perfectly OK to reply FALSE to all the unspecified capabilities such as "can freeze" etc. It is expected that most device will definitely support the "can stretch" capability. capability items MCI_GETDEVCAPS can eject 0 can freeze can lock can play 1 can record 0 can reverse can save can stretch [input] can test 1 compound device 1 device type digitalvideo has audio 1 has still has video 1 maximum play rate minimum play rate uses files 1 uses palettes windows capture items MCI_CAPTURE as file createvideodc items MCI_CREATEDC at rect copy items MCI_COPY close MCI_CLOSE configure MCI_CONFIGURE cue items MCI_CUE to position noshow freeze MCI_FREEZE info items MCI_INFO video streams video bitrate video maxbitrate audio streams audio bitrate audio samplerate file product version window text open items MCI_OPEN alias alias parent hwnd shareable style StyleValue type MpegVideo pause MCI_PAUSE play items MCI_PLAY from position to position repeat put items MCI_PUT at rect destination window window client releasevideodc hdc hDC MCI_RELEASEDC resume MCI_RESUME seek items MCI_SEEK offset bytes to position to end to start set items MCI_SET // no setting allowed for speed factor - it depends on clip time format format frames and milliseconds setaudio items MCI_SETAUDIO off on stream to number setvideo items MCI_SETVIDEO off on stream to number signal items MCI_SIGNAL at position cancel every interval return position uservalue id status items MCI_STATUS audio audio stream length mode nominal frame rate position ready speed start position time format video video brush video stream window handle window visible window maximized window minimized step items MCI_STEP by frames key stop MCI_STOP update items MCI_UPDATE at rect hdc hdc paint updatevideodc hdc hDC MCI_UPDATEDC unfreeze MCI_UNFREEZE where items MCI_WHERE destination destination max video video max video min window window max window items MCI_WINDOW handle hwnd handle default state ShowValue text caption State transition Model for the Driver The State transition model for the driver is as follows: Notes on the New Calls where items MCI_WHERE video min Minimum resolution video that can be played back. e.g. 160x120 info items MCI_INFO video streams Number of video streams in the System stream. Zero if System stream contains no video stream. video bitrate Bitrate of the video stream that is the current stream. video maxbitrate Maximum Video Bitrate accepted by the device e.g. 1295000 bits/sec audio streams Number of audio stream in the System stream. Zero if System stream contain no audio stream. audio bitrate Bitrate of the audio stream that is the current stream. e.g 192000 audio samplerate Sample Rate for the audio stream being played back e.g. 48 or 44 or 32 standing for 48Khz, 44.1Khz and 32Khz respectively. status items MCI_STATUS video brush Returns a windows brush (HBRUSH) to be used by the application to indicate areas where Video should be displayed. Any areas without the HBRUSH color, will then contain the graphics data that was painted into them. It was recommended that a HBRUSH be used instead of "status video key color" or "status video key index" so that the driver could then use the color privately, and the application would be isolated from it. This HBRUSH would be used to paint areas of the VideoDC. The VideoDC acts as a combination graphics rendering surface and control surface in one. Some of these calls look like the "update" command functionality. createvideodc items MCI_CREATEDC at rect The following call creates a DC, on which the application can draw the sprite to be displayed. The application uses the HBRUSH returned from the "status video brush" command to paint areas where Video will be display. If the items "at rect" is specified, the VideoDC is created of the size "rect". rect is defined to have its origin at the top left of the Video buffer. If rect is not specified, the VideoDC has the same dimensions as the Video Window. A rect of dimensions 10, 20, 160, 120, will create a VideoDC corresponding to the sub-rectangle of the Video Window corresponding to the pixel offset 10, and the line offset 20 (from the top left corner) and extending to pixel 160 and line 120. updatevideodc hdc hDC MCI_UPDATEDC Once the sprite/text was rendered into the VideoDC by the application, this call would cause the contents of the VideoDC to be updated onto the screen into the Video Window. Areas of the VideoDC containing the HBRUSH color would display Video, and the rest would display whatever was contained in the VideoDC. releasevideodc hdc hDC MCI_RELEASEDC Release the VideoDC obtained by the application using CreateVidoeDC. step items MCI_STEP key The added item "key", was desired for the step command. This would be a modifier to the basic step, such that the quantum of the step was measured in "key frames", in the case of MPEG, it would be I frames. e.g. "step key" would indicate step forward by one key frame, since the default step size is one. "step by 10 key", would indicate a forward step by 10 I frames. seek items MCI_SEEK offset bytes This added item to the seek command, would seek to a position bytes offset from the beginning of the file - an absolute byte position at which to begin decoding. It is the applications responsibility to make sure that this is a place in the MPEG bitstream that the device can start decoding from. Unfortunately - this is going to be device specific. MCI Mpeg Command Set Specification Multimedia Data Standards Update Revision 0.99 - 5103 of 10-