My Project
GraphBuilder.h
1 #pragma once
2 #include "DShowTextures.h"
3 
4 namespace ParaEngine
5 {
13  {
14  public:
15  CGraphBuilder();
16  ~CGraphBuilder();
25  HRESULT LoadVideoFile ( LPCWSTR wFileName, bool bAudioOn);
32  HRESULT RunGraph ();
39  HRESULT PauseGraph ();
46  HRESULT StopGraph ();
54  HRESULT Seek(double seekvalue);
55  HRESULT RestoreDeviceObjects(LPDIRECT3DDEVICE9 pd3dDevice);
56  HRESULT InvalidateDeviceObjects();
63  double GetCurrPos();
70  double GetDuration();
71 
80  long CheckMovieStatus(bool bIsRepeat);
81  void CleanupDShow(void);
87  int GetWidth();
93  int GetHeight();
99  LPDIRECT3DTEXTURE9 GetTexture();
100 
105  bool IsNeedCreateTexture(){return m_pTexture==NULL?true:false;}
106 
107  protected:
108  HRESULT ConnectWMVFile( LPCWSTR wFileName );
109  HRESULT ConnectOtherFile( LPCWSTR wFileName );
110  LPDIRECT3DTEXTURE9 m_pTexture;
111  CComPtr<IGraphBuilder> m_pGB;
112  CComPtr<IMediaControl> m_pMC;
113  CComPtr<IMediaPosition> m_pMP;
114  CComPtr<IMediaEvent> m_pME;
115  IFileSourceFilter* m_pFileSource;
116  CComPtr<IPin> m_pPinOut1;//for video
117  CComPtr<IPin> m_pPinOut0;//for audio
118  CComPtr<IBaseFilter> m_pRenderer1;
119  CTextureRenderer *m_pRenderer;
120  bool m_bLocked;
121  bool m_bAudioOn;
122  };
123 }
D3DFMT_X8R8G8B8 and RGB24 renderer.
Definition: dshowtextures.h:21
HRESULT RunGraph()
Start playing the video file This will start playing a stopped video file or a paused video file...
Definition: GraphBuilder.cpp:302
LPDIRECT3DTEXTURE9 GetTexture()
Update and get the texture of the current frame.
Definition: GraphBuilder.cpp:166
different physics engine has different winding order.
Definition: EventBinding.h:32
bool IsNeedCreateTexture()
Check if the texture has been successfully created.
Definition: GraphBuilder.h:105
HRESULT Seek(double seekvalue)
Seek a video file to a given percentage This will not affect the current state of the video file...
Definition: GraphBuilder.cpp:323
HRESULT PauseGraph()
Pause a video file This will pause a playing video file.
Definition: GraphBuilder.cpp:248
double GetDuration()
Get the length in second of the video file.
Definition: GraphBuilder.cpp:361
int GetWidth()
Get the width of frame size of the video file.
Definition: GraphBuilder.cpp:432
HRESULT LoadVideoFile(LPCWSTR wFileName, bool bAudioOn)
Loads a video file from disk.
Definition: GraphBuilder.cpp:55
HRESULT StopGraph()
Stop a video file This will stop a playing video file or a paused video file.
Definition: GraphBuilder.cpp:271
long CheckMovieStatus(bool bIsRepeat)
Check if certain event such as a complete event happens.
Definition: GraphBuilder.cpp:376
Usage: LoadVideoFile before you want to play any video file.
Definition: GraphBuilder.h:12
int GetHeight()
Get the height of frame size of the video file.
Definition: GraphBuilder.cpp:424
double GetCurrPos()
Get the current position of the video file in second.
Definition: GraphBuilder.cpp:346