1
0

IN2.H 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. #ifndef NULLSOFT_WINAMP_IN2H
  2. #define NULLSOFT_WINAMP_IN2H
  3. // Input plugin interface
  4. #include "out.h"
  5. #ifdef __cplusplus
  6. class api_service;
  7. #endif
  8. // If you want your input plugin to support unicode then define the following which will then
  9. // adjust required functions to their unicode variants. This is supported from Winamp 5.3+.
  10. #define IN_UNICODE 0x0F000000
  11. #define IN_INIT_RET 0xF0000000
  12. #ifdef UNICODE_INPUT_PLUGIN
  13. #define in_char wchar_t
  14. #define IN_VER_OLD (IN_UNICODE | 0x100)
  15. #define IN_VER (IN_UNICODE | 0x101)
  16. #define IN_VER_RET (IN_INIT_RET | IN_VER)
  17. #else
  18. #define in_char char
  19. #define IN_VER_OLD 0x100
  20. #define IN_VER 0x101
  21. #define IN_VER_RET (IN_INIT_RET | IN_VER)
  22. #endif
  23. // added 5.64+ & updated 5.66+
  24. //
  25. // specify IN_VER if you want to provide a unicode (wchar_t*) description and only work on 5.64+
  26. // specify IN_VER_OLD to use the original (char*) description as before
  27. // note: we are using the fact that sizeof(char*) == sizeof(wchar_t*) to be able to allow this
  28. // so now when using IN_VER you will need to cast description to (wchar_t*) to set this.
  29. // added 5.66+
  30. // specify IN_VER_RET to allow for the init(..) member to return an int status value as either
  31. // IN_INIT_SUCCESS or IN_INIT_FAILURE to allow for better support with loading failures or if
  32. // needing to specifically prevent loading if required e.g. OS incompatibility or access issues.
  33. //
  34. // Also added is the 'service' member which saves sending a IPC_GET_API_SERVICE call on loading
  35. // which will be filled in if IN_VER_RET is specified in the 'version' member of the plug-in.
  36. #define IN_MODULE_FLAG_USES_OUTPUT_PLUGIN 1
  37. // By default Winamp assumes your input plugin wants to use Winamp's EQ, and doesn't do replay gain
  38. // if you handle any of these yourself (EQ, Replay Gain adjustments), then set these flags accordingly
  39. // Set this if you want to implement your own EQ inplace of using Winamp's native implementation.
  40. #define IN_MODULE_FLAG_EQ 2
  41. // Set this if you adjusted volume for replay gain. For tracks with no replay gain metadata then you
  42. // should clear this flag UNLESS you handle "non_replaygain" gain adjustment yourself then keep it.
  43. #define IN_MODULE_FLAG_REPLAYGAIN 8
  44. // Use this if you queried for the replay gain preamp parameter and used it. This is new to 5.54 clients.
  45. #define IN_MODULE_FLAG_REPLAYGAIN_PREAMP 16
  46. typedef struct
  47. {
  48. int version; // module type (IN_VER)
  49. char* description; // description of module, with version string
  50. HWND hMainWindow; // Winamp's main window (filled in by Winamp - is a valid HWND on 5.1+ clients)
  51. HINSTANCE hDllInstance; // DLL instance handle (Also filled in by Winamp)
  52. char* FileExtensions; // "mp3\0Layer 3 MPEG\0mp2\0Layer 2 MPEG\0mpg\0Layer 1 MPEG\0"
  53. // May be altered from Config, so the user can select what they want
  54. int is_seekable; // is this stream seekable?
  55. int UsesOutputPlug; // does this plug-in use the output plug-ins? (musn't ever change, ever :)
  56. // note that this has turned into a "flags" field see IN_MODULE_FLAG_*
  57. void(__cdecl* Config)(HWND hwndParent); // configuration dialog
  58. void(__cdecl* About)(HWND hwndParent); // about dialog
  59. // 5.66 - changed from void (__cdecl *Init)(); if using IN_VER_RET or IN_VER_RET_OLD
  60. int(__cdecl* Init)(); // called at program init
  61. void(__cdecl* Quit)(); // called at program quit
  62. #define GETFILEINFO_TITLE_LENGTH 2048
  63. // If file == NULL then the currently playing file is used (assumes you've cached it as required)
  64. void (*GetFileInfo)(const in_char* file, in_char* title, int* length_in_ms);
  65. #define INFOBOX_EDITED 0
  66. #define INFOBOX_UNCHANGED 1
  67. int(__cdecl* InfoBox)(const in_char* file, HWND hwndParent);
  68. int(__cdecl* IsOurFile)(const in_char* fn); // called before extension checks, to allow detection of mms://, etc
  69. // playback stuff
  70. int(__cdecl* Play)(const in_char* fn); // return zero on success, -1 on file-not-found, some other value on other (stopping Winamp) error
  71. void(__cdecl* Pause)(); // pause stream
  72. void(__cdecl* UnPause)(); // unpause stream
  73. int(__cdecl* IsPaused)(); // ispaused? return 1 if paused, 0 if not
  74. void(__cdecl* Stop)(); // stop (unload) stream
  75. // time stuff
  76. int(__cdecl* GetLength)(); // get length in ms
  77. int(__cdecl* GetOutputTime)(); // returns current output time in ms. (usually returns outMod->GetOutputTime()
  78. void(__cdecl* 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()..
  79. // volume stuff
  80. void(__cdecl* SetVolume)(int volume); // from 0 to 255.. usually just call outMod->SetVolume
  81. void(__cdecl* SetPan)(int pan); // from -127 to 127.. usually just call outMod->SetPan
  82. // in-window builtin vis stuff
  83. void(__cdecl* SAVSAInit)(int maxlatency_in_ms, int srate); // call once in Play(). maxlatency_in_ms should be the value returned from outMod->Open()
  84. // call after opening audio device with max latency in ms and samplerate
  85. void(__cdecl* SAVSADeInit)(); // call in Stop()
  86. // simple vis supplying mode
  87. void(__cdecl* SAAddPCMData)(void* PCMData, int nch, int bps, int timestamp); // sets the spec data directly from PCM data quick and easy way
  88. // to get vis working :) needs at least 576 samples :)
  89. // advanced vis supplying mode, only use if you're cool. Use SAAddPCMData for most stuff.
  90. int(__cdecl* SAGetMode)(); // gets csa (the current type (4=ws,2=osc,1=spec)) use when calling SAAdd()
  91. int(__cdecl* SAAdd)(void* data, int timestamp, int csa); // sets the spec data, filled in by Winamp
  92. // vis stuff (plug-in)
  93. // simple vis supplying mode
  94. void(__cdecl* VSAAddPCMData)(void* PCMData, int nch, int bps, int timestamp); // sets the vis data directly from PCM data quick and easy way
  95. // to get vis working :) needs at least 576 samples :)
  96. // advanced vis supplying mode, only use if you're cool. Use VSAAddPCMData for most stuff.
  97. int(__cdecl* VSAGetMode)(int* specNch, int* waveNch); // use to figure out what to give to VSAAdd
  98. int(__cdecl* VSAAdd)(void* data, int timestamp); // filled in by Winamp, called by plug-in
  99. // call this in Play() to tell the vis plug-ins the current output params.
  100. void(__cdecl* VSASetInfo)(int srate, int nch); // <-- Correct (benski, dec 2005).. old declaration had the params backwards
  101. // dsp plug-in processing:
  102. // (filled in by Winamp, calld by input plug)
  103. // returns 1 if active (which means that the number of samples returned by dsp_dosamples could be
  104. // greater than went in.. Use it to estimate if you'll have enough room in the output buffer
  105. int(__cdecl* dsp_isactive)();
  106. // returns number of samples to output. This can be as much as twice numsamples.
  107. // be sure to allocate enough buffer for samples, then.
  108. int(__cdecl* dsp_dosamples)(short int* samples, int numsamples, int bps, int nch, int srate);
  109. // eq stuff
  110. void(__cdecl* EQSet)(int on, char data[10], int preamp); // 0-64 each, 31 is +0, 0 is +12, 63 is -12. Do nothing to ignore.
  111. // info setting (filled in by Winamp)
  112. void(__cdecl* SetInfo)(int bitrate, int srate, int stereo, int synched); // if -1, changes ignored? :)
  113. Out_Module* outMod; // filled in by Winamp, optionally used :)
  114. // filled in by Winamp (added 5.66+ to replace need to call IPC_GET_API_SERVICE on loading)
  115. #ifdef __cplusplus
  116. api_service* service;
  117. #else
  118. void* service;
  119. #endif
  120. } In_Module;
  121. // added 5.66+
  122. // return values from the init(..) which determines if Winamp will continue loading
  123. // and handling the plugin or if it will disregard the load attempt. If GEN_INIT_FAILURE
  124. // is returned then the plugin will be listed as [NOT LOADED] on the plug-in prefs page.
  125. #define IN_INIT_SUCCESS 0
  126. #define IN_INIT_FAILURE 1
  127. // These are the return values to be used with the uninstall plugin export function:
  128. // __declspec(dllexport) int __cdecl winampUninstallPlugin(HINSTANCE hDllInst, HWND hwndDlg, int param)
  129. // which determines if Winamp can uninstall the plugin immediately or on Winamp restart.
  130. // If this is not exported then Winamp will assume an uninstall with reboot is the only way.
  131. //
  132. #define IN_PLUGIN_UNINSTALL_NOW 0x1
  133. #define IN_PLUGIN_UNINSTALL_REBOOT 0x0
  134. //
  135. // Uninstall support was added from 5.0+ and uninstall now support from 5.5+ though note
  136. // that it is down to you to ensure that if uninstall now is returned that it will not
  137. // cause a crash i.e. don't use if you've been subclassing the main window.
  138. //
  139. // The HWND passed in the calling of winampUninstallPlugin(..) is the preference page HWND.
  140. //
  141. // For a input plugin to be correctly detected by Winamp you need to ensure that
  142. // the exported winampGetInModule2(..) is exported as an undecorated function
  143. // e.g.
  144. // #ifdef __cplusplus
  145. // extern "C" {
  146. // #endif
  147. // __declspec(dllexport) In_Module * __cdecl winampGetInModule2(){ return &plugin; }
  148. // #ifdef __cplusplus
  149. // }
  150. // #endif
  151. //
  152. #endif