1 /*
2 	File:		iTunesAPI.h
3 
4 	Copyright: 	� Copyright 2003 Apple Computer, Inc. All rights reserved.
5 
6 	Disclaimer:	IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc.
7 				("Apple") in consideration of your agreement to the following terms, and your
8 				use, installation, modification or redistribution of this Apple software
9 				constitutes acceptance of these terms.  If you do not agree with these terms,
10 				please do not use, install, modify or redistribute this Apple software.
11 
12 				In consideration of your agreement to abide by the following terms, and subject
13 				to these terms, Apple grants you a personal, non-exclusive license, under Apple�s
14 				copyrights in this original Apple software (the "Apple Software"), to use,
15 				reproduce, modify and redistribute the Apple Software, with or without
16 				modifications, in source and/or binary forms; provided that if you redistribute
17 				the Apple Software in its entirety and without modifications, you must retain
18 				this notice and the following text and disclaimers in all such redistributions of
19 				the Apple Software.  Neither the name, trademarks, service marks or logos of
20 				Apple Computer, Inc. may be used to endorse or promote products derived from the
21 				Apple Software without specific prior written permission from Apple.  Except as
22 				expressly stated in this notice, no other rights or licenses, express or implied,
23 				are granted by Apple herein, including but not limited to any patent rights that
24 				may be infringed by your derivative works or by other works in which the Apple
25 				Software may be incorporated.
26 
27 				The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO
28 				WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
29 				WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 				PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
31 				COMBINATION WITH YOUR PRODUCTS.
32 
33 				IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
34 				CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
35 				GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 				ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
37 				OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
38 				(INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
39 				ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 
41 */
42 
43 #ifndef ITUNESAPI_H_
44 #define ITUNESAPI_H_
45 
46 #include <windows.h>
47 
48 #if PRAGMA_ONCE
49 #pragma once
50 #endif
51 
52 typedef unsigned long	UInt32;
53 typedef signed long		SInt32;
54 typedef unsigned short	UInt16;
55 typedef signed short	SInt16;
56 typedef	unsigned char	UInt8;
57 typedef signed char		SInt8;
58 
59 typedef UInt8			Str255[256];
60 typedef UInt8			Str63[64];
61 typedef const UInt8 *	ConstStringPtr;
62 typedef UInt32			OptionBits;
63 typedef UInt32			OSType;
64 
65 typedef SInt32			OSStatus;
66 
67 typedef UInt16			EventKind;
68 
69 typedef UInt16          EventModifiers;
70 
71 typedef UInt16			UniChar;
72 
73 typedef unsigned __int64 UInt64;
74 
75 typedef void **			Handle;
76 
77 struct NumVersion {
78 	UInt8			majorRev;
79 	UInt8			minorAndBugRev;
80 	UInt8			stage;
81 	UInt8			nonRelRev;
82 };
83 typedef struct NumVersion NumVersion;
84 
85 struct Point {
86     short                           v;
87     short                           h;
88 };
89 typedef struct Point                    Point;
90 
91 struct EventRecord {
92     EventKind                       what;
93     UInt32                          message;
94     UInt32                          when;
95     Point                           where;
96     EventModifiers                  modifiers;
97 };
98 typedef struct EventRecord EventRecord;
99 
100 typedef UInt8			Boolean;
101 
102 typedef UInt32			UnsignedFixed;
103 
104 typedef void *			LogicalAddress;
105 
106 #define	false			0
107 #define	true			1
108 #define	nil				NULL
109 
110 enum {
111 	noErr		= 0,
112 	paramErr	= -50,
113 	memFullErr	= -108,
114 	unimpErr	= -4
115 };
116 
117 struct Rect {
118 	short			top;
119 	short			left;
120 	short			bottom;
121 	short			right;
122 };
123 typedef struct Rect Rect;
124 
125 struct SoundComponentData {
126 	long			flags;
127 	OSType			format;
128 	short			numChannels;
129 	short			sampleSize;
130 	UnsignedFixed	sampleRate;
131 	long			sampleCount;
132 	UInt8 *			buffer;
133 	long			reserved;
134 };
135 typedef struct SoundComponentData SoundComponentData;
136 
137 #define	VOLUME_REFERENCE		SInt16
138 
139 #ifdef __cplusplus
140 extern "C" {
141 #endif
142 
143 #if PRAGMA_STRUCT_ALIGN
144     #pragma options align=power
145 #elif PRAGMA_STRUCT_PACKPUSH
146     #pragma pack(push, 4)
147 #elif PRAGMA_STRUCT_PACK
148     #pragma pack(4)
149 #endif
150 
151 
152 enum {
153 	kITPluginMajorMessageVersion = 10,
154 	kITPluginMinorMessageVersion = 5
155 };
156 
157 enum {
158 	kTrackSupportsID3Tags		= (1L << 0),
159 	kTrackHasVariableBitRate	= (1L << 1),
160 	kTrackIsLocked				= (1L << 3),		/* Device tracks only. Track cannot be deleted or renamed */
161 	kTrackCanBeDownloaded		= (1L << 4),		/* Device tracks only. Track can be copied from device to desktop. */
162 	kTrackIsHidden				= (1L << 5)			/* Device tracks only. Track should not be displayed in the device window. */
163 };
164 typedef OptionBits	ITTrackAttributes;
165 
166 enum {
167 	/*
168 		These mask values are specified in ITTrackInfo.validFields
169 		to indicate which fields contain valid data
170 	*/
171 
172 	kITTIFieldInvalid				= 0,
173 	kITTINameFieldMask				= (1L << 0),
174 	kITTIFileNameFieldMask			= (1L << 1),
175 	kITTIArtistFieldMask			= (1L << 2),
176 	kITTIAlbumFieldMask				= (1L << 3),
177 	kITTIGenreFieldMask				= (1L << 4),
178 	kITTIKindFieldMask				= (1L << 5),
179 	kITTITrackNumberFieldsMask		= (1L << 6),
180 	kITTIYearFieldMask				= (1L << 7),
181 	kITTISoundVolumeFieldMask		= (1L << 8),
182 	kITTIEQPresetFieldMask			= (1L << 9),
183 	kITTICommentsFieldMask			= (1L << 10),
184 	kITTITotalTimeFieldMask			= (1L << 11),
185 	kITTIStartTimeFieldMask			= (1L << 12),
186 	kITTIStopTimeFieldMask			= (1L << 13),
187 	kITTISizeFieldMask				= (1L << 14),
188 	kITTIBitRateFieldMask			= (1L << 15),
189 	kITTISampleRateFieldMask		= (1L << 16),
190 	kITTIAttributesFieldMask		= (1L << 17),
191 	kITTIFileTypeFieldMask			= (1L << 18),
192 	kITTIDateFieldMask				= (1L << 19),
193 	kITTIFileCreatorFieldMask		= (1L << 20),
194 	kITTIComposerFieldMask			= (1L << 21),	/* Added in iTunes 3.0 */
195 	kITTICompilationFieldMask		= (1L << 22),	/* Added in iTunes 3.0 */
196 	kITTIDiscNumberFieldsMask		= (1L << 23),	/* Added in iTunes 3.0 */
197 	kITTIUserRatingFieldMask		= (1L << 24),	/* Added in iTunes 3.0 */
198 	kITTIPlayCountFieldMask 		= (1L << 25),	/* Added in iTunes 3.0 */
199 	kITTILastPlayDateFieldMask		= (1L << 26),	/* Added in iTunes 3.0 */
200 	kITTIBeatsPerMinuteFieldMask	= (1L << 27)	/* Added in iTunes 4.0 */
201 };
202 typedef OptionBits	ITTIFieldMask;
203 
204 enum
205 {
206 	kITTIUserModifiableFieldsMask = kITTINameFieldMask | kITTIArtistFieldMask | kITTIAlbumFieldMask | kITTIGenreFieldMask |
207 										kITTITrackNumberFieldsMask | kITTIYearFieldMask | kITTISoundVolumeFieldMask | kITTIEQPresetFieldMask |
208 										kITTICommentsFieldMask | kITTIStartTimeFieldMask | kITTIStopTimeFieldMask | kITTIComposerFieldMask |
209 										kITTICompilationFieldMask | kITTIDiscNumberFieldsMask | kITTIUserRatingFieldMask | kITTIBeatsPerMinuteFieldMask
210 };
211 
212 typedef UInt32	ITDeviceID;
213 typedef UInt32	ITDeviceMediaID;
214 typedef UInt32	ITDeviceTrackID;
215 typedef UInt32	ITDevicePlaylistID;
216 typedef UInt32	ITDevicePlaylistFolderID;
217 typedef UInt32	ITDevicePlaylistItemID;
218 
219 typedef UniChar 		ITUniStr255[256];				/* Similar to Str255. First element is length of string in characters. */
220 typedef UniChar *		ITUniStringPtr;
221 typedef const UniChar *	ConstITUniStringPtr;
222 
223 #define	kITFileSpecMaxPathLength	(MAX_PATH - 1)
224 
225 typedef struct ITFileSpec
226 {
227 	UInt16	length;		// Length in characters
228 	UniChar	fullPath[kITFileSpecMaxPathLength];
229 } ITFileSpec;
230 
231 struct ITTrackInfo {
232 	ITTIFieldMask		validFields;
233 	UInt32				recordLength;					/* Size of this structure in bytes */
234 
235 	ITUniStr255			name;
236 	ITUniStr255			fileName;
237 	ITUniStr255			artist;
238 	ITUniStr255			album;
239 	ITUniStr255			genre;
240 	ITUniStr255			kind;
241 	ITUniStr255			eqPresetName;
242 	ITUniStr255			comments;
243 
244 	UInt32				trackNumber;
245 	UInt32				numTracks;
246 
247 	UInt16				year;
248 	SInt16				soundVolumeAdjustment;			/* Valid range is -255 to +255 */
249 
250 	UInt32				totalTimeInMS;
251 	UInt32				startTimeInMS;
252 	UInt32				stopTimeInMS;
253 
254 	UInt32				date;
255 	UInt32				sizeInBytes;
256 
257 	UInt32				bitRate;
258 	UInt32				sampleRateFixed;
259 
260 	OSType				fileType;
261 	OSType				fileCreator;
262 
263 	ITTrackAttributes	attributes;
264 	ITTrackAttributes	validAttributes;				/* Mask indicating which attributes are applicable */
265 
266 	ITUniStr255			composer;						/* Added in iTunes 3.0 */
267 
268 	Boolean				isCompilationTrack;				/* Added in iTunes 3.0 */
269 	Boolean				reservedBoolean;				/* Reserved. Must be zero. */
270 
271 	UInt16				userRating;						/* Added in iTunes 3.0. 0 = unrated, valid values are 20, 40, 60, 80 and 100. */
272 
273 	UInt16				discNumber;						/* Added in iTunes 3.0 */
274 	UInt16				numDiscs;						/* Added in iTunes 3.0 */
275 
276 	UInt32				playCount;						/* Added in iTunes 3.0 */
277 	UInt32				lastPlayDate;					/* Added in iTunes 3.0 */
278 
279 	UInt16				beatsPerMinute;					/* Added in iTunes 4.0 */
280 	UInt16				reserved;						/* Reserved. Must be zero. */
281 };
282 typedef struct ITTrackInfo ITTrackInfo;
283 
284 struct ITStreamInfo {
285 	SInt32				version;
286 	ITUniStr255			streamTitle;
287 	ITUniStr255			streamURL;
288 	ITUniStr255			streamMessage;
289 };
290 typedef struct ITStreamInfo ITStreamInfo;
291 
292 enum {
293 	/* messages sent to plugin main */
294 
295 	kPluginInitMessage					= 'init',
296 	kPluginCleanupMessage				= 'clr ',
297 	kPluginPrepareToQuitMessage			= 'prqt',
298 
299 	kPluginIdleMessage					= 'idle',
300 	kPluginVolumeMountedMessage			= 'vmnt',
301 	kPluginVolumeUnmountedMessage		= 'vunm',
302 	kPluginVolumeRenamedMessage			= 'vnam'
303 };
304 
305 
306 enum {
307 	/* PluginInitMessage.options */
308 
309 	kPluginWantsIdleMessages	= (1L << 1),	/* Send idle messages to plugin main */
310 	kPluginWantsToBeLeftOpen	= (1L << 2),	/* Don't close this plugin just because it didn't register anyone */
311 	kPluginWantsVolumeMessages	= (1L << 3)		/* The plugin wants to be notified when volumes are mounted/unmounted/renamed */
312 };
313 
314 
315 enum {
316 	/* iTunes API messages */
317 
318 	kPlayerRegisterVisualPluginMessage	= 'rvis',	/* Register a visual plugin */
319 	kPlayerRegisterDevicePluginMessage	= 'rdev',	/* Register a device plugin */
320 
321 	/* Available for all plugins */
322 
323 	kPlayerUnregisterPluginMessage		= 'unrg',	/* Unregister the plugin this comes from */
324 	kPlayerIdleMessage					= 'idle',	/* Give iTunes some time */
325 
326 	kPlayerShowAboutMessage				= 'abou',	/* Show the about box. */
327 	kPlayerOpenURLMessage				= 'url ',	/* Open a URL */
328 
329 	kPlayerSetPluginDataMessage			= 'sprf',	/* Set plugin preferences */
330 	kPlayerGetPluginDataMessage			= 'gprf',	/* Get plugin preferences */
331 
332 	kPlayerSetPluginNamedDataMessage	= 'snpr',	/* Set plugin named preferenes */
333 	kPlayerGetPluginNamedDataMessage	= 'gnpr',	/* Get plugin named preferenes */
334 
335 	kPlayerGetFileTrackInfoMessage		= 'gfti',	/* Query iTunes for information about a file */
336 	kPlayerSetFileTrackInfoMessage		= 'sfti',	/* Ask iTunes to set information about a file */
337 
338 	kPlayerGetITTrackInfoSizeMessage	= 'itsz',	/* Query iTunes for the sizeof(ITTrackInfo). This allows newer plugins to correctly workd with older versions of iTunes. */
339 
340 	kPlayerHandleMacOSEventMessage		= 'evnt',	/* Tell player to handle unhandled event */
341 	kPlayerGetPluginITFileSpecMessage	= 'itfs',	/* Get the location of the plugin executable (iTunes 4.1 or later) */
342 
343 	/* Available for visual plugins */
344 
345 	kPlayerSetFullScreenMessage			= 'sful',	/* Set full screen mode */
346 	kPlayerSetFullScreenOptionsMessage	= 'sfop',	/* Set full screen options */
347 	kPlayerGetCurrentTrackCoverArtMessage = 'covr',	/* Get current player track cover artwork */
348 
349 	/* Available for device plugins */
350 
351 	kPlayerSetDeviceSerialNumberMessage = 'dvsn',	/* Set a serial number string for a device. Needed for per-device prefs */
352 	kPlayerRefreshDeviceMediaMessage	= 'refm',	/* Tell iTunes to refresh (enumerate) the contents of a single media module on a device */
353 	kPlayerRefreshAllDeviceMediaMessage = 'refa'	/* Tell iTunes to refresh (enumerate) the contents of all media modules on a device */
354 };
355 
356 struct PlayerMessageInfo;
357 
358 typedef OSStatus (*ITAppProcPtr)(void *appCookie, OSType message, struct PlayerMessageInfo *messageInfo);
359 
360 
361 /*
362 	Plugin main Messages
363 */
364 
365 struct PluginInitMessage {
366 	UInt32							majorVersion;			/* Input */
367 	UInt32							minorVersion;			/* Input */
368 
369 	void *							appCookie;				/* Input */
370 	ITAppProcPtr					appProc;				/* Input */
371 
372 	OptionBits						options;				/* Output, see above for values */
373 	void *							refCon;					/* Output */
374 };
375 typedef struct PluginInitMessage PluginInitMessage;
376 
377 struct PluginVolumeMountedMessage {
378 	VOLUME_REFERENCE				vRefNum;				/* Input */
379 	UInt32							volumeID;				/* Input */
380 	ConstITUniStringPtr				volumeName;				/* Input */
381 };
382 typedef struct PluginVolumeMountedMessage PluginVolumeMountedMessage;
383 
384 struct PluginVolumeUnmountedMessage {
385 	UInt32							volumeID;				/* Input */
386 	ConstITUniStringPtr				volumeName;				/* Input */
387 };
388 typedef struct PluginVolumeUnmountedMessage PluginVolumeUnmountedMessage;
389 
390 struct PluginVolumeRenamedMessage {
391 	VOLUME_REFERENCE				vRefNum;				/* Input */
392 	UInt32							volumeID;				/* Input */
393 	ConstITUniStringPtr				newVolumeName;			/* Input */
394 };
395 typedef struct PluginVolumeRenamedMessage PluginVolumeRenamedMessage;
396 
397 struct PluginMessageInfo {
398 	union {
399 		PluginInitMessage				initMessage;
400 		PluginVolumeMountedMessage		volumeMountedMessage;
401 		PluginVolumeUnmountedMessage	volumeUnmountedMessage;
402 		PluginVolumeRenamedMessage		volumeRenamedMessage;
403 	} u;
404 };
405 typedef struct PluginMessageInfo PluginMessageInfo;
406 
407 struct VisualPluginMessageInfo;
408 struct DevicePluginMessageInfo;
409 
410 /* Plugin main entry point message handler */
411 typedef OSStatus (*PluginProcPtr)(OSType message, PluginMessageInfo *messageInfo, void *refCon);
412 
413 /* Visual plugin message handler */
414 typedef OSStatus (*VisualPluginProcPtr)(OSType message, struct VisualPluginMessageInfo *messageInfo, void *refCon);
415 
416 /* Device plugin message handler */
417 typedef OSStatus (*DevicePluginProcPtr)(OSType message, struct DevicePluginMessageInfo *messageInfo, void *refCon);
418 
419 
420 
421 /*
422 	Callbacks to iTunes
423 */
424 
425 enum {
426 	/* PlayerRegisterVisualPluginMessage.options */
427 
428 	kVisualWantsIdleMessages			= (1L << 3),
429 	kVisualWantsConfigure				= (1L << 5)
430 };
431 
432 struct PlayerRegisterVisualPluginMessage {
433 	/* Input from plugin */
434 
435 	Str63							name;						/* Displayed in the Visual menu */
436 	OptionBits						options;					/* See above */
437 
438 	OSType							creator;					/* Identifies the plugin */
439 
440 	NumVersion						pluginVersion;				/* Version number of the plugin */
441 
442 	VisualPluginProcPtr				handler;					/* Handler for the plugin's messages */
443 	void *							registerRefCon;				/* RefCon for the plugin's handler */
444 
445 	UInt32							timeBetweenDataInMS;		/* How often to call the plugin (0xFFFFFFFF = as often as possible) */
446 	UInt32							numWaveformChannels;		/* 0-2 waveforms requested */
447 	UInt32							numSpectrumChannels;		/* 0-2 spectrums requested */
448 
449 	SInt16							minWidth;					/* Minimum resizeable width */
450 	SInt16							minHeight;					/* Minimum resizeable height */
451 
452 	SInt16							maxWidth;					/* Maximum resizeable width */
453 	SInt16							maxHeight;					/* Maximum resizeable height */
454 
455 	UInt16							minFullScreenBitDepth;		/* 0 = Any */
456 	UInt16							maxFullScreenBitDepth;		/* 0 = Any */
457 
458 	UInt16							windowAlignmentInBytes;		/* Reserved (should be zero) */
459 };
460 typedef struct PlayerRegisterVisualPluginMessage PlayerRegisterVisualPluginMessage;
461 
462 enum {
463 	/* PlayerRegisterDevicePluginMessage.options */
464 
465 	kDeviceWantsIdleMessages = (1L << 0)
466 };
467 
468 struct PlayerRegisterDevicePluginMessage {
469 	/* Input from plugin */
470 
471 	Str63							name;						/* Used internally. Not currently displayed */
472 	OptionBits						options;					/* See above */
473 
474 	NumVersion						pluginVersion;				/* Version number of the plugin */
475 
476 	DevicePluginProcPtr				handler;					/* Handler for the plugin's messages */
477 	void *							registerRefCon;				/* RefCon for the plugin's handler */
478 
479 	UInt32							reserved[2];				/* Must be zero */
480 };
481 typedef struct PlayerRegisterDevicePluginMessage PlayerRegisterDevicePluginMessage;
482 
483 struct PlayerSetFullScreenMessage {
484 	Boolean							fullScreen;
485 };
486 typedef struct PlayerSetFullScreenMessage PlayerSetFullScreenMessage;
487 
488 struct PlayerSetFullScreenOptionsMessage {
489 	SInt16							minBitDepth;				/* 0 = Any */
490 	SInt16							maxBitDepth;				/* 0 = Any */
491 	SInt16							preferredBitDepth;			/* 0 = Current */
492 
493 	SInt16							desiredWidth;				/* Must be within minWidth & maxWidth */
494 	SInt16							desiredHeight;				/* Must be within minHeight & maxHeight */
495 };
496 typedef struct PlayerSetFullScreenOptionsMessage PlayerSetFullScreenOptionsMessage;
497 
498 struct PlayerGetCurrentTrackCoverArtMessage {
499 	Handle						coverArt;		/* output - client must dispose */
500 	OSType						coverArtFormat;	/* output - format of cover art */
501 };
502 typedef struct PlayerGetCurrentTrackCoverArtMessage PlayerGetCurrentTrackCoverArtMessage;
503 
504 struct PlayerOpenURLMessage {
505 	SInt8 *							url;
506 	UInt32							length;
507 };
508 typedef struct PlayerOpenURLMessage PlayerOpenURLMessage;
509 
510 struct PlayerSetPluginDataMessage {
511 	void *							dataPtr;		/* Input */
512 	UInt32							dataSize;		/* Input */
513 };
514 typedef struct PlayerSetPluginDataMessage PlayerSetPluginDataMessage;
515 
516 struct PlayerGetPluginDataMessage {
517 	void *							dataPtr;		/* Input */
518 	UInt32							dataBufferSize;	/* Input */
519 
520 	UInt32							dataSize;		/* Output */
521 };
522 typedef struct PlayerGetPluginDataMessage PlayerGetPluginDataMessage;
523 
524 struct PlayerSetPluginNamedDataMessage {
525 	ConstStringPtr					dataName;		/* Input */
526 
527 	void *							dataPtr;		/* Input */
528 	UInt32							dataSize;		/* Input */
529 };
530 typedef struct PlayerSetPluginNamedDataMessage PlayerSetPluginNamedDataMessage;
531 
532 struct PlayerGetPluginNamedDataMessage {
533 	ConstStringPtr					dataName;		/* Input */
534 
535 	void *							dataPtr;		/* Input */
536 	UInt32							dataBufferSize;	/* Input */
537 
538 	UInt32							dataSize;		/* Output */
539 };
540 typedef struct PlayerGetPluginNamedDataMessage PlayerGetPluginNamedDataMessage;
541 
542 struct PlayerHandleMacOSEventMessage {
543 	const EventRecord *				theEvent;		/* Input */
544 
545 	Boolean							handled;		/* Output */
546 };
547 typedef struct PlayerHandleMacOSEventMessage PlayerHandleMacOSEventMessage;
548 
549 struct PlayerGetPluginITFileSpecMessage {
550 	ITFileSpec *					fileSpec;		/* Output */
551 };
552 typedef struct PlayerGetPluginITFileSpecMessage PlayerGetPluginITFileSpecMessage;
553 
554 struct PlayerSetDeviceSerialNumberMessage {
555 	ConstStringPtr					serialNumber;	/* Input */
556 };
557 typedef struct PlayerSetDeviceSerialNumberMessage PlayerSetDeviceSerialNumberMessage;
558 
559 struct PlayerRefreshDeviceMediaMessage {
560 	ITDeviceMediaID					mediaID;		/* Input */
561 };
562 typedef struct PlayerRefreshDeviceMediaMessage PlayerRefreshDeviceMediaMessage;
563 
564 struct PlayerGetFileTrackInfoMessage {
565 	const ITFileSpec *				fileSpec;		/* Input */
566 	ITTrackInfo *					trackInfo;		/* Output */
567 };
568 typedef struct PlayerGetFileTrackInfoMessage PlayerGetFileTrackInfoMessage;
569 
570 struct PlayerSetFileTrackInfoMessage {
571 	const ITFileSpec *				fileSpec;		/* Input */
572 	const ITTrackInfo *				trackInfo;		/* Input */
573 };
574 typedef struct PlayerSetFileTrackInfoMessage PlayerSetFileTrackInfoMessage;
575 
576 struct PlayerGetITTrackInfoSizeMessage {
577 	UInt32							itTrackInfoSize;	/* Output */
578 };
579 typedef struct PlayerGetITTrackInfoSizeMessage PlayerGetITTrackInfoSizeMessage;
580 
581 struct PlayerMessageInfo {
582 	UInt32									messageMajorVersion;		/* Should be kITCurrentPluginMajorMessageVersion */
583 	UInt32									messageMinorVersion;		/* Should be kITCurrentPluginMinorMessageVersion */
584 	UInt32									messageInfoSize;			/* Should be sizeof(PlayerMessageInfo) */
585 
586 	union {
587 		PlayerRegisterVisualPluginMessage	registerVisualPluginMessage;
588 		PlayerRegisterDevicePluginMessage	registerDevicePluginMessage;
589 
590 		PlayerOpenURLMessage				openURLMessage;
591 
592 		PlayerSetPluginDataMessage			setPluginDataMessage;
593 		PlayerGetPluginDataMessage			getPluginDataMessage;
594 
595 		PlayerSetPluginNamedDataMessage		setPluginNamedDataMessage;
596 		PlayerGetPluginNamedDataMessage		getPluginNamedDataMessage;
597 
598 		PlayerSetFullScreenMessage				setFullScreenMessage;
599 		PlayerSetFullScreenOptionsMessage		setFullScreenOptionsMessage;
600 		PlayerGetCurrentTrackCoverArtMessage	getCurrentTrackCoverArtMessage;
601 
602 		PlayerSetDeviceSerialNumberMessage	setDeviceSerialNumberMessage;
603 		PlayerRefreshDeviceMediaMessage		refreshDeviceMediaMessage;
604 
605 		PlayerGetFileTrackInfoMessage		getFileTrackInfoMessage;
606 		PlayerSetFileTrackInfoMessage		setFileTrackInfoMessage;
607 		PlayerGetITTrackInfoSizeMessage		getITTrackInfoSizeMessage;
608 
609 		PlayerHandleMacOSEventMessage		handleMacOSEventMessage;
610 		PlayerGetPluginITFileSpecMessage	getPluginITFileSpecMessage;
611 	} u;
612 };
613 typedef struct PlayerMessageInfo PlayerMessageInfo;
614 
615 extern OSStatus ITCallApplication (void *appCookie, ITAppProcPtr appProc, OSType message, PlayerMessageInfo *messageInfo);
616 extern void		SetNumVersion (NumVersion *numVersion, UInt8 majorRev, UInt8 minorAndBugRev, UInt8 stage, UInt8 nonRelRev);
617 
618 
619 /* for use from plugin main */
620 
621 extern OSStatus PlayerRegisterVisualPlugin (void *appCookie, ITAppProcPtr appProc, PlayerMessageInfo *messageInfo);
622 
623 /* For all plugins */
624 
625 extern OSStatus	PlayerUnregisterPlugin (void *appCookie, ITAppProcPtr appProc, PlayerMessageInfo *messageInfo);
626 extern OSStatus PlayerIdle (void *appCookie, ITAppProcPtr appProc);
627 
628 extern void		PlayerShowAbout (void *appCookie, ITAppProcPtr appProc);
629 extern void		PlayerOpenURL (void *appCookie, ITAppProcPtr appProc, SInt8 *string, UInt32 length);
630 
631 extern OSStatus	PlayerGetPluginData (void *appCookie, ITAppProcPtr appProc, void *dataPtr, UInt32 dataBufferSize, UInt32 *dataSize);
632 extern OSStatus	PlayerSetPluginData (void *appCookie, ITAppProcPtr appProc, void *dataPtr, UInt32 dataSize);
633 
634 extern OSStatus	PlayerGetPluginNamedData (void *appCookie, ITAppProcPtr appProc, ConstStringPtr dataName, void *dataPtr, UInt32 dataBufferSize, UInt32 *dataSize);
635 extern OSStatus	PlayerSetPluginNamedData (void *appCookie, ITAppProcPtr appProc, ConstStringPtr dataName, void *dataPtr, UInt32 dataSize);
636 
637 extern OSStatus	PlayerGetFileTrackInfo (void *appCookie, ITAppProcPtr appProc, const ITFileSpec *fileSpec, ITTrackInfo *trackInfo);
638 extern OSStatus	PlayerSetFileTrackInfo (void *appCookie, ITAppProcPtr appProc, const ITFileSpec *fileSpec, const ITTrackInfo *trackInfo);
639 
640 extern OSStatus PlayerGetITTrackInfoSize (void *appCookie, ITAppProcPtr appProc, UInt32 appPluginMajorVersion, UInt32 appPluginMinorVersion, UInt32 *itTrackInfoSize);
641 
642 extern OSStatus PlayerHandleMacOSEvent (void *appCookie, ITAppProcPtr appProc, const EventRecord *theEvent, Boolean *eventHandled);
643 
644 extern OSStatus	PlayerGetPluginITFileSpec (void *appCookie, ITAppProcPtr appProc, ITFileSpec *pluginFileSpec);
645 
646 /* For visual plugins */
647 
648 extern OSStatus PlayerSetFullScreen (void *appCookie, ITAppProcPtr appProc, Boolean fullScreen);
649 extern OSStatus PlayerSetFullScreenOptions (void *appCookie, ITAppProcPtr appProc, SInt16 minBitDepth, SInt16 maxBitDepth, SInt16 preferredBitDepth, SInt16 desiredWidth, SInt16 desiredHeight);
650 extern OSStatus PlayerGetCurrentTrackCoverArt (void *appCookie, ITAppProcPtr appProc, Handle *coverArt, OSType *coverArtFormat);
651 
652 #if PRAGMA_STRUCT_ALIGN
653     #pragma options align=reset
654 #elif PRAGMA_STRUCT_PACKPUSH
655     #pragma pack(pop)
656 #elif PRAGMA_STRUCT_PACK
657     #pragma pack()
658 #endif
659 
660 #ifdef __cplusplus
661 }
662 #endif
663 
664 #endif /* ITUNESAPI_H_ */
665