in2.h 7.1 KB

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