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

📄 pushsource.h

📁 MP4播放程序,好的很~~~喜欢就拿去
💻 H
字号:
     //------------------------------------------------------------------------------
// File: PushSource.H
// Desc: DirectShow sample code - In-memory push mode source filter
// Copyright (c) Microsoft Corporation.  All rights reserved.
//------------------------------------------------------------------------------

// UNITS = 10 ^ 7  
// UNITS / 30 = 30 fps;
// UNITS / 20 = 20 fps, etc
#include "iflytype.h"	// Added by ClassView
#include "INetParams.h"
const REFERENCE_TIME FPS_30 = UNITS / 30;
const REFERENCE_TIME FPS_20 = UNITS / 20;
const REFERENCE_TIME FPS_10 = UNITS / 10;
const REFERENCE_TIME FPS_5  = UNITS / 5;
const REFERENCE_TIME FPS_4  = UNITS / 4;
const REFERENCE_TIME FPS_3  = UNITS / 3;
const REFERENCE_TIME FPS_2  = UNITS / 2;
const REFERENCE_TIME FPS_1  = UNITS / 1;
const REFERENCE_TIME rtDefaultFrameLength = FPS_10;

// Filter name strings
#define g_wszPushSource L"iFly Net Source(Push)"
//类型申明:
struct ifly_mediarcv_t;
struct FRAMEHDR;
class CNetPushSource;

class CNetPushSourcePin: public CSourceStream, public IiFlyNetParams
{
	friend class CNetPushSource;
protected:
	int m_iMaxH;
	int m_iMaxW;
	int m_iVideoTrack;
	CRefTime m_rtSampleTime;	        // The time stamp for each sample
	int m_iFrameNumber;
	REFERENCE_TIME m_rtFrameLength;
	CCritSec m_cSharedState;            // Protects our internal state
  BOOL m_bDiscontinuity; //If true, set the discontinuity flag.
public:
	HANDLE m_hEvent;
  FRAMEHDR* m_VidoeHeader;
  ifly_mediarcv_t* g_pMediaRcv;
  //CVideoQueue m_VideoQueue;
  int m_iRcvFNum;//=0;
  BYTE* m_pVideoData;
	WORD m_wRtpPort;
	UINT m_wRtpAddr;
	CNetPushSourcePin(HRESULT *phr, CSource *pFilter);
	~CNetPushSourcePin();
  virtual HRESULT DoBufferProcessingLoop(void);    // the loop executed whilst running
	STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,void** ppv);
	// Override the version that offers exactly one media type
	HRESULT GetMediaType(CMediaType *pMediaType);
	HRESULT DecideBufferSize(IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *pRequest);
	HRESULT FillBuffer(IMediaSample *pSample);
  // Resets the stream time to zero
  virtual HRESULT OnThreadCreate(void);
  virtual HRESULT OnThreadStartPlay(void);
  virtual HRESULT OnThreadDestroy(void);
  //Override IFlySetFileName Interface:
  STDMETHODIMP put_RtpPort(const TCHAR* inRtpPort, UINT inStrLength);
  STDMETHODIMP get_RtpPort(TCHAR* outRtpPort, UINT* outBufLength);
  STDMETHODIMP put_VideoHeight(const UINT inVideoHeight);
	STDMETHODIMP get_VideoHeight(UINT* outVideoHeight);
	STDMETHODIMP put_VideoWidth(const UINT inVideoWidth);
	STDMETHODIMP get_VideoWidth(UINT* outVideoWidth);
  DECLARE_IUNKNOWN;
};

class CNetPushSource: public CSource, public ISpecifyPropertyPages, public IFileSourceFilter
{
protected:
	// Constructor is private because you have to use CreateInstance
	CNetPushSource(IUnknown *pUnk, HRESULT *phr);
	~CNetPushSource();
	CNetPushSourcePin *m_pPin;
	LPTSTR m_ptsURL;
  CMediaType m_mt;
public:
	static CUnknown * WINAPI CreateInstance(IUnknown *pUnk, HRESULT *phr);
  STDMETHODIMP Pause();
  STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
	//Override ISpecifyPropertyPages Interface:
	STDMETHODIMP GetPages(CAUUID *pPages);
	//Override IFileSourceFilter Interface:
  STDMETHODIMP Load(/*[in]*/LPCOLESTR pszFileName, /*[unique][in]*/const AM_MEDIA_TYPE *pmt);
  STDMETHODIMP GetCurFile(/*[out]*/LPOLESTR* ppszFileName, /*[out]*/AM_MEDIA_TYPE *pmt);
  DECLARE_IUNKNOWN;
};

⌨️ 快捷键说明

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