IPFilter.h
上传用户:hhs829
上传日期:2022-06-17
资源大小:586k
文件大小:2k
- //
- // Sample DirectShow In-Place Transform Filter that accepts data for use in application
- //
- #include <streams.h>
- // This is an example in-place transform filter that is created within
- // the application, and not by CoCreateInstance
- class CAppTransform : public CTransInPlaceFilter
- {
- public:
- CAppTransform(LPUNKNOWN pUnkOuter, HRESULT *phr);
- HRESULT CheckInputType(const CMediaType* mtIn);
- HRESULT Transform(IMediaSample *pSample);
- };
- // DirectShow graph management sample code:
- // This builds a playback graph using RenderFile
- // and then inserts a transform filter on the uncompressed video.
- class CAppGraphBuilder
- {
- private:
- CAppTransform* m_pFilter;
- IGraphBuilder* m_pGraph;
- DWORD m_dwObjectTable;
- public:
- CAppGraphBuilder();
- ~CAppGraphBuilder();
- void DestroyGraph(void);
- HRESULT BuildFromFile(LPCWSTR pszFile);
- HRESULT Run(void);
- HRESULT MakeChild(HWND hwnd);
- HRESULT ResizeVideoWindow(RECT* prc);
- private:
- void CreateAppFilter(void);
- HRESULT FindFilterByInterface(REFIID riid, IBaseFilter** ppFilter);
- HRESULT ConnectUpstreamOf(IBaseFilter* pFilter, IBaseFilter* pTransform);
- HRESULT NextUpstream(IBaseFilter* pFilter, IBaseFilter** ppNext);
- IPin* GetPin(IBaseFilter* pFilter, PIN_DIRECTION dirRequest);
- // Helper methods
- IPin* InputPinOf(IBaseFilter* pFilter)
- {
- return GetPin(pFilter, PINDIR_INPUT);
- }
- IPin* OutputPinOf(IBaseFilter* pFilter)
- {
- return GetPin(pFilter, PINDIR_OUTPUT);
- }
- void AddToObjectTable(void) ;
- void RemoveFromObjectTable(void);
- };