123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- #ifndef __CSOURCE__
- #define __CSOURCE__
- class CSourceStream;
- class CSource : public CBaseFilter {
- public:
- CSource(__in_opt LPCTSTR pName, __inout_opt LPUNKNOWN lpunk, CLSID clsid, __inout HRESULT *phr);
- CSource(__in_opt LPCTSTR pName, __inout_opt LPUNKNOWN lpunk, CLSID clsid);
- #ifdef UNICODE
- CSource(__in_opt LPCSTR pName, __inout_opt LPUNKNOWN lpunk, CLSID clsid, __inout HRESULT *phr);
- CSource(__in_opt LPCSTR pName, __inout_opt LPUNKNOWN lpunk, CLSID clsid);
- #endif
- ~CSource();
- int GetPinCount(void);
- CBasePin *GetPin(int n);
-
- CCritSec* pStateLock(void) { return &m_cStateLock; }
- HRESULT AddPin(__in CSourceStream *);
- HRESULT RemovePin(__in CSourceStream *);
- STDMETHODIMP FindPin(
- LPCWSTR Id,
- __deref_out IPin ** ppPin
- );
- int FindPinNumber(__in IPin *iPin);
-
- protected:
- int m_iPins;
-
- CSourceStream **m_paStreams;
- CCritSec m_cStateLock;
- };
- class CSourceStream : public CAMThread, public CBaseOutputPin {
- public:
- CSourceStream(__in_opt LPCTSTR pObjectName,
- __inout HRESULT *phr,
- __inout CSource *pms,
- __in_opt LPCWSTR pName);
- #ifdef UNICODE
- CSourceStream(__in_opt LPCSTR pObjectName,
- __inout HRESULT *phr,
- __inout CSource *pms,
- __in_opt LPCWSTR pName);
- #endif
- virtual ~CSourceStream(void);
- protected:
- CSource *m_pFilter;
-
-
-
-
-
-
-
-
-
- virtual HRESULT FillBuffer(IMediaSample *pSamp) PURE;
-
-
-
- virtual HRESULT OnThreadCreate(void) {return NOERROR;};
- virtual HRESULT OnThreadDestroy(void) {return NOERROR;};
- virtual HRESULT OnThreadStartPlay(void) {return NOERROR;};
-
-
-
- HRESULT Active(void);
- HRESULT Inactive(void);
- public:
-
- enum Command {CMD_INIT, CMD_PAUSE, CMD_RUN, CMD_STOP, CMD_EXIT};
- HRESULT Init(void) { return CallWorker(CMD_INIT); }
- HRESULT Exit(void) { return CallWorker(CMD_EXIT); }
- HRESULT Run(void) { return CallWorker(CMD_RUN); }
- HRESULT Pause(void) { return CallWorker(CMD_PAUSE); }
- HRESULT Stop(void) { return CallWorker(CMD_STOP); }
- protected:
- Command GetRequest(void) { return (Command) CAMThread::GetRequest(); }
- BOOL CheckRequest(Command *pCom) { return CAMThread::CheckRequest( (DWORD *) pCom); }
-
- virtual DWORD ThreadProc(void);
- virtual HRESULT DoBufferProcessingLoop(void);
-
-
-
-
- virtual HRESULT CheckMediaType(const CMediaType *pMediaType);
- virtual HRESULT GetMediaType(int iPosition, __inout CMediaType *pMediaType);
-
-
-
-
- virtual HRESULT GetMediaType(__inout CMediaType *pMediaType) {return E_UNEXPECTED;}
- STDMETHODIMP QueryId(
- __deref_out LPWSTR * Id
- );
- };
- #endif
|