www.pudn.com > MediaPlayer.rar > CDXGraph.h


// 
// CDXGraph.h 
// 
 
#ifndef __H_CDXGraph__ 
#define __H_CDXGraph__ 
 
// Filter graph notification to the specified window 
#define WM_GRAPHNOTIFY  (WM_USER+20) 
 
 
class CDXGraph 
{ 
private: 
	IGraphBuilder *     mGraph;   
	IMediaControl *		mMediaControl; 
	IMediaEventEx *		mEvent; 
	IBasicVideo *		mBasicVideo; 
	IBasicAudio *		mBasicAudio; 
	IVideoWindow  *		mVideoWindow; 
	IMediaSeeking *		mSeeking; 
	 
	DWORD				mObjectTableEntry;  
 
public: 
	CDXGraph(); 
	virtual ~CDXGraph(); 
	//MyBmp* mBmp; 
 
public: 
	HRESULT GetFrameFromImage(unsigned char * Data); 
	clock_t start, end; 
	double Grap_Time; 
	void GetBitmapBuffer(long bitmapSize, unsigned char *buffer); 
	void GetBitmapSize(long *bitmapSize); 
	void GetBitmapInfo(unsigned char *buffer,BITMAPINFOHEADER *bmih,unsigned char *data); 
	void GetFrameInfo(long *width,long * height); 
	double GetCurrentImageInfo(unsigned char* imageData); 
	virtual bool Create(void); 
	virtual void Release(void); 
	virtual bool Attach(IGraphBuilder * inGraphBuilder); 
 
	IGraphBuilder * GetGraph(void); // Not outstanding reference count 
	IMediaEventEx * GetEventHandle(void); 
 
	bool ConnectFilters(IPin * inOutputPin, IPin * inInputPin, const AM_MEDIA_TYPE * inMediaType = 0); 
	void DisconnectFilters(IPin * inOutputPin); 
 
	bool SetDisplayWindow(HWND inWindow); 
	bool SetNotifyWindow(HWND inWindow); 
	bool ResizeVideoWindow(long inLeft, long inTop, long inWidth, long inHeight); 
	void HandleEvent(WPARAM inWParam, LPARAM inLParam); 
 
	bool Run(void);        // Control filter graph 
	bool Stop(void); 
	bool Pause(void); 
	bool IsRunning(void);  // Filter graph status 
	bool IsStopped(void); 
	bool IsPaused(void); 
 
	bool SetFullScreen(BOOL inEnabled); 
	bool GetFullScreen(void); 
 
	bool SetVideoSize(int width, int hight); 
	// IMediaSeeking 
	bool GetCurrentPosition(double * outPosition); 
	bool GetStopPosition(double * outPosition); 
	bool SetCurrentPosition(double inPosition); 
	bool SetStartStopPosition(double inStart, double inStop); 
	bool GetDuration(double * outDuration); 
	bool SetPlaybackRate(double inRate); 
 
	// Attention: range from -10000 to 0, and 0 is FULL_VOLUME. 
	bool SetAudioVolume(long inVolume); 
	long GetAudioVolume(void); 
	// Attention: range from -10000(left) to 10000(right), and 0 is both. 
	bool SetAudioBalance(long inBalance); 
	long GetAudioBalance(void); 
 
	bool RenderFile(const char * inFile); 
	bool SnapshotBitmap(const char * outFile); 
	//**************************************** 
	bool SnapshotFieldBitmap(const char * outFile); 
	void IndicateTime(int ntime, CString * strTime); 
	bool SetTimeFormat(const GUID *pFormat); 
	bool GetCurrentFrame(int* nframe); 
	bool GetCurrentImageData(unsigned char* imageData); 
	//**************************************** 
 
private: 
	void AddToObjectTable(void) ; 
	void RemoveFromObjectTable(void); 
	 
	bool QueryInterfaces(void); 
}; 
 
#endif // __H_CDXGraph__