home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / mac / SiteBldr / AMOVIE / SDK / _SETUP / COMMON.Z / nullnull.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-17  |  5.2 KB  |  148 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.  
  13. /* Minimal Null filter - derived from CTransInPlaceFilter.
  14.  
  15.    This filter has one input pin, one output pin and
  16.    does its transform in-place (i.e. without copying the data)
  17.    on the push thread (i.e. it is called with a buffer, which it
  18.    transforms and gives to the next filter downstream.  It is
  19.    then blocked until that filter returns.  It then returns
  20.    to its own caller).  This filter in fact does the null transform
  21.    it merely passes the data on unchanged.
  22. */
  23.  
  24. #include <streams.h>     // Active Movie (includes windows.h)
  25.  
  26. #include <initguid.h>    // declares DEFINE_GUID to declare an EXTERN_C const.
  27.  
  28. // The CLSID used by the minimal, in-place, null filter
  29. // DO NOT REUSE IT.  Run uuidgen.exe to create a new one.
  30. // {08af6540-4f21-11cf-aacb-0020af0b99a3}
  31. DEFINE_GUID(CLSID_NullNull,
  32. 0x08af6540, 0x4f21, 0x11cf, 0xaa, 0xcb, 0x00, 0x20, 0xaf, 0x0b, 0x99, 0xa3);
  33.  
  34.  
  35. // setup data
  36.  
  37. AMOVIESETUP_MEDIATYPE sudPinTypes =   { &MEDIATYPE_NULL                 // clsMajorType
  38.                                            , &MEDIASUBTYPE_NULL }  ;    // clsMinorType
  39.  
  40. AMOVIESETUP_PIN psudPins[] = { { L"Input"            // strName
  41.                                , FALSE               // bRendered
  42.                                , FALSE               // bOutput
  43.                                , FALSE               // bZero
  44.                                , FALSE               // bMany
  45.                                , &CLSID_NULL         // clsConnectsToFilter
  46.                                , L"Output"           // strConnectsToPin
  47.                                , 1                   // nTypes
  48.                                , &sudPinTypes }      // lpTypes
  49.                              , { L"Output"           // strName
  50.                                , FALSE               // bRendered
  51.                                , TRUE                // bOutput
  52.                                , FALSE               // bZero
  53.                                , FALSE               // bMany
  54.                                , &CLSID_NULL         // clsConnectsToFilter
  55.                                , L"Input"            // strConnectsToPin
  56.                                , 1                   // nTypes
  57.                                , &sudPinTypes } };   // lpTypes
  58.  
  59.  
  60. AMOVIESETUP_FILTER sudNullNull = { &CLSID_NullNull                  // clsID
  61.                                   , L"Minimal Null"                 // strName
  62.                                   , MERIT_DO_NOT_USE                // dwMerit
  63.                                   , 2                               // nPins
  64.                                   , psudPins };                     // lpPin
  65.  
  66. // CNullNull
  67. //
  68. class CNullNull
  69.     : public CTransInPlaceFilter
  70. {
  71.  
  72. public:
  73.  
  74.     static CUnknown *CreateInstance(LPUNKNOWN punk, HRESULT *phr);
  75.  
  76.     DECLARE_IUNKNOWN;
  77.  
  78.     LPAMOVIESETUP_FILTER GetSetupData()
  79.     {
  80.         return &sudNullNull;
  81.     }
  82.  
  83. private:
  84.  
  85.     // Constructor - just calls the base class constructor
  86.     CNullNull(TCHAR *tszName, LPUNKNOWN punk, HRESULT *phr)
  87.         : CTransInPlaceFilter (tszName, punk, CLSID_NullNull, phr)
  88.     { }
  89.  
  90.     // Overrides the PURE virtual Transform of CTransInPlaceFilter base class
  91.     // This is where the "real work" is done by altering *pSample.
  92.     // We do the Null transform by leaving it alone.
  93.     HRESULT Transform(IMediaSample *pSample){ return NOERROR; }
  94.  
  95.     // We accept any input type.  We'd return S_FALSE for any we didn't like.
  96.     HRESULT CheckInputType(const CMediaType* mtIn) { return S_OK; }
  97. };
  98.  
  99.  
  100.  
  101. // Needed for the CreateInstance mechanism
  102. CFactoryTemplate g_Templates[]=
  103.     {   {L"Minimal null", &CLSID_NullNull,   CNullNull::CreateInstance}
  104.     };
  105. int g_cTemplates = sizeof(g_Templates)/sizeof(g_Templates[0]);
  106.  
  107.  
  108. //
  109. // CreateInstance
  110. //
  111. // Provide the way for COM to create a CNullNull object
  112. CUnknown *CNullNull::CreateInstance(LPUNKNOWN punk, HRESULT *phr) {
  113.  
  114.     CNullNull *pNewObject = new CNullNull(NAME("Minimal, in-place, null filter"), punk, phr );
  115.     if (pNewObject == NULL) {
  116.         *phr = E_OUTOFMEMORY;
  117.     }
  118.  
  119.     return pNewObject;
  120. } // CreateInstance
  121.  
  122.  
  123. /******************************Public*Routine******************************\
  124. * exported entry points for registration and
  125. * unregistration (in this case they only call
  126. * through to default implmentations).
  127. *
  128. *
  129. *
  130. * History:
  131. *
  132. \**************************************************************************/
  133. HRESULT
  134. DllRegisterServer()
  135. {
  136.   return AMovieDllRegisterServer();
  137. }
  138.  
  139. HRESULT
  140. DllUnregisterServer()
  141. {
  142.   return AMovieDllUnregisterServer();
  143. }
  144.  
  145. // Microsoft C Compiler will give hundreds of warnings about
  146. // unused inline functions in header files.  Try to disable them.
  147. #pragma warning( disable:4514)
  148.