MediaPlayback.h
上传用户:hxb_1234
上传日期:2010-03-30
资源大小:8328k
文件大小:3k
源码类别:

VC书籍

开发平台:

Visual C++

  1. /**************************************************************************************
  2.  *                                                                                    *
  3.  *                                                                                    *
  4.  **************************************************************************************/
  5. #ifndef MEDIA_PLAYBACK_H
  6. #define MEDIA_PLAYBACK_H
  7. #include <windows.h>
  8. #include "Input.h"
  9. #include "Decaps.h"
  10. #include "MediaBuffer.h"
  11. #include "VideoDecoder.h"
  12. #include "VideoBuffer.h"
  13. #include "VideoRenderer.h"
  14. #include "AudioDecoder.h"
  15. #include "AudioRenderer.h"
  16. #include "MediaClasses.h"
  17. #include "Subtitles.h"
  18. #define  WM_PLAYA_PLAYBACK_END (WM_USER + 2)
  19. /*
  20.  * Playback Class 
  21.  * --------------
  22.  * 
  23.  *  ——为所有媒体类中的项和过滤器提供一个前端处理
  24.  * 
  25.  */
  26. class MediaPlayback {
  27. public:
  28. MediaInput         *input;
  29. MediaDecaps        *decaps;
  30. MediaVideoDecoder  *videoDecoder;
  31. MediaVideoBuffer   *videoBuffer;
  32. MediaVideoRenderer *videoRenderer;
  33. MediaAudioDecoder  *audioDecoder;
  34. MediaAudioRenderer *audioRenderer;
  35. MediaSubtitler     *subtitler;
  36. HWND                hwndPlayback;
  37. RECT               *videoRect;
  38. BOOL                hasVideo;
  39. BOOL                hasAudio;
  40. BOOL                hasSubtitles;
  41. BOOL                playing;
  42. BOOL                paused;
  43. BOOL                rewind;
  44. BOOL                fastForward;
  45. BOOL                fullscreen;
  46. BOOL                desktopMode;
  47. BOOL                end;
  48. BOOL                buffering;
  49. BOOL                hasToBuffer;
  50. DWORD               bufferingProgress;
  51. DWORD               loop;
  52. DWORD               baseTime;
  53. DWORD               stopTime;
  54. DWORD               volume;
  55. HANDLE              playbackMutex;
  56. HANDLE              videoThread;
  57. DWORD               videoThreadId;
  58. DWORD               videoFrames;
  59. DWORD               audioBytes;
  60. char                filename[512];
  61. MediaPlayback();
  62. ~MediaPlayback();
  63. MP_RESULT     OpenMedia(char *lpFilename, HWND hwndPlayback);
  64. MP_RESULT     OpenMediaSource(char *lpFilename);
  65. MP_RESULT     OpenMediaFromSource(HWND hwnd);
  66. BOOL          HasVideo();
  67. BOOL          HasAudio();
  68. char         *GetFilename();
  69. unsigned int  GetVideoWidth();
  70. unsigned int  GetVideoHeight();
  71. unsigned long GetVideoTime();
  72. unsigned long GetAudioTime();
  73. double        GetPlaybackProgress();
  74. unsigned int  GetActualTime();
  75. unsigned int  GetTotalTime();
  76. double        GetCurrentFps();
  77. BOOL          IsPaused();
  78. BOOL          IsPlaying();
  79. BOOL          IsInFullscreen();
  80. BOOL          IsOverlay();
  81. BOOL          IsBuffering();
  82. DWORD         GetBufferingProgress();
  83. MP_RESULT     UpdateBuffering();
  84. MP_RESULT     FlipToGDI();
  85. MP_RESULT     Play();
  86. MP_RESULT     Pause();
  87. MP_RESULT     NextFrame();
  88. MP_RESULT     Stop(int redrawWindow);
  89. MP_RESULT     Close();
  90. MP_RESULT     FastForward();
  91. MP_RESULT     Rewind();
  92. MP_RESULT     Seek(int percent);
  93. MP_RESULT     MaintainImage();
  94. MP_RESULT     SetDesktopMode(BOOL on);
  95. MP_RESULT     SetVideoRect(RECT *rect);
  96. MP_RESULT     SetFullscreen(int active, HWND hwnd);
  97. MP_RESULT     SetVolume(int volume);
  98. MP_RESULT     SetLoop(int loop);
  99. };
  100. #endif