home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / mac / SiteBldr / AMOVIE / SDK / _SETUP / COMMON.Z / dump.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-06-08  |  3.1 KB  |  143 lines

  1. //==========================================================================;
  2. //
  3. //  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4. //  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5. //  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6. //  PURPOSE.
  7. //
  8. //  Copyright (c) 1992 - 1996  Microsoft Corporation.  All Rights Reserved.
  9. //
  10. //--------------------------------------------------------------------------;
  11. //
  12. //   Dump filter - dumps data into a file
  13. //   Note that this filter is a renderer
  14. //
  15.  
  16. class CDump;
  17.  
  18. //
  19. //  Filter object
  20. //
  21.  
  22. class CDumpFilter : public CBaseFilter
  23. {
  24. public:
  25.     // Constructor
  26.     CDumpFilter(CDump *pDump, LPUNKNOWN pUnk, CCritSec *pLock, HRESULT *phr);
  27.  
  28.     // Pin enumeration
  29.     CBasePin * GetPin(int n);
  30.     int GetPinCount();
  31.  
  32. private:
  33.     CDump * const m_pDump;
  34. };
  35.  
  36. //
  37. //  Pin object
  38. //
  39.  
  40. class CDumpInputPin : public CRenderedInputPin
  41. {
  42. public:
  43.     CDumpInputPin(CDump *pDump,
  44.                   LPUNKNOWN pUnk,
  45.                   CBaseFilter *pFilter,
  46.                   CCritSec *pLock,
  47.                   CCritSec *pReceiveLock,
  48.                   HRESULT *phr);
  49.  
  50.     // do something with this media sample
  51.     STDMETHODIMP Receive(IMediaSample *pSample);
  52.  
  53.     STDMETHODIMP EndOfStream(void);
  54.  
  55.     // check if the pin can support this specific proposed type and format
  56.     HRESULT CheckMediaType(const CMediaType *);
  57.  
  58.     // Break connection
  59.     HRESULT BreakConnect();
  60.  
  61.     // Track NewSegment
  62.     STDMETHODIMP NewSegment(
  63.                     REFERENCE_TIME tStart,
  64.                     REFERENCE_TIME tStop,
  65.                     double dRate);
  66.  
  67.  
  68. private:
  69.     CDump    * const m_pDump;
  70.     CCritSec * const m_pReceiveLock;
  71.  
  72.     REFERENCE_TIME m_tLast;
  73. };
  74.  
  75.  
  76. //
  77. //  CDump object - has filter and pin members
  78. //
  79.  
  80. class CDump : public CUnknown,
  81.               public IFileSinkFilter
  82.  
  83. {
  84.     friend class CDumpFilter;
  85.     friend class CDumpInputPin;
  86.  
  87. public:
  88.     DECLARE_IUNKNOWN
  89.  
  90.     CDump(LPUNKNOWN pUnk, HRESULT *phr);
  91.     ~CDump();
  92.  
  93.     static CUnknown *CreateInstance(LPUNKNOWN punk, HRESULT *phr);
  94.  
  95.     // setup helper
  96.     LPAMOVIESETUP_FILTER GetSetupData();
  97.  
  98.   //
  99.   // Implements the IFileSourceFilter interface
  100.   //
  101.   
  102.   STDMETHODIMP SetFileName(
  103.     LPCOLESTR pszFileName,
  104.     const AM_MEDIA_TYPE *pmt);
  105.  
  106.   STDMETHODIMP GetCurFile(
  107.     LPOLESTR * ppszFileName,
  108.     AM_MEDIA_TYPE *pmt);
  109.  
  110. private:
  111.  
  112.     // override this to say what interfaces we support where
  113.     STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv);
  114.  
  115.     // Write stuff to the file
  116.     HRESULT Write(PBYTE pbData, LONG lData);
  117.  
  118.     // Open the file
  119.     HRESULT Open(TCHAR *szFile);
  120.  
  121. private:
  122.     // Filter - contains methods for IFilter and IMediaFilter
  123.     CDumpFilter   *m_pFilter;
  124.  
  125.     // Pin
  126.     CDumpInputPin *m_pPin;
  127.  
  128.     // Locking
  129.     CCritSec       m_Lock;
  130.  
  131.     // Pin locking
  132.     CCritSec       m_ReceiveLock;
  133.  
  134.     // Position control
  135.     CPosPassThru  *m_pPosition;
  136.  
  137.     //  File
  138.     HANDLE         m_hFile;
  139.  
  140.     // output filename 
  141.     LPOLESTR m_pFileName;
  142. };
  143.