📄 rmsource.h
字号:
#ifndef _RMSOURCE_H
#define _RMSOURCE_H
//==========================================================================;
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//
// Copyright (c) 1997 Sigma Designs.
//
//--------------------------------------------------------------------------;
#include "rmstruct.h"
#include "irmsource.h"
#include "irmsourceex.h"
// The class managing the output pin
class CRMSourceStream;
// Main object for a File Source filter
class CRMSource : public CSource
,public ISpecifyPropertyPages // for property pages support
,public CPersistStream
,public IPersistPropertyBag
,public IRMSource
{
public:
BOOL m_bDirty;
~CRMSource ();
// The only allowed way to create our source filter!
static CUnknown * WINAPI CreateInstance(LPUNKNOWN lpunk, HRESULT *phr);
// Required for IFileSourceFilter support
DECLARE_IUNKNOWN
// Overriden to say what interfaces we support where
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv);
STDMETHODIMP GetState(DWORD dwMSecs, FILTER_STATE *State);
HRESULT STDMETHODCALLTYPE SetPlayRate(DWORD rate);
HRESULT STDMETHODCALLTYPE MpegType();
// IFilterGraph* GetFilterGraph(){return m_pGraph;}
// overwritten ISpecifyPropertyPages pure virtual method to expose our property pages
STDMETHODIMP GetPages(CAUUID * pPages);
//
// CPersistStream methods
// You must override this to provide your own class id
STDMETHODIMP GetClassID(CLSID *pClsid) { *pClsid = CLSID_RMSourceFilter; return S_OK; }
// Update whenever data storage format changes
DWORD GetSoftwareVersion(void) { return 0x00010000 + SizeMax(); }
int SizeMax() { return sizeof(CRMProps);}
HRESULT WriteToStream(IStream *pStream);
HRESULT ReadFromStream(IStream *pStream);
//
// IPersistPropertyBag methods for per property persistence support
HRESULT STDMETHODCALLTYPE InitNew( void) { return S_OK; }
HRESULT STDMETHODCALLTYPE Load(
IPropertyBag __RPC_FAR *pPropBag,
IErrorLog __RPC_FAR *pErrorLog);
HRESULT STDMETHODCALLTYPE Save(
IPropertyBag __RPC_FAR *pPropBag,
BOOL fClearDirty,
BOOL fSaveAllProperties);
private:
// It is only allowed to to create these objects with CreateInstance
CRMSource (LPUNKNOWN lpunk, HRESULT *phr);
// CRMProps m_params;
HWND m_hPropPageDlg;
UINT m_activationMsg;
CRMSourceStream* m_pCrmSourceStream;
}; // CRMSource
#include "icrmstrm.h"
// CRMSourceStream manages the data flow from the output pin.
class CRMSourceStream : public CSourceStream,
public IRMSourceStream,
public IRMSourceStreamEx
{
public:
//RTSP VARIABLES
CRMSource *m_pRMSource;
HANDLE m_Event;
SOCKET m_RTPsock; // socket identifier
HANDLE m_hPingThread; // handle to the threads
CONN_DATA *m_pConnParams; // connection parameters
OGF_HEADER m_OGFhead;
IRtsp *pIRtsp;
PVOID m_props[3]; //array of properties to be saved by prop bag
IPin *outpin;
// FILE *dataout;
DECLARE_IUNKNOWN;
CRMSourceStream(HRESULT *phr, CRMSource *pParent, LPCWSTR pPinName);
~CRMSourceStream();
HRESULT STDMETHODCALLTYPE InitNew( void) { return S_OK; }
HRESULT STDMETHODCALLTYPE Save( IPropertyBag __RPC_FAR *pPropBag,
BOOL fClearDirty,
BOOL fSaveAllProperties);
HRESULT STDMETHODCALLTYPE Load( IPropertyBag __RPC_FAR *pPropBag,
IErrorLog __RPC_FAR *pErrorLog);
HRESULT STDMETHODCALLTYPE SetUpThreadProc();
STDMETHODIMP GetClassID(CLSID *pClsid) {
*pClsid = CLSID_RMSourceStreamFilter; return S_OK; }
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv);
BOOL CRMSourceStream::CRMReceive(struct tagIRtsp* This, SOCKET local_sock, int iPort, BYTE *pData, LONG lDataLen, LONG *lBytesRead, CONN_DATA *pConnData);
// IRMSourceStream methods
HRESULT STDMETHODCALLTYPE get_ConnParams(CONN_DATA **pConnParams);
HRESULT STDMETHODCALLTYPE get_pRMSource(CRMSource **pRMSource);
HRESULT STDMETHODCALLTYPE get_pRMProps(CRMProps **pRMProps);
HRESULT STDMETHODCALLTYPE get_pIRTSP(IRtsp **pIRTSP);
HRESULT STDMETHODCALLTYPE put_ConnParams(CONN_DATA connParams);
HRESULT STDMETHODCALLTYPE put_pRMSource(CRMSource crmSource);
HRESULT STDMETHODCALLTYPE put_pRMProps(CRMProps rmProps);
HRESULT STDMETHODCALLTYPE put_pIRTSP(IRtsp irtsp);
// IRMSourceStreamEx methods
HRESULT STDMETHODCALLTYPE put_ServerIp(char* szServerIp);
HRESULT STDMETHODCALLTYPE put_ServerType (int iServerType);
HRESULT STDMETHODCALLTYPE put_PlayFileName (char* szPlayFileName);
HRESULT STDMETHODCALLTYPE put_ConnectionParams (char* szServerIp, int iServerType, char* szPlayFileName);
HRESULT STDMETHODCALLTYPE StartRtsp ();
// Reads data into the supplied video frame
HRESULT FillBuffer(IMediaSample *pms);
// Ask for buffers of the size appropriate to the agreed media type
HRESULT DecideBufferSize(IMemAllocator *pIMemAlloc,
ALLOCATOR_PROPERTIES *pProperties);
// Set the agreed media type, and set up the necessary ball parameters
HRESULT SetMediaType(const CMediaType *pMediaType);
HRESULT GetMediaType(CMediaType *pmt);
HRESULT OnThreadCreate(void);
HRESULT OnThreadDestroy();
HRESULT OnThreadStartPlay(void);
protected:
DWORD ThreadProc(void); // the thread function
private:
IMemAllocator * m_pAlloc; // Memory Allocator
BOOL m_bInit;
int m_readytogo;
}; // CRMSourceStream
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -