⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmsgraph.h

📁 mysee网络直播源代码Mysee Lite是Mysee独立研发的网络视频流媒体播放系统。在应有了P2P技术和一系列先进流媒体技术之后
💻 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 __MMS_GRAPH_H__
#define __MMS_GRAPH_H__

#include <dshow.h>
#include <initguid.h>


//static const GUID CLSID_TVStreamSink = 
//{ 0x1860c8d5, 0x370b, 0x4334, { 0x99, 0xf1, 0xb7, 0xc, 0x37, 0x9f, 0xac, 0x67 } };
// {B80E2143-306A-4657-BE95-82EB00AC636B}
//static const GUID IID_ITVSinkConfig = 
//{ 0xb80e2143, 0x306a, 0x4657, { 0xbe, 0x95, 0x82, 0xeb, 0x0, 0xac, 0x63, 0x6b } };


// {C2B146BB-C61D-4673-AF41-5079E6855401}
static const GUID CLSID_TVStreamSink = 
{ 0xc2b146bb, 0xc61d, 0x4673, { 0xaf, 0x41, 0x50, 0x79, 0xe6, 0x85, 0x54, 0x1 } };
// {CBF70EBA-BE80-4192-A167-2F3341248A08}
static const GUID IID_ITVSouceConfig = 
{ 0xcbf70eba, 0xbe80, 0x4192, { 0xa1, 0x67, 0x2f, 0x33, 0x41, 0x24, 0x8a, 0x8 } };


class ITVSinkConfig : public IUnknown
{
public:
	STDMETHOD_(float, GetCompressedSpeed)() PURE;
	STDMETHOD_(void, SetAudioOrVideoOnly)(BOOL isAudio) PURE;
	STDMETHOD_(void, SetParentWindow)(HWND handle) PURE;
	STDMETHOD_(LONGLONG, GetTotalBytes)() PURE;
	STDMETHOD_(BOOL, Login)(int userID, char* pass) PURE;
	STDMETHOD_(int, CheckPassword)() PURE;
	STDMETHOD_(void, SetProgramStorePath)(LPCTSTR path) PURE;
	STDMETHOD_(void, SetChannelName)(LPCTSTR astrChannelName) PURE;
	STDMETHOD_(void, GetZZLState)(int* apiState) PURE;
	STDMETHOD_(bool, EndOfStream)() PURE;
};

enum MMSSTATE {INIT = 0, RUNNING, PAUSED, STOPPED, RECONNECTING};
struct MMSGRAPHINFO
{
	string strChannelName;
	string strMMSAddr;
	float fDataRate;
	LONGLONG fTotalBytes;
	MMSSTATE mmsState;
	LONGLONG llTimeEscaped;
	INT    m_time;
	LONGLONG m_oldtotalbyte;

};

class CMMSGraph
{
public:
	
	CMMSGraph(string strChannel, string strMMSAddr, HRESULT *hr);
	~CMMSGraph();

	// graph controls
	STDMETHODIMP Initialize();
	STDMETHODIMP Run();
	STDMETHODIMP Stop();
	STDMETHODIMP Pause();
	MMSGRAPHINFO *GetMMSGraphInfo();
	string GetChannelName(){return m_pMMSInfo->strChannelName;}// for accelerating only

protected:
	// initialize & unintiliase graph
	STDMETHODIMP Uninitialize();

	STDMETHODIMP BuildGraph(bool bAssumeAudioFirst = true);
	STDMETHODIMP DisassembleGraph();

	STDMETHODIMP CreateAddFilter(CLSID clsidFilter,			   
					     IBaseFilter** ppIFilter,	
					     LPCTSTR pstrFilterName = NULL);

	STDMETHODIMP RemoveFilter(IBaseFilter* pIFilter);

	// Connects two pins together.
	// pIFilterOutput    -- A pointer to the filter that contains the output pin
	//					   to connect.
	// pstrPinNameOutput -- The name of the output pin. If it is NULL, the 
	//                      first output pin found will be connected.
	// pIFilterInput     -- A pointer to the filter that contains the input pin
	//					   to connect
	// pstrPinNameInput  -- The name of the input pin. If NULL, the first input
	//                      pin found will be connected
	// pmt				-- The media type of the connection.
    STDMETHODIMP ConnectPins(IBaseFilter* pIFilterOutput, 
						   LPCTSTR pstrPinNameOutput,
						   IBaseFilter* pIFilterInput, 
						   LPCTSTR pstrPinNameInput,
						   AM_MEDIA_TYPE* pmt = NULL);

	// Disconnects the specified pin.
	// pIFilter		-- The filter that contains the pstrPinName
	// pstrPinName   -- The name of pin be disconnected
	// dir			-- The direction of pin
	//				   PINDIR_INPUT	: input pin/PINDIR_OUTPUT : output pin
	STDMETHODIMP DisconnectPin(IBaseFilter *pIFilter, 
						     LPCTSTR pstrPinName,
						     PIN_DIRECTION dir = PINDIR_OUTPUT);

	STDMETHODIMP_(BOOL) IsConnected(IBaseFilter *pFilter,
		                            LPCTSTR pstrPinName, 
								    PIN_DIRECTION pd = PINDIR_OUTPUT);
	// Finds the specified pin on a filter.
	// pIFilter	  -- The filter that contains the pstrPinName
	// pstrPinName -- The name of pin to be find
	// dir		  -- Same with below
	STDMETHODIMP_(IPin*) FindPinOnFilter(IBaseFilter* pIFilter, 
						                 LPCTSTR pstrPinName,
						                 PIN_DIRECTION dir = PINDIR_OUTPUT);

	HRESULT FindASFHandler(string strFilterName);

protected:
	IGraphBuilder *m_pGB;         // capture graph
	IMediaControl *m_pMC;         // media control

	IBaseFilter *m_pMMSSource;
	IBaseFilter *m_pSink;
	IBaseFilter *m_pAsfAcmHandler;
	IBaseFilter *m_pAsfIcmHandler;
	IBaseFilter *m_pAudioSmartTee;

	MMSGRAPHINFO *m_pMMSInfo;

    // mms正在重新连接,可能是网络问题,也可能是切换节目
    bool m_bReconnecting;
 
	ITVSinkConfig *m_pTVConfig; // tv sink config
public :
 // 	CMMSServerDlg   *server;
 //	CMMSPool  m_MMSPool;
};

#endif //__MMS_GRAPH_H__

⌨️ 快捷键说明

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