My Project
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ParaEngine::CGraphBuilder Class Reference

Usage: LoadVideoFile before you want to play any video file. More...

#include <GraphBuilder.h>

Public Member Functions

HRESULT LoadVideoFile (LPCWSTR wFileName, bool bAudioOn)
 Loads a video file from disk. More...
 
HRESULT RunGraph ()
 Start playing the video file This will start playing a stopped video file or a paused video file. More...
 
HRESULT PauseGraph ()
 Pause a video file This will pause a playing video file. More...
 
HRESULT StopGraph ()
 Stop a video file This will stop a playing video file or a paused video file. More...
 
HRESULT Seek (double seekvalue)
 Seek a video file to a given percentage This will not affect the current state of the video file. More...
 
HRESULT RestoreDeviceObjects (LPDIRECT3DDEVICE9 pd3dDevice)
 
HRESULT InvalidateDeviceObjects ()
 
double GetCurrPos ()
 Get the current position of the video file in second. More...
 
double GetDuration ()
 Get the length in second of the video file. More...
 
long CheckMovieStatus (bool bIsRepeat)
 Check if certain event such as a complete event happens. More...
 
void CleanupDShow (void)
 
int GetWidth ()
 Get the width of frame size of the video file. More...
 
int GetHeight ()
 Get the height of frame size of the video file. More...
 
LPDIRECT3DTEXTURE9 GetTexture ()
 Update and get the texture of the current frame. More...
 
bool IsNeedCreateTexture ()
 Check if the texture has been successfully created. More...
 

Protected Member Functions

HRESULT ConnectWMVFile (LPCWSTR wFileName)
 
HRESULT ConnectOtherFile (LPCWSTR wFileName)
 

Protected Attributes

LPDIRECT3DTEXTURE9 m_pTexture
 
CComPtr< IGraphBuilder > m_pGB
 
CComPtr< IMediaControl > m_pMC
 
CComPtr< IMediaPosition > m_pMP
 
CComPtr< IMediaEvent > m_pME
 
IFileSourceFilter * m_pFileSource
 
CComPtr< IPin > m_pPinOut1
 
CComPtr< IPin > m_pPinOut0
 
CComPtr< IBaseFilter > m_pRenderer1
 
CTextureRendererm_pRenderer
 
bool m_bLocked
 
bool m_bAudioOn
 

Detailed Description

Usage: LoadVideoFile before you want to play any video file.

If you want to load other file, call LoadVideoFile again. When the device gets invalidate or restore, call RestoreDeviceObjects and InvalidateDeviceObjects respectively. The loaded video file will not get lost in this process. So you don't need to reload the file again.

Member Function Documentation

§ CheckMovieStatus()

long CGraphBuilder::CheckMovieStatus ( bool  bIsRepeat)

Check if certain event such as a complete event happens.

This will not affect the current state of the video file.

Parameters
bIsRepeatwhether to repeat the file from the beginning if it is completed.
Returns
: return the event code if success. If there is no event or an error occurs, this function returns 0;
Remarks
: make sure you have successfully loaded a video file. Otherwise, the function will return 0. If bIsRepeat is set true, this function will automatically reset the playing position to 0.

§ GetCurrPos()

double CGraphBuilder::GetCurrPos ( )

Get the current position of the video file in second.

This will not affect the current state of the video file.

Returns
: return the current second if success, 0 otherwise.
Remarks
: make sure you have successfully loaded a video file. Otherwise, the function will return 0.

§ GetDuration()

double CGraphBuilder::GetDuration ( )

Get the length in second of the video file.

This will not affect the current state of the video file.

Returns
: return the current second if success, 0 otherwise.
Remarks
: make sure you have successfully loaded a video file. Otherwise, the function will return 0.

§ GetHeight()

int CGraphBuilder::GetHeight ( )

Get the height of frame size of the video file.

Returns
: return the height if success. If an error occurs, this function returns 0;
Remarks
: make sure you have successfully loaded a video file. Otherwise, the function will return 0.

§ GetTexture()

LPDIRECT3DTEXTURE9 CGraphBuilder::GetTexture ( )

Update and get the texture of the current frame.

Returns
: return a pointer to the texture. If an error occurs, this function returns NULL.
Remarks
: make sure you have successfully loaded a video file. Otherwise, the function will return NULL.

§ GetWidth()

int CGraphBuilder::GetWidth ( )

Get the width of frame size of the video file.

Returns
: return the width if success. If an error occurs, this function returns 0;
Remarks
: make sure you have successfully loaded a video file. Otherwise, the function will return 0.

§ IsNeedCreateTexture()

bool ParaEngine::CGraphBuilder::IsNeedCreateTexture ( )
inline

Check if the texture has been successfully created.

If not, load the video file again.

Returns
: true if the texture is created, false if not.

§ LoadVideoFile()

HRESULT CGraphBuilder::LoadVideoFile ( LPCWSTR  wFileName,
bool  bAudioOn 
)

Loads a video file from disk.

Parameters
wFileNamethe input file name, in Unicode
bAudioOnwhether to allow audio output.
pTexMutexfor sharing the texture.
Returns
: return S_OK if success, error code otherwise.
Remarks
: this function will also creates the render texture for the loaded video file.

§ PauseGraph()

HRESULT CGraphBuilder::PauseGraph ( )

Pause a video file This will pause a playing video file.

Returns
: return S_OK if success, error code otherwise.
Remarks
: make sure you have successfully loaded a video file. Otherwise, the function will return E_FAIL or other error codes.

§ RunGraph()

HRESULT CGraphBuilder::RunGraph ( )

Start playing the video file This will start playing a stopped video file or a paused video file.

Returns
: return S_OK if success, error code otherwise.
Remarks
: make sure you have successfully loaded a video file. Otherwise, the function will return E_FAIL or other error codes.

§ Seek()

HRESULT CGraphBuilder::Seek ( double  seekvalue)

Seek a video file to a given percentage This will not affect the current state of the video file.

Parameters
seekvaluethe percentage of the video file you want to seek to. The range is 0 to 100.
Returns
: return S_OK if success, error code otherwise.
Remarks
: make sure you have successfully loaded a video file. Otherwise, the function will return E_FAIL or other error codes.

§ StopGraph()

HRESULT CGraphBuilder::StopGraph ( )

Stop a video file This will stop a playing video file or a paused video file.

The video position is reset to the beginning.

Returns
: return S_OK if success, error code otherwise.
Remarks
: make sure you have successfully loaded a video file. Otherwise, the function will return E_FAIL or other error codes.

The documentation for this class was generated from the following files: