1 {
2     Copyright (c) 1991, 1992 by International Business Machines Corporation
3     Copyright (c) 2002 by Andry Svirgunov (cool2@ngs.ru)
4     Copyright (c) 2002-2003 by Yuri Prokushev (prokushev@freemail.ru)
5 
6     MCI drivers interface
7 
8     This program is free software; you can redistribute it and/or modify it
9     under the terms of the GNU Library General Public License (LGPL) as
10     published by the Free Software Foundation; either version 2 of the
11     License, or (at your option) any later version. This program is
12     distributed in the hope that it will be useful, but WITHOUT ANY
13     WARRANTY; without even the implied warranty of MERCHANTABILITY or
14     FITNESS FOR A PARTICULAR PURPOSE.
15 
16     See the GNU Library General Public License for more details. You should
17     have received a copy of the GNU Library General Public License along
18     with this program; if not, write to the Free Software Foundation, Inc.,
19     51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA.
20 
21  **********************************************************************}
22 
23 {
24 @abstract(MCI drivers interface)
25 @author(Andry Svirgunov (cool2@ngs.ru))
26 @author(Yuri Prokushev (prokushev@freemail.ru))
27 @created(01 Oct 2002)
28 @lastmod(19 Jan 2003)
29 MCI drivers interface
30 Warning: This code is alfa. Future versions of this unit will propably
31 not be compatible.
32 }
33 Unit mcidrv;
34 
35 Interface
36 
37 Type
38   GID=Integer;
39 
40 ///**************************************************************************/
41 //             MCI Driver  message identifiers                              */
42 ///**************************************************************************/
43 const
44   MCIDRV_SAVE                   = 900;
45   MCIDRV_RESTORE                = 901;
46   MCIDRV_SYNC                   = 902;
47   MCIDRV_CHANGERESOURCE         = 903;
48   MCIDRV_CONNECT                = 904;
49   MCIDRV_ASSOCIATE              = 905;
50   MCIDRV_DISCONNECT             = 906;
51   MCIDRV_TEST_CONNECTION        = 907;
52   MCIDRV_START                  = 908;
53   MCIDRV_SEEK                   = 909;
54   MCIDRV_STOP                   = 910;
55   MCIDRV_MODIFY_CONNECTION      = 911;
56   MCIDRV_INIT_CONNECTION        = 912;
57   MCIDRV_DEINIT_CONNECTION      = 913;
58   MCIDRV_ENABLE_EVENT           = 915;
59   MCIDRV_GETTIME                = 917;
60 
61 ///*******************************************************************/
62 // The following messages are used by the MCIDRV_CONNECT message     */
63 ///*******************************************************************/
64 
65   MCIDRV_CONNECT_TARGET         = $00010000;
66   MCIDRV_CONNECT_SOURCE         = $00020000;
67   MCIDRV_SET_CONNNECTOR_TYPE    = $00040000;
68   MCIDRV_CHANGE_SEM             = $00080000;
69 
70 ///*******************************************************************/
71 // The following messages are used by MCIDRV_MODIFY_CONNECTION       */
72 ///*******************************************************************/
73 
74 
75   MCIDRV_MODIFY_10              =$00100000;  // back level MCI driver.
76   MCIDRV_MIX_STANDALONE         =$00200000;
77 
78 
79 ///*******************************************************************/
80 // The following messages are used by MCIDRV_START                   */
81 ///*******************************************************************/
82 
83   MCIDRV_CUE_PLAYBACK           = $00010000;
84   MCIDRV_CUE_RECORD             = $00020000;
85   MCIDRV_START_PLAYBACK         = $00040000;
86   MCIDRV_START_RECORD           = $00080000;
87   MCIDRV_START_PREROLL          = $00100000;
88 
89 ///*******************************************************************/
90 // The following messages are used by MCIDRV_ASSOCIATE               */
91 ///*******************************************************************/
92 
93   MCIDRV_OUTPUT                 = $00010000;
94   MCIDRV_INPUT                  = $00020000;
95 
96 ///*******************************************************************/
97 // The following messages are used by MCIDRV_STOP                    */
98 ///*******************************************************************/
99 
100   MCIDRV_PAUSE_STREAM_NETWORK   = $00010000;
101   MCIDRV_FLUSH_STREAM_NETWORK   = $00020000;
102   MCIDRV_DISCARD_STREAM_NETWORK = $00040000;
103 
104 ///*******************************************************************/
105 // The following messages are used by MCIDRV_DEINIT_CONNECTION       */
106 ///*******************************************************************/
107 
108   MCIDRV_MODIFY_HANDLER         =$00010000;
109 
110 
111 
112 ///*******************************************************************/
113 // The following range of message ID's are reserved for internal use */
114 //  by MCI drivers                                                   */
115 ///*******************************************************************/
116   MCI_INTERNAL_MESSAGES_START   = 1000;
117   MCI_INTERNAL_MESSAGES_END     = 1999;
118 
119 ///*******************************************************************/
120 // Flags used by the string parser for command tables                */
121 // NOTE: All flags must have an "L" suffix in order to be parsed as  */
122 // DWORDs by the resource compiler                                   */
123 ///*******************************************************************/
124   MCI_COMMAND_HEAD              = $00000001;
125   MCI_END_COMMAND               = $00000002;
126   MCI_END_COMMAND_LIST          = $00000003;
127   MCI_RETURN                    = $00000004;
128   MCI_STRING                    = $00000005;
129   MCI_FLAG                      = $00000006;
130   MCI_INTEGER                   = $00000007;
131   MCI_CONSTANT                  = $00000008;
132   MCI_CONSTANT_INTEGER          = $00000009;
133   MCI_CONSTANT_STRING           = $0000000A;
134   MCI_END_CONSTANT              = $0000000B;
135   MCI_DEFAULT_STRING            = $0000000C;
136   MCI_DEFAULT_INTEGER           = $0000000D;
137   MCI_RETURN_TYPE               = $0000000E;
138   MCI_RETURN_TYPE_STRING        = $0000000F;
139   MCI_END_RETURN_TYPE           = $00000010;
140   MCI_CONSTANT_2                = $00000011;
141   MCI_END_CONSTANT_2            = $00000012;
142   MCI_CONSTANT_PAIR             = $00000013;
143   MCI_END_CONSTANT_PAIR         = $00000014;
144   MCI_CONSTANT_INTEGER_PAIR     = $00000015;
145   MCI_CONSTANT_STRING_PAIR      = $00000016;
146   MCI_RECTL                     = $00000017;
147   MCI_CONSTANT_4                = $00000018;
148   MCI_END_CONSTANT_4            = $00000019;
149   MCI_FOURCC                    = $0000001A;
150   MCI_OR                        = $0000001B;
151   MCI_END_OR                    = $0000001C;
152   MCI_STRING_LIST               = $0000001D;
153 
154 ///*******************************************************************/
155 // Return types supported by mciSendString                           */
156 //   Values 0x0000 -> 0xFF00  are reserved by MMPM2                  */
157 //   Values 0xFF01 -> 0xFFFF  are user definable                     */
158 ///*******************************************************************/
159   MCI_INTEGER_RETURNED          = $1000;
160   MCI_COLONIZED2_RETURN         = $2000;
161   MCI_COLONIZED3_RETURN         = $3000;
162   MCI_COLONIZED4_RETURN         = $4000;
163   MCI_TRUE_FALSE_RETURN         = $5000;
164   MCI_ON_OFF_RETURN             = $6000;
165   MCI_DEVICENAME_RETURN         = $7000;
166   MCI_TIME_FORMAT_RETURN        = $8000;
167   MCI_SPEED_FORMAT_RETURN       = $9000;
168   MCI_MODE_RETURN               = $A000;
169   MCI_MEDIA_TYPE_RETURN         = $B000;
170   MCI_TRACK_TYPE_RETURN         = $C000;
171   MCI_CONNECTOR_TYPE_RETURN     = $D000;
172   MCI_CDXA_CHANNEL_DESTINATION_RETURN = $E000;
173   MCI_PREROLL_TYPE_RETURN       = $F000;
174   MCI_FORMAT_TAG_RETURN         = $F100;
175   MCI_SEQ_SYNCHRONIZATION_RETURN = $F200;
176   MCI_VIDEO_QUALITY_RETURN      = $F300;
177   MCI_AUDIO_QUALITY_RETURN      = $F400;
178   MCI_IMAGE_QUALITY_RETURN      = $F500;
179   MCI_VIDEO_COMPRESSION_RETURN  = $F600;
180   MCI_AUDIO_COMPRESSION_RETURN  = $F700;
181   MCI_IMAGE_COMPRESSION_RETURN  = $F800;
182   MCI_RECTL_RETURN              = $F900;
183   MCI_FOURCC_RETURN             = $FA00;
184   MCI_IMAGE_PELFORMAT_RETURN    = $FB00;
185   MCI_DIRECTION_RETURN          = $FC00;
186   MCI_SIGNED_INTEGER_RETURN     = $FD00;
187 
188   MCI_USER_RETURN               = $FF01;
189 ///*******************************************************************/
190 // End of msg text used by mciGetErrorString                         */
191 ///*******************************************************************/
192   MCIERR_BASE                       = 5000;
193   MCIERR_MSG_TABLE_END          = MCIERR_BASE + 7000;
194 
195 ///*******************************************************************/
196 //                                                                   */
197 //  MCI DEVICE shareability categories                               */
198 //                                                                   */
199 ///*******************************************************************/
200   FIXEDSINGLECONTEXT            = $0001;
201   DYNAMICSINGLECONTEXT          = $0002;
202   LIMITEDMULTIPLECONTEXT        = $0003;
203   UNLIMITEDMULTIPLECONTEXT      = $0004;
204 
205 ///*******************************************************************/
206 // MCI driver flag for close during exit list processing             */
207 ///*******************************************************************/
208   MCI_CLOSE_EXIT                = $10000000;
209 
210 ///*******************************************************************/
211 // MCI driver specific error table resource number base              */
212 ///*******************************************************************/
213   MMERROR_TABLE_BASE            = 500;
214 
215 ///*******************************************************************/
216 //                                                                   */
217 //  MCIDRV_CHANGERESOURCE  message flags                             */
218 //                                                                   */
219 ///*******************************************************************/
220 
221 Type
222   mciDrv_ChangeResource_Parms = record
223     pInstance                   : Pointer;     // pointer to device instance
224     usResourceUnits             : Integer;      // required resource units
225     usResourceClass             : Integer;      // resource class
226     usResourcePriority          : Integer;      // resource priority
227   end;
228   pmciDrv_ChangeResource_Parms = ^mciDrv_ChangeResource_Parms;
229 
230 ///*******************************************************************/
231 //                                                                   */
232 //  MCIDRV_ENABLE_EVENT message flags                                */
233 //                                                                   */
234 ///*******************************************************************/
235 
236 Type
237   HSTREAM=LongInt;
238   hID=LongInt;
239   hEvent = LongInt;                // Event Handle
240   phEvent = ^hEvent;             // Pointer to Event Handle
241   HWND = LongInt;
242   MMTIME = LongInt;
243 Type
244   evcb = record
245     ulType       : LongInt;              // Event type (input)
246     ulSubType    : LongInt;              // Event SubType (input)
247     ulFlags      : LongInt;              // 0 (Input), status (Output)
248     hstream      : HSTREAM;            // handle to stream for this event
249     hid          : hID;                // handler Id (input/output)
250     ulStatus     : LongInt;              // Event status (output)
251     ulEventParm1 : LongInt;              // Event parameters (input), hID if implicit event
252     ulEventParm2 : LongInt;              // Event parameters (input)
253     ulEventParm3 : LongInt;              // Event parameters (input)
254   end;
255   pevcb = ^evcb;
256 
257 Type
258   MCIDRV_EVENT_PARMS = record
259     ulLength:LongInt;   // Length of event parms                     */
260     pevcb:PEVCB;      // pointer to event control block            */
261     phevent:PHEVENT;    // pointer to the event to enable in network */
262   end;
263   PMCIDRV_EVENT_PARMS=^MCIDRV_EVENT_PARMS;
264 
265 ///*******************************************************************/
266 //                                                                   */
267 //  MCIDRV_SYNC  message flags                                       */
268 //                                                                   */
269 ///*******************************************************************/
270 Const
271   MCIDRV_SYNC_ENABLE            = $00000100;
272   MCIDRV_SYNC_DISABLE           = $00000200;
273   MCIDRV_SYNC_REC_PULSE         = $00000400;
274   MCIDRV_SYNC_MASTER            = $00000800;
275   MCIDRV_SYNC_SET_MASTER        = $00001000;
276 
277 Type
278   sync_evcb = record
279     ulType       : LongInt;             // Event_SYNC
280     ulSubType    : LongInt;             // Not used
281     ulSyncFlags  : LongInt;             // 0 (input),status (output)
282     hstream      : HStream;           // handle to stream for this event
283     hid          : hID;               // Handler id
284     ulStatus     : LongInt;             // Event status (output)
285     mmtimeStart  : mmTime;            // Filled in by Sync/Stream manager
286                                       //  at SpiEnableSync time. (input)
287     mmtimeMaster : mmTime;            // Filled in by Master SH (input)
288     mmtimeSlave  : mmTime;            // Filled in by slave SH. (output)
289   end;
290   pSync_evcb = ^sync_Evcb;
291 
292 Type
293   mciDrv_Sync_Parms = record
294     hStreams                    : ^hStream;    // Pointer to list of stream IDs
295     ulNumStreams                : LongInt;       // number of stream IDs
296     mmTime                      : mmTime;      // Sync Pulse Time
297     NonStreamMaster             : Boolean;        // TRUE if this device can be master
298     pevcbSyncPulse              : pSync_evcb;  // pointer to EVCB address (output)
299     hidMaster                   : hID;         // Master NULL sh ID (valid only on
300                                                //    MCIDRV_SYNC_MASTER
301     ulReserved1                 : LongInt;       // Reserved field
302     ulReserved2                 : LongInt;       // Reserved field
303   end;
304   pmciDrv_Sync_Parms = ^mciDrv_Sync_Parms;
305 
306 
307 //*******************************************************************/
308 // contains information for open message for MCI drivers            */
309 //*******************************************************************/
310 Type
311   mmDrv_Open_Parms = record
312     hwndCallback                : hwnd;        // call back handle
313     usDeviceID                  : Integer;      // The device ID assigned to this instance
314     usDeviceType                : Integer;      // The device type number
315     usDeviceOrd                 : Integer;      // The device ordinal number
316     pInstance                   : Pointer;     //  pointer to the instance structure allocated
317                                                //  initialized by the driver. The MCI driver
318                                                // will fill in this parameter.
319     szDevDLLName : Array[0..259] of Char;      // Character string containing the device
320                                                // specific DLL name to call for the open.
321                                                // (ie. ACPA.DLL)
322     pszElementName              : pChar;       //   typically a file name or NULL
323     usDevParmLen                : Integer;      // Device parameters data block length.
324     pDevParm                    : Pointer;     // Device parameters data block. This data
325                                                // block is unique to each type of device.
326                                                // (ie. LVD "COM1 9600 N 7 1").
327     Reserved0                   : Pointer;
328     usResourceUnitsRequired     : Integer;      // number of resource units this instance
329                                                // requires.
330     usResourceClass             : Integer;      // resource class this instance belongs to
331     usResourcePriority          : Integer;      // resource priority for this instance
332     ulParam2                    : LongInt;       // Pointer to MCI_OPEN structure
333   end;
334   pmmDrv_Open_Parms = ^mmDrv_Open_Parms;
335 
336 
337 ///*******************************************************************/
338 //                                                                   */
339 //  MCIDRV_RESTORE message flags                                     */
340 //                                                                   */
341 ///*******************************************************************/
342 
343 Type
344   MCIDRV_RESTORE_PARMS = record
345     ulLength:longint;        // Length of restore parms               */
346     ulMasterVolume:longint;  // Master volume value                   */
347   end;
348   PMCIDRV_RESTORE_PARMS=^MCIDRV_RESTORE_PARMS;
349 
350 function mdmDriverNotify( usDeviceID: Integer; wnd: Hwnd; usMsgType: Integer;
351                           usUserParm: Integer; ulMsgParm: LongInt): LongInt; cdecl;
352 
353 Implementation
354 
355 function mdmDriverNotify( usDeviceID: Integer; wnd: Hwnd; usMsgType: Integer;
356                           usUserParm: Integer; ulMsgParm: LongInt): LongInt; cdecl; external 'MDM' index 17;
357 
358 End.
359