home *** CD-ROM | disk | FTP | other *** search
- //==========================================================================;
- //
- // 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) 1992 - 1996 Microsoft Corporation. All Rights Reserved.
- //
- //--------------------------------------------------------------------------;
- //
- // Dump filter - dumps data into a file
- // Note that this filter is a renderer
- //
-
- class CDump;
-
- //
- // Filter object
- //
-
- class CDumpFilter : public CBaseFilter
- {
- public:
- // Constructor
- CDumpFilter(CDump *pDump, LPUNKNOWN pUnk, CCritSec *pLock, HRESULT *phr);
-
- // Pin enumeration
- CBasePin * GetPin(int n);
- int GetPinCount();
-
- private:
- CDump * const m_pDump;
- };
-
- //
- // Pin object
- //
-
- class CDumpInputPin : public CRenderedInputPin
- {
- public:
- CDumpInputPin(CDump *pDump,
- LPUNKNOWN pUnk,
- CBaseFilter *pFilter,
- CCritSec *pLock,
- CCritSec *pReceiveLock,
- HRESULT *phr);
-
- // do something with this media sample
- STDMETHODIMP Receive(IMediaSample *pSample);
-
- STDMETHODIMP EndOfStream(void);
-
- // check if the pin can support this specific proposed type and format
- HRESULT CheckMediaType(const CMediaType *);
-
- // Break connection
- HRESULT BreakConnect();
-
- // Track NewSegment
- STDMETHODIMP NewSegment(
- REFERENCE_TIME tStart,
- REFERENCE_TIME tStop,
- double dRate);
-
-
- private:
- CDump * const m_pDump;
- CCritSec * const m_pReceiveLock;
-
- REFERENCE_TIME m_tLast;
- };
-
-
- //
- // CDump object - has filter and pin members
- //
-
- class CDump : public CUnknown,
- public IFileSinkFilter
-
- {
- friend class CDumpFilter;
- friend class CDumpInputPin;
-
- public:
- DECLARE_IUNKNOWN
-
- CDump(LPUNKNOWN pUnk, HRESULT *phr);
- ~CDump();
-
- static CUnknown *CreateInstance(LPUNKNOWN punk, HRESULT *phr);
-
- // setup helper
- LPAMOVIESETUP_FILTER GetSetupData();
-
- //
- // Implements the IFileSourceFilter interface
- //
-
- STDMETHODIMP SetFileName(
- LPCOLESTR pszFileName,
- const AM_MEDIA_TYPE *pmt);
-
- STDMETHODIMP GetCurFile(
- LPOLESTR * ppszFileName,
- AM_MEDIA_TYPE *pmt);
-
- private:
-
- // override this to say what interfaces we support where
- STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv);
-
- // Write stuff to the file
- HRESULT Write(PBYTE pbData, LONG lData);
-
- // Open the file
- HRESULT Open(TCHAR *szFile);
-
- private:
- // Filter - contains methods for IFilter and IMediaFilter
- CDumpFilter *m_pFilter;
-
- // Pin
- CDumpInputPin *m_pPin;
-
- // Locking
- CCritSec m_Lock;
-
- // Pin locking
- CCritSec m_ReceiveLock;
-
- // Position control
- CPosPassThru *m_pPosition;
-
- // File
- HANDLE m_hFile;
-
- // output filename
- LPOLESTR m_pFileName;
- };
-