TVSourceFilter.h
资源名称:p2p_vod.rar [点击查看]
上传用户:liguizhu
上传日期:2015-11-01
资源大小:2422k
文件大小:3k
源码类别:
P2P编程
开发平台:
Visual C++
- #ifndef __TV_STREAM_SOURCE_H__
- #define __TV_STREAM_SOURCE_H__
- class CTVStreamSource : public CSource,
- public IFileSourceFilter,
- public ISettings
- {
- friend class CTVStreamSourceVideoPin;
- friend class CTVStreamSourceAudioPin;
- friend class CTVStreamSourcePin;
- public:
- DECLARE_IUNKNOWN
- static CUnknown * WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *pHr);
- //
- public:
- //IFileSourceFilter
- STDMETHOD(Load)(LPCOLESTR pszFileName, const AM_MEDIA_TYPE *pmt);
- STDMETHOD(GetCurFile)(LPOLESTR *ppszFileName, AM_MEDIA_TYPE *pmt);
- //
- private:
- HRESULT _LoadFile(const char* filename);
- HRESULT _LoadURL(char* strURL);
- public:
- // interface ISettings
- STDMETHODIMP_(void) SetPopMsgHWND(HWND pop);
- public:
- STDMETHOD(Stop)();
- /*
- STDMETHOD(Run)(REFERENCE_TIME tStart);
- STDMETHOD(Pause)();*/
- //
- STDMETHODIMP JoinFilterGraph(IFilterGraph *pGraph, LPCWSTR pName);
- //
- IBaseFilter* FindFilterFromFriendlyName(REFCLSID clsid, string str);
- public:
- LONGLONG GetBaseRef();
- void SetBaseRef(LONGLONG llBaseRef);
- LONGLONG GetRawAudioRef();
- void SetRawAudioRef(LONGLONG llRawRef);
- private:
- CTVStreamSource(LPUNKNOWN pUnk, HRESULT *pHr);
- ~CTVStreamSource();
- static bool UpdateAndStartLocalServer();
- static bool DoesFileExist(LPCTSTR path, LPCTSTR filename);
- //
- private:
- // Overriden to say what interfaces we support where
- STDMETHOD(NonDelegatingQueryInterface)(REFIID riid, void ** ppv);
- private:
- LPWSTR m_pFileName;
- BOOL m_isAudioOnly;
- BOOL m_bUpdateComplete;
- volatile BOOL m_bCanDynamicReconnect;
- //
- CTVStreamSourceVideoPin* m_pVideoPin;
- CTVStreamSourceAudioPin* m_pAudioPin;
- //
- NetworkProxy* m_pComm;
- ZZLFileReader* m_pFileReader; // zzl文件
- //
- CCritSec m_critllBase;
- LONGLONG m_llBaseRef;//用于音视频同步
- LONGLONG m_rawAudiotime; //以音频时间为标准,进行相对粗略的同步
- //
- string m_srcname; // 资源名
- //
- OSVERSIONINFOEX osvi; // 操作系统版本信息
- public:
- //
- HANDLE m_hThread;
- unsigned m_iThreadID;
- //
- //
- static unsigned __stdcall ThreadFunc( void* pArguments );
- void AddFilterToCache();
- IFilterGraph* GetFG();
- IGraphConfig* GetGCF();
- BOOL CanDynamicReconnect(){return m_bCanDynamicReconnect;}
- //
- IBaseFilter* CreateDMO( REFCLSID clsidDMO, REFCLSID catDMO);
- HRESULT EnumFilters (IFilterGraph *pGraph);
- //
- IBaseFilter* m_pVideoRender;
- IBaseFilter* m_pAudioRender;
- //
- BOOL m_iSAddFilterToCache;
- // 切换编码的时候虽然要调用mediacontrol::stop,但是不能stop掉这个Filter
- volatile bool m_bDoRealStop;
- };
- #endif// __TV_STREAM_SOURCE_H__