IN2.H 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #ifndef NULLSOFT_WINAMP_IN2H
  2. #define NULLSOFT_WINAMP_IN2H
  3. #include "out.h"
  4. // note: exported symbol is now winampGetInModule2.
  5. #define IN_UNICODE 0x0F000000
  6. #ifdef UNICODE_INPUT_PLUGIN
  7. #define in_char wchar_t
  8. #define IN_VER (IN_UNICODE | 0x100)
  9. #else
  10. #define in_char char
  11. #define IN_VER 0x100
  12. #endif
  13. #define IN_MODULE_FLAG_USES_OUTPUT_PLUGIN 1
  14. // By default, Winamp assumes that your input plugin wants to use Winamp's EQ, and doesn't do replay gain
  15. // if you handle any of these yourself (EQ, Replay Gain adjustments), then set these flags accordingly
  16. #define IN_MODULE_FLAG_EQ 2 // set this if you do your own EQ
  17. #define IN_MODULE_FLAG_REPLAYGAIN 8 // set this if you adjusted volume for replay gain
  18. // for tracks with no replay gain metadata, you should clear this flag
  19. // UNLESS you handle "non_replaygain" gain adjustment yourself
  20. #define IN_MODULE_FLAG_REPLAYGAIN_PREAMP 16 // use this if you queried for the replay gain preamp parameter and used it
  21. // this parameter is new to 5.54
  22. typedef struct
  23. {
  24. int version; // module type (IN_VER)
  25. char *description; // description of module, with version string
  26. HWND hMainWindow; // winamp's main window (filled in by winamp)
  27. HINSTANCE hDllInstance; // DLL instance handle (Also filled in by winamp)
  28. char *FileExtensions; // "mp3\0Layer 3 MPEG\0mp2\0Layer 2 MPEG\0mpg\0Layer 1 MPEG\0"
  29. // May be altered from Config, so the user can select what they want
  30. int is_seekable; // is this stream seekable?
  31. int UsesOutputPlug; // does this plug-in use the output plug-ins? (musn't ever change, ever :)
  32. // note that this has turned into a "flags" field
  33. // see IN_MODULE_FLAG_*
  34. void (*Config)(HWND hwndParent); // configuration dialog
  35. void (*About)(HWND hwndParent); // about dialog
  36. void (*Init)(); // called at program init
  37. void (*Quit)(); // called at program quit
  38. #define GETFILEINFO_TITLE_LENGTH 2048
  39. void (*GetFileInfo)(const in_char *file, in_char *title, int *length_in_ms); // if file == NULL, current playing is used
  40. #define INFOBOX_EDITED 0
  41. #define INFOBOX_UNCHANGED 1
  42. int (*InfoBox)(const in_char *file, HWND hwndParent);
  43. int (*IsOurFile)(const in_char *fn); // called before extension checks, to allow detection of mms://, etc
  44. // playback stuff
  45. int (*Play)(const in_char *fn); // return zero on success, -1 on file-not-found, some other value on other (stopping winamp) error
  46. void (*Pause)(); // pause stream
  47. void (*UnPause)(); // unpause stream
  48. int (*IsPaused)(); // ispaused? return 1 if paused, 0 if not
  49. void (*Stop)(); // stop (unload) stream
  50. // time stuff
  51. int (*GetLength)(); // get length in ms
  52. int (*GetOutputTime)(); // returns current output time in ms. (usually returns outMod->GetOutputTime()
  53. void (*SetOutputTime)(int time_in_ms); // seeks to point in stream (in ms). Usually you signal your thread to seek, which seeks and calls outMod->Flush()..
  54. // volume stuff
  55. void (*SetVolume)(int volume); // from 0 to 255.. usually just call outMod->SetVolume
  56. void (*SetPan)(int pan); // from -127 to 127.. usually just call outMod->SetPan
  57. // in-window builtin vis stuff
  58. void (*SAVSAInit)(int maxlatency_in_ms, int srate); // call once in Play(). maxlatency_in_ms should be the value returned from outMod->Open()
  59. // call after opening audio device with max latency in ms and samplerate
  60. void (*SAVSADeInit)(); // call in Stop()
  61. // simple vis supplying mode
  62. void (*SAAddPCMData)(void *PCMData, int nch, int bps, int timestamp);
  63. // sets the spec data directly from PCM data
  64. // quick and easy way to get vis working :)
  65. // needs at least 576 samples :)
  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. int (*SAAdd)(void *data, int timestamp, int csa); // sets the spec data, filled in by winamp
  70. // vis stuff (plug-in)
  71. // simple vis supplying mode
  72. void (*VSAAddPCMData)(void *PCMData, int nch, int bps, int timestamp); // sets the vis data directly from PCM data
  73. // quick and easy way to get vis working :)
  74. // needs at least 576 samples :)
  75. // advanced vis supplying mode, only use if you're cool. Use VSAAddPCMData for most stuff.
  76. int (*VSAGetMode)(int *specNch, int *waveNch); // use to figure out what to give to VSAAdd
  77. int (*VSAAdd)(void *data, int timestamp); // filled in by winamp, called by plug-in
  78. // call this in Play() to tell the vis plug-ins the current output params.
  79. void (*VSASetInfo)(int srate, int nch); // <-- Correct (benski, dec 2005).. old declaration had the params backwards
  80. // dsp plug-in processing:
  81. // (filled in by winamp, calld by input plug)
  82. // returns 1 if active (which means that the number of samples returned by dsp_dosamples
  83. // could be greater than went in.. Use it to estimate if you'll have enough room in the
  84. // output buffer
  85. int (*dsp_isactive)();
  86. // returns number of samples to output. This can be as much as twice numsamples.
  87. // be sure to allocate enough buffer for samples, then.
  88. int (*dsp_dosamples)(short int *samples, int numsamples, int bps, int nch, int srate);
  89. // eq stuff
  90. 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.
  91. // info setting (filled in by winamp)
  92. void (*SetInfo)(int bitrate, int srate, int stereo, int synched); // if -1, changes ignored? :)
  93. Out_Module *outMod; // filled in by winamp, optionally used :)
  94. } In_Module;
  95. // return values from the winampUninstallPlugin(HINSTANCE hdll, HWND parent, int param)
  96. // which determine if we can uninstall the plugin immediately or on winamp restart
  97. //
  98. // uninstall support was added from 5.0+ and uninstall now support from 5.5+
  99. // it is down to you to ensure that if uninstall now is returned that it will not cause a crash
  100. // (ie don't use if you've been subclassing the main window)
  101. #define IN_PLUGIN_UNINSTALL_NOW 0x1
  102. #define IN_PLUGIN_UNINSTALL_REBOOT 0x0
  103. #endif