fork download
  1. class CPlayer : public IMFAsyncCallback
  2. {
  3. public:
  4. static HRESULT CreateInstance(
  5. HWND hVideo,
  6. HWND hEvent,
  7. CPlayer **ppPlayer
  8. );
  9.  
  10. // IUnknown methods
  11. STDMETHODIMP QueryInterface(REFIID iid, void** ppv);
  12. STDMETHODIMP_(ULONG) AddRef();
  13. STDMETHODIMP_(ULONG) Release();
  14.  
  15. // IMFAsyncCallback methods
  16. STDMETHODIMP GetParameters(DWORD*, DWORD*)
  17. {
  18. // Implementation of this method is optional.
  19. return E_NOTIMPL;
  20. }
  21. STDMETHODIMP Invoke(IMFAsyncResult* pAsyncResult);
  22.  
  23. // Playback
  24. HRESULT OpenURL(PCWSTR sURL);
  25. HRESULT Play();
  26. HRESULT Pause();
  27. HRESULT Shutdown();
  28. HRESULT HandleEvent(UINT_PTR pUnkPtr);
  29. PlayerState GetState() const { return m_state; }
  30.  
  31. // Video functionality
  32. HRESULT Repaint();
  33. HRESULT ResizeVideo(WORD width, WORD height);
  34. BOOL HasVideo() const { return (m_pVideoDisplay != NULL); }
  35.  
  36. protected:
  37.  
  38. // Constructor is private. Use static CreateInstance method to instantiate.
  39. CPlayer(HWND hVideo, HWND hEvent);
  40.  
  41. // Destructor is private. Caller should call Release.
  42. virtual ~CPlayer();
  43.  
  44. HRESULT Initialize();
  45. HRESULT CreateSession();
  46. HRESULT CloseSession();
  47. HRESULT StartPlayback();
  48. HRESULT CreateMediaSource(PCWSTR sURL);
  49. HRESULT CreateTopologyFromSource(IMFTopology **ppTopology);
  50.  
  51. HRESULT AddBranchToPartialTopology(
  52. IMFTopology *pTopology,
  53. IMFPresentationDescriptor *pSourcePD,
  54. DWORD iStream
  55. );
  56.  
  57. // Media event handlers
  58. HRESULT OnTopologyReady(IMFMediaEvent *pEvent);
  59. HRESULT OnPresentationEnded(IMFMediaEvent *pEvent);
  60.  
  61. long m_nRefCount; // Reference count.
  62.  
  63. IMFMediaSession *m_pSession;
  64. IMFMediaSource *m_pSource;
  65. IMFVideoDisplayControl *m_pVideoDisplay;
  66.  
  67. HWND m_hwndVideo; // Video window.
  68. HWND m_hwndEvent; // App window to receive events.
  69. PlayerState m_state; // Current state of the media session.
  70. HANDLE m_hCloseEvent; // Event to wait on while closing
  71. };
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:2: error: expected class-name before ‘{’ token
prog.cpp:4: error: ‘HRESULT’ does not name a type
prog.cpp:11: error: ‘STDMETHODIMP’ does not name a type
prog.cpp:12: error: ‘ULONG’ has not been declared
prog.cpp:12: error: ISO C++ forbids declaration of ‘STDMETHODIMP_’ with no type
prog.cpp:12: error: expected ‘;’ before ‘AddRef’
prog.cpp:13: error: ‘ULONG’ has not been declared
prog.cpp:13: error: ISO C++ forbids declaration of ‘STDMETHODIMP_’ with no type
prog.cpp:13: error: expected ‘;’ before ‘Release’
prog.cpp:16: error: ‘STDMETHODIMP’ does not name a type
prog.cpp:21: error: ‘STDMETHODIMP’ does not name a type
prog.cpp:24: error: ‘HRESULT’ does not name a type
prog.cpp:25: error: ‘HRESULT’ does not name a type
prog.cpp:26: error: ‘HRESULT’ does not name a type
prog.cpp:27: error: ‘HRESULT’ does not name a type
prog.cpp:28: error: ‘HRESULT’ does not name a type
prog.cpp:29: error: ‘PlayerState’ does not name a type
prog.cpp:32: error: ‘HRESULT’ does not name a type
prog.cpp:33: error: ‘HRESULT’ does not name a type
prog.cpp:34: error: ‘BOOL’ does not name a type
prog.cpp:39: error: expected `)' before ‘hVideo’
prog.cpp:44: error: ‘HRESULT’ does not name a type
prog.cpp:45: error: ‘HRESULT’ does not name a type
prog.cpp:46: error: ‘HRESULT’ does not name a type
prog.cpp:47: error: ‘HRESULT’ does not name a type
prog.cpp:48: error: ‘HRESULT’ does not name a type
prog.cpp:49: error: ‘HRESULT’ does not name a type
prog.cpp:51: error: ‘HRESULT’ does not name a type
prog.cpp:58: error: ‘HRESULT’ does not name a type
prog.cpp:59: error: ‘HRESULT’ does not name a type
prog.cpp:63: error: ISO C++ forbids declaration of ‘IMFMediaSession’ with no type
prog.cpp:63: error: expected ‘;’ before ‘*’ token
prog.cpp:64: error: ISO C++ forbids declaration of ‘IMFMediaSource’ with no type
prog.cpp:64: error: expected ‘;’ before ‘*’ token
prog.cpp:65: error: ISO C++ forbids declaration of ‘IMFVideoDisplayControl’ with no type
prog.cpp:65: error: expected ‘;’ before ‘*’ token
prog.cpp:67: error: ‘HWND’ does not name a type
prog.cpp:68: error: ‘HWND’ does not name a type
prog.cpp:69: error: ‘PlayerState’ does not name a type
prog.cpp:70: error: ‘HANDLE’ does not name a type
stdout
Standard output is empty