www.pudn.com > myseelite_2007_06_28.zip > TVStreamSink.h


/* 
*  Openmysee 
* 
*  This program is free software; you can redistribute it and/or modify 
*  it under the terms of the GNU General Public License as published by 
*  the Free Software Foundation; either version 2 of the License, or 
*  (at your option) any later version. 
* 
*  This program is distributed in the hope that it will be useful, 
*  but WITHOUT ANY WARRANTY; without even the implied warranty of 
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
*  GNU General Public License for more details. 
* 
*  You should have received a copy of the GNU General Public License 
*  along with this program; if not, write to the Free Software 
*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
* 
*/ 
#ifndef __TV_STREAM_SINK_H__ 
#define __TV_STREAM_SINK_H__ 
 
#include "tvsourceconfig.h" 
#include "CaptureServer.h" 
 
class CTVStreamSinkInputPin; 
 
class CTVStreamSink : public CBaseFilter, 
	                  public IFileSinkFilter, 
					  public ITVSourceConfig 
{ 
	friend class CTVStreamSinkInputPin; 
	 
private: 
	CTVStreamSinkInputPin *m_pVideoPin;  // A simple rendered input pin 
	CTVStreamSinkInputPin *m_pAudioPin;  
 
    static CCritSec m_Lock;				// Main renderer critical section 
 
	LPWSTR   m_pFileName; 
	CaptureServer cs; 
 
	int		m_iIsStop;				//判断是否全部结束 
	int		m_iState;				//0为运行,1为停止(全部文件转化完成为停止)。-1为发生意外错误停止(用户点击Stop为意外停止) 
 
private: 
    CTVStreamSink(LPUNKNOWN pUnk, CCritSec *pLock, HRESULT *pHr); 
    virtual ~CTVStreamSink(); 
 
public: 
	DECLARE_IUNKNOWN 
	// initializator for class factory 
    static CUnknown * WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *pHr); 
 
private: 
    // Overriden to say what interfaces we support where 
    STDMETHOD(NonDelegatingQueryInterface)(REFIID riid, void ** ppv); 
 
public: 
	// overrides from CBaseFilter 
	int GetPinCount(); 
    CBasePin *GetPin(int n);	 
	STDMETHOD(Run)(REFERENCE_TIME tStart); 
    STDMETHOD(Pause)(); 
    STDMETHOD(Stop)(); 
 
	// Implements the IFileSinkFilter interface 
    STDMETHOD(SetFileName)(LPCOLESTR pszFileName,const AM_MEDIA_TYPE *pmt); 
    STDMETHOD(GetCurFile)(LPOLESTR * ppszFileName,AM_MEDIA_TYPE *pmt); 
 
	// interface ITVSourceConfig 
	STDMETHODIMP_(float) GetCompressedSpeed(); 
	STDMETHODIMP_(LONGLONG) GetTotalBytes(); 
	STDMETHODIMP_(void) SetAudioOrVideoOnly(BOOL isAudio); 
	STDMETHODIMP_(void) SetParentWindow(HWND handle); 
	STDMETHODIMP_(BOOL) Login(int userID, char* pass); 
	STDMETHODIMP_(int) CheckPassword(); 
	STDMETHODIMP_(void) SetProgramStorePath(LPCTSTR path); 
	STDMETHODIMP_(void) SetChannelName(LPCTSTR astrChannelName); 
	STDMETHODIMP_(void) GetZZLState(int* apiState); 
    STDMETHODIMP_(bool) EndOfStream(); 
 
public: 
	HRESULT WriteFormatTypeHeader(CMediaType *pmt, BOOL isAudio); 
private: 
	//创建调试信息(日志) 
	bool CreateDebugInfo(); 
}; 
 
#endif// __TV_STREAM_SINK_H__