1 //-----------------------------------------------------------------------------
2 //
3 // File:	QCDModDefs.h
4 //
5 // About:	Module definitions file.  Miscellanious definitions used by different
6 //			module types.  This file is published with the plugin SDKs.
7 //
8 // Authors:	Written by Paul Quinn and Richard Carlson.
9 //
10 // Copyright:
11 //
12 //	QCD multimedia player application Software Development Kit Release 1.0.
13 //
14 //	Copyright (C) 1997-2002 Quinnware
15 //
16 //	This code is free.  If you redistribute it in any form, leave this notice
17 //	here.
18 //
19 //	This program is distributed in the hope that it will be useful,
20 //	but WITHOUT ANY WARRANTY; without even the implied warranty of
21 //	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22 //
23 //-----------------------------------------------------------------------------
24 
25 #ifndef QCDMODDEFS_H
26 #define QCDMODDEFS_H
27 
28 #include <mmreg.h>
29 #include <windows.h>
30 
31 #ifdef __cplusplus
32 #define PLUGIN_API extern "C" __declspec(dllexport)
33 #else
34 #define PLUGIN_API __declspec(dllexport)
35 #endif
36 
37 // Current plugin version
38 
39 // use this version for old style API calls (all returned text in native encoding)
40 #define PLUGIN_API_VERSION				250
41 
42 // use this version for new style API calls (all returned text in UTF8 encoding on WinNT/2K/XP (native encoding on Win9x))
43 #define PLUGIN_API_VERSION_WANTUTF8		((PLUGIN_API_WANTUTF8<<16)|PLUGIN_API_VERSION)
44 #define PLUGIN_API_WANTUTF8				100
45 
46 //-----------------------------------------------------------------------------
47 
48 typedef struct
49 {
50 	char				*moduleString;
51 	char				*moduleExtensions;
52 } QCDModInfo;
53 
54 //-----------------------------------------------------------------------------
55 // Services (ops) provided by the Player
56 //-----------------------------------------------------------------------------
57 typedef enum
58 {									//*** below returns numeric info (*buffer not used)
59 
60 	opGetPlayerVersion = 0,			// high-order word = major version (eg 3.01 is 3), low-order word = minor (eg 3.01 = 1)
61 	opGetParentWnd = 1,				// handle to player window
62 	opGetPlayerInstance = 2,		// HINSTANCE to player executable
63 
64 	opGetPlayerState = 9,			// get current state of the player (returns: 1 = stopped, 2 = playing, 3 = paused, 0 = failed)
65 	opGetNumTracks = 10,			// number of tracks in playlist
66 	opGetCurrentIndex = 11,			// index of current track in playlist (0 based)
67 	opGetNextIndex = 12,			// get index of next track to play (0 based), param1 = index start index. -1 for after current
68 	opGetTrackNum = 13,				// get track number of index, param1 = index of track in playlist, -1 for current
69 									//		- 'track number' is the number of the track in it's respective album, as opposed to playlist number
70 									//		- the 'track number' for digital files will be 1 if the tag is not set or the file is not identified
71 
72 	opGetTrackLength = 14,			// get track length, param1 = index of track in playlist, -1 for current
73 									//                   param2 = 0 for seconds, 1 for milliseconds
74 	opGetTime = 15,					// get time on player, param1 = 0 for time displayed, 1 for track time, 2 for playlist time
75 									//					   param2 = 0 for elapsed, 1 for remaining
76 	opGetTrackState = 16,			// get whether track is marked, param1 = index of track, -1 for current
77 	opGetPlaylistNum = 17,			// get playlist number of index, param1 = index of track in playlist, -1 for current
78 	opGetMediaType = 18,			// get media type of track, param1 = index if track in playlist, -1 for current
79 									//		- see MediaTypes below for return values
80 
81 	opGetAudioInfo = 19,			// get format info about currently playing track
82 									//		- param1 = 0 for samplerate, 1 for bitrate, 2 for num channels
83 
84 	opGetOffline = 20,				// true if client is in Offline Mode
85 	opGetVisTarget = 21,			// where is vis being drawn > 0 - internal to skin, 1 - external window, 2 - full screen
86 	opGetAlwaysOnTop = 22,			// true if player is set to 'Always on Top'
87 	opGetRepeatState = 23,			// returns: 0 - repeat off, 1 - repeat track, 2 - repeat all
88 	opGetShuffleState = 27,			// returns: 0 - shuffle off, 1 - shuffle enabled
89 
90 	opGetTimerState = 24,			// low-order word: 0 - track ascend, 1 - playlist ascend, 2 - track descend, 3 - playlist descend
91 									// hi-order word: 1 if 'show hours' is set, else 0
92 
93 	opGetVolume = 25,				// get master volume level (0 - 100), param1: 0 = combined, 1 = left, 2 = right
94 	opSetVolume = 26,				// set master volume level, param1: vol level 0 - 100, param2: balance (-100 left, 0 center, 100 right)
95 
96 	opGetIndexFromPLNum = 28,		// get index from playlist number, param1 = playlist number
97 
98 	opGetExtensionWnd = 30,			// handle to the draggable window extension (only available on some skins), param1 = extension number (0 - 9)
99 	opGetExtVisWnd = 31,			// handle to the external visual window
100 	opGetMusicBrowserWnd = 32,		// handle to the music browser window
101 	opGetSkinPreviewWnd = 33,		// handle to the skin preview window
102 	opGetPropertiesWnd = 34,		// handle to the player properties window
103 	opGetExtInfoWnd = 35,			// handle to the extended information window
104 	opGetAboutWnd = 36,				// handle to the about window
105 	opGetSegmentsWnd = 37,			// handle to the segments window
106 	opGetEQPresetsWnd = 38,			// handle to the EQ presets window
107 	opGetVideoWnd = 39,				// handle to the video window
108 
109 	opGetVisDimensions = 50,		// gets the width and height of visual window (param1 = -1 current vis window, 0 internal vis, 1 external vis, 2 full screen)
110 									//		returns: HEIGHT in high word, WIDTH in low word
111 
112 	opShowVideoWindow = 55,			// Show or Close video window (param1 = 1 for create, 2 for create and show, 0 for close)
113 
114 	opGetQueriesComplete = 60,		// get status on whether all tracks in playlist have been queryied for their info
115 
116 									// playlist manipulation
117 	opDeleteIndex = 90,				// delete index from playlist (param1 = index)
118 	opSelectIndex = 91,				// mark index as selected (param1 = index, param2 = 1 - set, 0 - unset)
119 	opBlockIndex = 92,				// mark index as blocked (param1 = index, param2 = 1 - set, 0 - unset)
120 
121 	opGetMediaInfo = 99,			// get the ICddbDisc object for the index specified, param1 = index of track, -1 for current
122 									//		param2 = pointer to integer that receives track value
123 									//		returns: pointer to ICddbDisc object. Do not release or deallocate this pointer
124 
125 
126    									//*** below returns string info in buffer, param1 = size of buffer
127    									//*** returns 1 on success, 0 on failure
128 
129 	opGetTrackName = 100,			// get track name, param2 = index of track in playlist, -1 for current
130 	opGetArtistName = 101,			// get artist name, param2 = index of track in playlist, -1 for current
131 	opGetDiscName = 102,			// get disc name, param2 = index of track in playlist, -1 for current
132 
133 	opGetTrackFile = 103,			// file name of track in playlist, param2 = index of track in playlist, -1 for current
134 	opGetSkinName = 104,			// get current skin name
135 
136 	opGetPluginFolder = 105,		// get current plugin folder
137 	opGetPluginSettingsFile = 106,	// get settings file (plugins.ini) that plugin should save settings to
138 	opGetPluginCacheFile = 107,		// get file that describes plugin validity, functions and names
139 	opGetPlayerSettingsFile = 108,	// get settings file (qcd.ini) that player saves it settings to (should use for read-only)
140 
141 	opGetMusicFolder = 110,			// get current music folder
142 	opGetPlaylistFolder = 111,		// get current playlist folder
143 	opGetSkinFolder = 112,			// get current skin folder
144 	opGetCDDBCacheFolder = 113,		// get current folder for CDDB cached info
145 
146 	opGetCurrentPlaylist = 114,		// get full pathname of playlist currently loaded
147 
148 	opGetMediaID = 115,				// get media identifier, param2 = index of track in playlist, -1 for current
149 									//		- for CD's it's the TOC - for anything else, right now it's 0
150 
151 	opGetSupportedExtensions = 116,	// get file extensions supported by the player, param2 = 0 - get all extensions, 1 - get registered extensions
152 									//		- returned extensions will be colon delimited
153 
154 	opGetPlaylistString = 117,		// get string for index as it appears in playlist, param2 = index
155 
156    									//*** below buffer points to struct or other object
157    									//*** returns 1 on success, 0 on failure
158 
159 	opShowMainMenu = 120,			// Display Main QCD Menu (buffer = POINT* - location to display menu)
160 	opGetMainMenu = 121,			// Returns copy of HMENU handle to QCD Menu (must use DestroyMenu on handle when complete)
161 
162 	opShowQuickTrack = 125,			// Display QuickTrack Menu (buffer = POINT* - location to display menu)
163 	opGetQuickTrack = 126,			// Returns copy of HMENU handle to QuickTrack menu (must use DestroyMenu on handle when complete)
164 									//		To use if QuickTrack item selected: PostMessage(hwndPlayer, WM_COMMAND, menu_id, 0);
165 
166 	opGetEQVals = 200,				// get current EQ levels/on/off (buffer = EQInfo*)
167 	opSetEQVals = 201,				// set EQ levels/on/off (buffer = EQInfo*)
168 
169 	opGetProxyInfo = 202,			// get proxy info (buffer = ProxyInfo*), returns 0 if proxy not in use
170 
171 
172 									//*** below returns numeric info, buffer used
173 
174 	opGetIndexFromFilename = 210,	// get the index of a file that exists in current playlist (buffer = full path of file),
175 									//		param1 = startindex (index to start searching on)
176                                     //		returns -1 if file not in playlist
177 
178 
179 									//*** below send information to player
180 									//*** returns 1 on success, 0 on failure
181 
182 	opSetStatusMessage = 1000,		// display message in status area (buffer = msg buffer (null term), param1 = text flags (see below))
183 
184 	opSetBrowserUrl = 1001,			// set music browser URL (buffer = url (null term))
185 	                                //		null url buffer - closes browser
186 	                                //		param1 = 0 - normal, 1 - force open
187 
188 	opSetAudioInfo = 1002,			// set the current music bitrate/khz (buffer = AudioInfo*, param1 = size of AudioInfo)
189 
190 	opSetTrackAlbum = 1003,			// update track ablum name (buffer = album (null term), param1 = (string ptr)file name), param2 = MediaTypes
191 	opSetTrackTitle = 1004,			// update track title (buffer = title (null term), param1 = (string ptr)file name), param2 = MediaTypes
192 	opSetTrackArtist = 1005,		// update track artist name (buffer = artist (null term), param1 = (string ptr)file name), param2 = MediaTypes
193 
194 	opSetTrackExtents = 1007,		// update track TrackExtents info (buffer = &TrackExtents), param1 = (string ptr)file name)
195 	opSetTrackSeekable = 1008,		// update track seekable flag (buffer = (string ptr)file name), param1 = TRUE/FALSE
196 	opSetPlayNext = 1009,			// set the next index to be played (buffer = NULL, param1 = index, index = -1 unsets playnext)
197 	opSetIndexFilename = 1010,		// updates the filename (or stream) that an index in the current playlist refers to, buffer = new filename, param1 = index
198 
199 	opSetPlaylist = 1006,			// clear playlist, add files to playlist or reset playlist with new files
200 									//		buffer = file list (each file in quotes, string null terminated) Eg; buffer="\"file1.mp3\" \"file2.mp3\"\0" - NULL to clear playlist
201 									//		param1 = (string ptr)originating path (can be NULL if paths included with files)
202 									//		param2 = 1 - clear playlist flag, 2 - enqueue to top
203 
204 	opInsertPlaylist = 1011,		// insert tracks into playlist
205 									//		buffer = file list (each file in quotes, string null terminated) Eg; buffer="\"file1.mp3\" \"file2.mp3\"\0"
206 									//		param1 = (string ptr)originating path (can be NULL if paths included with files)
207 									//		param2 = index location to insert tracks (-1 to insert at end)
208 
209 	opMovePlaylistTrack = 1012,		// param1 = index of track to move, param2 = destination index (move shifts tracks between param1 and param2)
210 	opSwapPlaylistTracks = 1013,	// param1 = index of first track, param2 = index of second track (swap only switches indecies param1 and param2)
211 
212 	opCreateDiscInfo = 1020,		// returns: pointer to ICddbDisc object. Do not release or deallocate this pointer
213 	opSetDiscInfo = 1021,			// buffer = ICddbDisc*, param1 = MediaInfo*, param2 = track number
214 
215 	opSetSeekPosition = 1100,		// seek to position during playback
216 									//		buffer = NULL, param1 = position
217 									//		param2 = 0 - position is in seconds, 1 - position is in milliseconds, 2 - position is in percent (use (float)param1))
218 
219 
220 	opSetRepeatState = 1110,		// set playlist repeat state, buffer = NULL, param1 = 0 - off, 1 - repeat track, 2 - repeat playlist
221 	opSetShuffleState = 1111,		// set playlist shuffle state, buffer = NULL, param1 = 0 - off, 1 - on
222 
223 									//*** below configures custom plugin menu items for the 'plugin menu'
224 									//*** Player will call plugin's configure routine with menu value when menu item selected
225 									//*** returns 1 on success, 0 on failure
226 
227 	opSetPluginMenuItem = 2000,		// buffer = HINSTANCE of plugin, param1 = item id, param2 = (string ptr)string to display
228 									//		- set param2 = 0 to remove item id from menu
229 									//		- set param1 = 0 and param2 = 0 to remove whole menu
230 	opSetPluginMenuState = 2001,	// buffer = HINSTANCE of plugin, param1 = item id, param2 = menu flags (same as windows menu flags - eg: MF_CHECKED)
231 
232 
233 									//*** below are services for using the player's filename template editor
234 									//*** returns 1 on success, 0 on failure
235 
236 	opShowTemplateEditor = 2100,	// displays template editor dialog, param1 = (HWND)parent window, param2 = modal flag
237 	opLoadTemplate = 2101,			// loads saved templates, buffer = (char*)string buf, param1 = bufsize, param2 = index of template (index < 0 for default formats, index >= 0 for user made formats)
238 	opRenderTemplate = 2102,		// create string based on template, buffer = (char*)template, param1 = FormatMetaInfo*, param2 = (char*)string buffer (min 260 bytes)
239 
240 									//*** other services
241 
242 	opUTF8toUCS2 = 9000,			// convert UTF8 string to UCS2 (Unicode) string, buffer = null terminated utf8 string, param1 = (WCHAR*)result string buffer, param2 = size of result buffer
243 	opUCS2toUTF8 = 9001,			// convert UCS2 (Unicode) string to UTF8 string, buffer = null terminated ucs2 string, param1 = (char*)result string buffer, param2 = size of result buffer
244 
245 	opSafeWait = 10000				// plugin's can use this to wait on an object without worrying about deadlocking the player.
246 									// this should only be called by the thread that enters the plugin, not by any plugin-created threads
247 
248 } PluginServiceOp;
249 
250 //-----------------------------------------------------------------------------
251 // Info services api provided by the Player, called by Plugin.
252 //-----------------------------------------------------------------------------
253 typedef long (*PluginServiceFunc)(PluginServiceOp op, void *buffer, long param1, long param2);
254 
255 // Use to retrieve service func for DSP plugins (or other inproc process that doesn't have access to PluginServiceFunc)
256 // Eg: PluginServiceFunc Service = (PluginServiceFunc)SendMessage(hwndPlayer, WM_GETSERVICEFUNC, 0, 0);
257 // Set WPARAM = PLUGIN_API_WANTUTF8 for UTF8 string parameters
258 #define WM_GETSERVICEFUNC			(WM_USER + 1)
259 
260 //-----------------------------------------------------------------------------
261 typedef struct				// for Output Plugin Write callback
262 {
263 	void	*data;			// pointer to valid data
264 	int		bytelen;		// length of data pointed to by 'data' in bytes
265 	UINT	numsamples;		// number of samples represented by 'data'
266 	UINT	bps;			// bits per sample
267 	UINT	nch;			// number of channels
268 	UINT	srate;			// sample rate
269 
270 	UINT	markerstart;	// Marker position at start of data (marker is time value of data)
271 							// (set to WAVE_VIS_DATA_ONLY to not have data sent to output plugins)
272 	UINT	markerend;		// Marker position at end of data (not currently used, set to 0)
273 } WriteDataStruct;
274 
275 //-----------------------------------------------------------------------------
276 typedef struct			// for GetTrackExtents Input Plugin callback
277 {
278 	UINT track;			// for CD's, set the track number. Otherwise set to 1.
279 	UINT start;			// for CD's or media that doesn't start at the beginning
280 						// of the file, set to start position. Otherwise set to 0.
281 	UINT end;			// set to end position of media.
282 	UINT unitpersec;	// whatever units are being used for this media, how many
283 						// of them per second.
284 						// (Note: ((end - start) / unitpersecond) = file length
285 	UINT bytesize;		// size of file in bytes (if applicable, otherwise 0).
286 } TrackExtents;
287 
288 //-----------------------------------------------------------------------------
289 typedef struct			// for opSetAudioInfo service
290 {
291     long struct_size;	// sizeof(AudioInfo)
292     long level;			// MPEG level (1 for MPEG1, 2 for MPEG2, 3 for MPEG2.5, 7 for MPEGpro)
293     long layer;			// and layer (1, 2 or 3)
294     long bitrate;		// audio bitrate in bits per second
295     long frequency;		// audio freq in Hz
296     long mode;			// 0 for stereo, 1 for joint-stereo, 2 for dual-channel, 3 for mono, 4 for multi-channel
297 	char text[8];		// up to eight characters to identify format (will override level and layer settings)
298 } AudioInfo;
299 
300 //-----------------------------------------------------------------------------
301 // Equalizer Info
302 //-----------------------------------------------------------------------------
303 typedef struct			// for coming QCD version
304 {
305 	long struct_size;	// sizeof(EQInfo)
306 	char enabled;
307 	char preamp;		// -128 to 127, 0 is even
308 	char bands[10];		// -128 to 127, 0 is even
309 } EQInfo;
310 
311 //-----------------------------------------------------------------------------
312 typedef struct
313 {
314 	long struct_size;	// sizeof(ProxyInfo)
315 	char hostname[200];
316 	long port;
317 	char username[100];
318 	char password[100];
319 } ProxyInfo;
320 
321 //-----------------------------------------------------------------------------
322 typedef enum			// for MediaInfo.mediaType
323 {
324 	UNKNOWN_MEDIA = 0,
325 	CD_AUDIO_MEDIA = 1,
326 	DIGITAL_FILE_MEDIA = 2,
327 	DIGITAL_STREAM_MEDIA = 3
328 } MediaTypes;
329 
330 //-----------------------------------------------------------------------------
331 #define MAX_TOC_LEN				2048
332 typedef struct
333 {
334 	// media descriptors
335 	CHAR		mediaFile[MAX_PATH];
336 	MediaTypes	mediaType;
337 
338 	// cd audio media info
339 	CHAR		cd_mediaTOC[MAX_TOC_LEN];
340 	int			cd_numTracks;
341 	int			cd_hasAudio;
342 
343 	// operation info
344 	int			op_canSeek;
345 
346 	// not used
347 	int			reserved[4];
348 
349 } MediaInfo;
350 
351 //-----------------------------------------------------------------------------
352 typedef struct
353 {
354 	long	struct_size;
355 	LPCWSTR	title;
356 	LPCWSTR	artalb;
357 	LPCWSTR	album;
358 	LPCWSTR	genre;
359 	LPCWSTR	year;
360 	LPCWSTR	tracknum;
361 	LPCWSTR	filename;
362 	LPCWSTR	arttrk;
363 	long	reserved;
364 
365 } FormatMetaInfo;
366 
367 //-----------------------------------------------------------------------------
368 // When subclassing the parent window, a plugin can watch for these messages
369 // to react to events going on between plugins and player
370 // DO NOT SEND THESE MESSAGES - can only watch for them
371 
372 // Plugin to Player Notifiers
373 #define WM_PN_POSITIONUPDATE	(WM_USER + 100)	// playback progress updated
374 #define WM_PN_PLAYSTARTED		(WM_USER + 101)	// playback has started
375 #define WM_PN_PLAYSTOPPED		(WM_USER + 102) // playback has stopped by user
376 #define WM_PN_PLAYPAUSED		(WM_USER + 103) // playback has been paused
377 #define WM_PN_PLAYDONE			(WM_USER + 104) // playback has finished (track completed)
378 #define WM_PN_MEDIAEJECTED		(WM_USER + 105) // a CD was ejected (CDRom drive letter= 'A' + lParam)
379 #define WM_PN_MEDIAINSERTED		(WM_USER + 106) // a CD was inserted (CDRom drive letter= 'A' + lParam)
380 #define WM_PN_INFOCHANGED		(WM_USER + 107) // track information was updated (lParam = (LPCSTR)medianame)
381 #define WM_PN_TRACKCHANGED		(WM_USER + 109)	// current track playing has changed (relevant from CD plugin) (lParam = (LPCSTR)medianame)
382 
383 // Player to Plugin Notifiers
384 #define WM_PN_PLAYLISTCHANGED	(WM_USER + 200) // playlist has changed in some way (add, delete, sort, shuffle, drag-n-drop, etc...)
385 
386 // For intercepting main menu display
387 // (so you can get handle, modify, and display your own)
388 #define WM_SHOWMAINMENU			(WM_USER + 20)
389 
390 // For intercepting skinned border window commands
391 #define WM_BORDERWINDOW			(WM_USER + 26)
392 // WM_BORDERWINDOW	wParam's
393 #define BORDERWINDOW_NORMALSIZE			0x100000
394 #define BORDERWINDOW_DOUBLESIZE			0x200000
395 #define BORDERWINDOW_FULLSCREEN			0x400000
396 
397 // send to border window to cause resize
398 // wParam = LPPOINT lpp; // point x-y is CLIENT area size of window
399 #define WM_SIZEBORDERWINDOW		(WM_USER + 1)
400 
401 //-----------------------------------------------------------------------------
402 // To shutdown player, send this command
403 #define WM_SHUTDOWN				(WM_USER + 5)
404 
405 //-----------------------------------------------------------------------------
406 // opSetStatusMessage textflags
407 #define TEXT_DEFAULT		0x0		// message scrolls by in status window
408 #define TEXT_TOOLTIP		0x1		// message acts as tooltip in status window
409 #define TEXT_URGENT			0x2		// forces message to appear even if no status window (using msg box)
410 #define TEXT_HOLD			0x4		// tooltip message stays up (no fade out)
411 #define TEXT_UNICODE		0x10	// buffer contains a unicode string (multibyte string otherwise)
412 
413 #endif //QCDMODDEFS_H