cdxgraph.h

来自「DIRECTSHOW 开发指南电子书」· C头文件 代码 · 共 71 行

H
71
字号
//
// CDXGraph.h
//

#ifndef __H_CDXGraph__
#define __H_CDXGraph__

// Filter graph notification to the specified window
#define WM_GRAPHNOTIFY  (WM_USER+20)

#include <streams.h>

class CDXGraph
{
private:
	IGraphBuilder *     mGraph;
	IMediaControl *		mMediaControl;
	IMediaEventEx *		mEvent;
	IBasicVideo *		mBasicVideo;
	IBasicAudio *		mBasicAudio;
	IVideoWindow  *		mVideoWindow;
	IMediaSeeking *		mSeeking;

	DWORD				mObjectTableEntry;

public:
	CDXGraph();
	virtual ~CDXGraph();

public:
	virtual bool Create(void);
	virtual void Release(void);
	virtual bool Attach(IGraphBuilder * inGraphBuilder);

	IGraphBuilder * GetGraph(void); // Not outstanding reference count

	bool ConnectFilters(IPin * inOutputPin, IPin * inInputPin, const AM_MEDIA_TYPE * inMediaType = 0);
	void DisconnectFilters(IPin * inOutputPin);

	bool SetDisplayWindow(HWND inWindow);
	bool SetNotifyWindow(HWND inWindow);
	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 SetSyncSource(IBaseFilter * inFilter);
	bool SetDefaultSyncSource(void);

	// IMediaSeeking
	bool GetCurrentPosition(double * outPosition);
	bool SetCurrentPosition(double inPosition);
	bool GetDuration(double * outDuration);

	bool RenderFile(const char * inFile);
	bool WaitForCompletion(void);

private:
	void AddToObjectTable(void) ;
	void RemoveFromObjectTable(void);
	bool QueryInterfaces(void);
};

#endif // __H_CDXGraph__

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?