VideoOutput.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #ifndef NULLSOFT_VIDEOOUTPUTH
  2. #define NULLSOFT_VIDEOOUTPUTH
  3. extern "C" {
  4. #include "main.h" // would rather not do this.
  5. };
  6. #include <ddraw.h>
  7. #include "../nu/AutoLock.h"
  8. #include "VideoOSD.h"
  9. #include "VideoAspectAdjuster.h"
  10. #include "vid_d3d.h"
  11. class VideoRenderer;
  12. extern IVideoOSD *posd;
  13. #define VIDEO_OPEN_
  14. #define SHOW_STREAM_TITLE_AT_TOP 1
  15. void ResizeVideoWindowToCurrent();
  16. void updateTrackSubmenu();
  17. using namespace Nullsoft::Utility;
  18. class VideoOutput : public IVideoOutput, public VideoAspectAdjuster
  19. {
  20. public:
  21. VideoOutput(HWND parent_hwnd = NULL, int initxpos = CW_USEDEFAULT, int initypos = CW_USEDEFAULT);
  22. ~VideoOutput();
  23. int open(int w, int h, int vflip, double aspectratio, unsigned int fmt);
  24. void close();
  25. void draw(void *frame);
  26. void drawSubtitle(SubsItem *item);
  27. void showStatusMsg(const char *text);
  28. void notifyBufferState(int bufferstate); /* 0-255*/
  29. int get_latency();
  30. void setcallback(LRESULT (*msgcallback)(void *token, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam), void *token) { m_msgcallback_tok = token; m_msgcallback = msgcallback; }
  31. void fullscreen();
  32. void remove_fullscreen();
  33. int is_fullscreen();
  34. void adjustAspect(RECT &rd);
  35. INT_PTR extended(INT_PTR param1, INT_PTR param2, INT_PTR param3);
  36. int isVideoPlaying() { return m_opened; }
  37. DWORD GetWidthHeightDWORD() { return width | (height << 16); }
  38. ITrackSelector *getTrackSelector() { return m_tracksel; }
  39. void SetVideoPosition(int x, int y, int width, int height);
  40. HWND getHwnd() { return video_hwnd; }
  41. void mainthread_Create();
  42. private:
  43. void UpdateText(const wchar_t *videoInfo);
  44. int openUser(int w, int h, int vflip, double aspectratio, unsigned int fmt);
  45. void LoadLogo();
  46. void OpenVideoSize(int newWidth, int newHeight, double newAspect);
  47. VideoRenderer *FindBestRenderer();
  48. void PaintLogo(int bufferState);
  49. void DrawLogo(HDC canvas, RECT *canvas_size);
  50. void resetSubtitle();
  51. void UpdateVideoSize(int newWidth, int newHeight, double aspect = 1.0, int zoom = ID_VIDEOWND_ZOOM100);
  52. bool is_fs, fs_has_resized;
  53. unsigned int last_fullscreen_exit_time;
  54. LRESULT WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  55. static int class_refcnt;
  56. static LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  57. HWND video_hwnd;
  58. double aspect;
  59. int width, height;
  60. unsigned int type;
  61. RECT oldfsrect; // the old window rect, BEFORE fullscreen mode was entered
  62. RECT lastfsrect; // the most recent bounding rect when in fullscreen mode
  63. int m_bufferstate;
  64. SubsItem *curSubtitle;
  65. LRESULT (*m_msgcallback)(void *token, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  66. void *m_msgcallback_tok;
  67. Direct3DVideoOutput *m_video_output;
  68. char *m_statusmsg;
  69. bool m_need_change, m_ignore_change;
  70. bool m_opened;
  71. HBITMAP m_logo;
  72. int m_logo_w, m_logo_h;
  73. int m_lastbufinvalid;
  74. HWND fs_reparented;
  75. HRGN fs_reparented_rgn;
  76. ITrackSelector *m_tracksel;
  77. LockGuard guard, textGuard;
  78. int clickx, clicky;
  79. RGBQUAD *video_palette;
  80. // IVideoOSD osd;
  81. bool userVideo;
  82. bool video_created;
  83. };
  84. #endif