1
0

WinampInterface.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #ifndef NULLSOFT_WINAMPINTERFACEH
  2. #define NULLSOFT_WINAMPINTERFACEH
  3. #include "Main.h"
  4. #include <windows.h>
  5. #include "../Winamp/wa_ipc.h"
  6. #include "../Winamp/In2.h"
  7. #include "../Winamp/strutil.h"
  8. #include "output/AudioOut.h"
  9. #include "../nu/AutoLock.h"
  10. extern AudioOut *out;
  11. extern In_Module plugin;
  12. class WinampInterface
  13. {
  14. public:
  15. WinampInterface();
  16. HWND GetVideoWindow();
  17. IVideoOutput *GetVideoOutput();
  18. void EndOfFile();
  19. HWND GetWinampWindow();
  20. void RefreshTitle()
  21. {
  22. PostMessage(plugin.hMainWindow, WM_USER, 0, IPC_UPDTITLE);
  23. }
  24. const char *GetProxy()
  25. {
  26. return (const char *)SendMessage(plugin.hMainWindow, WM_WA_IPC, 0, IPC_GET_PROXY_STRING);
  27. }
  28. void ResetBuffering() { bufferCount=0;}
  29. void Buffering(int bufStatus, const wchar_t *displayString);
  30. bool OpenEncryptedVideo(int width, int height, bool flip, double aspect, int fourcc);
  31. bool OpenVideo(int width, int height, bool flip, double aspect, int fourcc)
  32. {
  33. GetVideoOutput()->extended(VIDUSER_SET_THREAD_SAFE, 1, 0);
  34. bool video = (GetVideoOutput()->open(width, height, flip ? 1 : 0, aspect, fourcc) == 0);
  35. return video;
  36. }
  37. ULONG_PTR GetStart()
  38. {
  39. return SendMessage(plugin.hMainWindow, WM_WA_IPC,0,IPC_GETPLAYITEM_START);
  40. }
  41. ULONG_PTR GetEnd()
  42. {
  43. return SendMessage(plugin.hMainWindow, WM_WA_IPC,0,IPC_GETPLAYITEM_END);
  44. }
  45. void PressStop()
  46. {
  47. SendMessage(plugin.hMainWindow, WM_COMMAND, 40047, 0);
  48. }
  49. void PressPlay()
  50. {
  51. SendMessage(plugin.hMainWindow, WM_COMMAND,40045, 0);
  52. }
  53. void DrawFrame(void *frame)
  54. {
  55. GetVideoOutput()->draw(frame);
  56. }
  57. void EncryptedDrawFrame(void *frame);
  58. void SetVideoStatusText(char *text)
  59. {
  60. GetVideoOutput()->extended(VIDUSER_SET_INFOSTRING,(INT_PTR)text,0);
  61. }
  62. void SetVideoPalette(RGBQUAD *palette)
  63. {
  64. GetVideoOutput()->extended(VIDUSER_SET_PALETTE,(INT_PTR)palette,0);
  65. }
  66. void CloseViz()
  67. {
  68. plugin.SAVSADeInit();
  69. }
  70. void CloseEncryptedVideo();
  71. void CloseVideo()
  72. {
  73. GetVideoOutput()->close();
  74. }
  75. void SetAudioInfo(int bitRateKiloBits, int sampleRateKiloHertz, int channels)
  76. {
  77. plugin.SetInfo(bitRateKiloBits, sampleRateKiloHertz, channels, 1);
  78. }
  79. void OpenViz(int maxLatency, int sampleRate)
  80. {
  81. plugin.SAVSAInit(maxLatency, sampleRate);
  82. }
  83. void SetVizInfo(int sampleRate, int channels)
  84. {
  85. plugin.VSASetInfo(sampleRate, channels);
  86. }
  87. bool GetStatusHook(wchar_t *title, size_t titleLen, const wchar_t *filename);
  88. bool HasStatus(const wchar_t *filename);
  89. void SetStatus(wchar_t *_status);
  90. bool GetStatus(wchar_t *title, size_t titleLen, const wchar_t *filename);
  91. void ClearStatus();
  92. Nullsoft::Utility::LockGuard statusGuard;
  93. int bufferCount;
  94. private:
  95. wchar_t status[1024];
  96. wchar_t statusFilename[FILENAME_SIZE];
  97. IVideoOutput *videoWindow;
  98. };
  99. #endif