1 /* Standard Winamp input-plugin header 2 */ 3 4 #include "out.h" 5 6 /* post this to the main window at end of file (after playback as stopped) */ 7 #define WM_WA_MPEG_EOF (WM_USER + 2) 8 9 // note: exported symbol is now winampGetInModule2. 10 11 #define IN_VER 0x100 12 13 typedef struct 14 { 15 int version; // module type (IN_VER) 16 char *description; // description of module, with version string 17 18 HWND hMainWindow; // winamp's main window (filled in by winamp) 19 HINSTANCE hDllInstance; // DLL instance handle (Also filled in by winamp) 20 21 char *FileExtensions; // "mp3\0Layer 3 MPEG\0mp2\0Layer 2 MPEG\0mpg\0Layer 1 MPEG\0" 22 // May be altered from Config, so the user can select what they want 23 24 int is_seekable; // is this stream seekable? 25 int UsesOutputPlug; // does this plug-in use the output plug-ins? (musn't ever change, ever :) 26 27 void (*Config)(HWND hwndParent); // configuration dialog 28 void (*About)(HWND hwndParent); // about dialog 29 30 void (*Init)(); // called at program init 31 void (*Quit)(); // called at program quit 32 33 void (*GetFileInfo)(char *file, char *title, int *length_in_ms); // if file == NULL, current playing is used 34 int (*InfoBox)(char *file, HWND hwndParent); 35 36 int (*IsOurFile)(char *fn); // called before extension checks, to allow detection of mms://, etc 37 // playback stuff 38 int (*Play)(char *fn); // return zero on success, -1 on file-not-found, some other value on other (stopping winamp) error 39 void (*Pause)(); // pause stream 40 void (*UnPause)(); // unpause stream 41 int (*IsPaused)(); // ispaused? return 1 if paused, 0 if not 42 void (*Stop)(); // stop (unload) stream 43 44 // time stuff 45 int (*GetLength)(); // get length in ms 46 int (*GetOutputTime)(); // returns current output time in ms. (usually returns outMod->GetOutputTime() 47 void (*SetOutputTime)(int time_in_ms); // seeks to point in stream (in ms). Usually you signal yoru thread to seek, which seeks and calls outMod->Flush().. 48 49 // volume stuff 50 void (*SetVolume)(int volume); // from 0 to 255.. usually just call outMod->SetVolume 51 void (*SetPan)(int pan); // from -127 to 127.. usually just call outMod->SetPan 52 53 // in-window builtin vis stuff 54 55 void (*SAVSAInit)(int maxlatency_in_ms, int srate); // call once in Play(). maxlatency_in_ms should be the value returned from outMod->Open() 56 // call after opening audio device with max latency in ms and samplerate 57 void (*SAVSADeInit)(); // call in Stop() 58 59 60 // simple vis supplying mode 61 void (*SAAddPCMData)(void *PCMData, int nch, int bps, int timestamp); 62 // sets the spec data directly from PCM data 63 // quick and easy way to get vis working :) 64 // needs at least 576 samples :) 65 66 // advanced vis supplying mode, only use if you're cool. Use SAAddPCMData for most stuff. 67 int (*SAGetMode)(); // gets csa (the current type (4=ws,2=osc,1=spec)) 68 // use when calling SAAdd() 69 void (*SAAdd)(void *data, int timestamp, int csa); // sets the spec data, filled in by winamp 70 71 72 // vis stuff (plug-in) 73 // simple vis supplying mode 74 void (*VSAAddPCMData)(void *PCMData, int nch, int bps, int timestamp); // sets the vis data directly from PCM data 75 // quick and easy way to get vis working :) 76 // needs at least 576 samples :) 77 78 // advanced vis supplying mode, only use if you're cool. Use VSAAddPCMData for most stuff. 79 int (*VSAGetMode)(int *specNch, int *waveNch); // use to figure out what to give to VSAAdd 80 void (*VSAAdd)(void *data, int timestamp); // filled in by winamp, called by plug-in 81 82 83 // call this in Play() to tell the vis plug-ins the current output params. 84 void (*VSASetInfo)(int nch, int srate); 85 86 87 // dsp plug-in processing: 88 // (filled in by winamp, called by input plug) 89 90 // returns 1 if active (which means that the number of samples returned by dsp_dosamples 91 // could be greater than went in.. Use it to estimate if you'll have enough room in the 92 // output buffer 93 int (*dsp_isactive)(); 94 95 // returns number of samples to output. This can be as much as twice numsamples. 96 // be sure to allocate enough buffer for samples, then. 97 int (*dsp_dosamples)(short int *samples, int numsamples, int bps, int nch, int srate); 98 99 100 // eq stuff 101 void (*EQSet)(int on, char data[10], int preamp); // 0-64 each, 31 is +0, 0 is +12, 63 is -12. Do nothing to ignore. 102 103 // info setting (filled in by winamp) 104 void (*SetInfo)(int bitrate, int srate, int stereo, int synched); // if -1, changes ignored? :) 105 106 Out_Module *outMod; // filled in by winamp, optionally used :) 107 } In_Module; 108