KLMp4Video.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:2k
源码类别:

模拟服务器

开发平台:

C/C++

  1. //---------------------------------------------------------------------------
  2. // Sword3 Engine (c) 1999-2000 by Kingsoft
  3. //
  4. // File: KLMp4Video.h
  5. // Date: 2000.08.08
  6. // Code: Daniel Wang
  7. // Desc: Header File
  8. //---------------------------------------------------------------------------
  9. #ifndef KMp4Video_H
  10. #define KMp4Video_H
  11. //---------------------------------------------------------------------------
  12. #include "KLAviFile.h"
  13. #include "KLThread.h"
  14. #include "KLTimer.h"
  15. //---------------------------------------------------------------------------
  16. #define WM_MP4MOVIE_END WM_USER + 1
  17. //---------------------------------------------------------------------------
  18. typedef unsigned int        uint32;
  19. class KLMp4Video
  20. {
  21. private:
  22. KLTimer m_Timer;
  23. KLThread m_Thread;
  24. HANDLE m_hEvent[2];
  25. HANDLE m_hMutex;
  26. int m_nX;
  27. int m_nY;
  28. int m_nWidth;
  29. int m_nHeight;
  30. LPBYTE m_pVideo;
  31. LPBYTE m_pFrame;
  32. int m_nFrameSize;
  33. int m_nFrameRate;
  34. int m_nFrameTime;
  35. ULONG m_uTimeID;
  36. BOOL m_bZoomToWin;
  37. KLAviFile m_AviFile;
  38. DWORD m_dwHandle;
  39. BOOL DivXInit();
  40. void DivXExit();
  41. void DivXDecode(BOOL bRender);
  42. bool m_bWait;
  43. public:
  44. KLMp4Video();
  45. ~KLMp4Video();
  46. BOOL Open(LPSTR FileName);
  47. void Close();
  48. void Seek(int nPercent);
  49. void Rewind();
  50. void Play(BOOL bZoom = FALSE);
  51. void Stop();
  52. BOOL IsPlaying();
  53. void GetVideoSize(int &nWidth,int &nHeight){nWidth = m_nWidth , nHeight = m_nHeight;}
  54. int GetVideoFrames(){return m_AviFile.TotalFrames();}
  55. int GetCurFrame(){return m_AviFile.CurrentFrame();}
  56. bool ShouldWait()
  57. {
  58. bool bRet = m_bWait && (m_uTimeID != 0);
  59. m_bWait = true;
  60. return bRet;
  61. }
  62. void VideoCopyToBuffer(void *buf,uint32 left,uint32 top,
  63. uint32 Pitch,uint32 destheight,uint32 Flags);
  64. protected:
  65. BOOL NextFrame();
  66. void SetPos(int nX, int nY);
  67. BOOL Init();
  68. BOOL InitEventHandle();
  69. void FreeEventHandle();
  70. static void ThreadFunction(void* lpParam);
  71. BOOL HandleNotify();
  72. };
  73. //---------------------------------------------------------------------------
  74. #endif