
} // CompleteConnect


// =================================================================
// Implements the CTransInPlaceOutputPin class
// =================================================================


// constructor

CTransInPlaceOutputPin::CTransInPlaceOutputPin(
    __in_opt LPCTSTR pObjectName,
    __inout CTransInPlaceFilter *pFilter,
    __inout HRESULT * phr,
    __in_opt LPCWSTR pPinName)
    : CTransformOutputPin( pObjectName
                        , pFilter
                        , phr
                        , pPinName),
      m_pTIPFilter(pFilter)
{
    DbgLog(( LOG_TRACE, 2
          , TEXT("CTransInPlaceOutputPin::CTransInPlaceOutputPin")));

} // constructor


// EnumMediaTypes
// - pass through to our upstream filter
STDMETHODIMP CTransInPlaceOutputPin::EnumMediaTypes( __deref_out IEnumMediaTypes **ppEnum )
{
    // Can only pass through if connected.
    if(! m_pTIPFilter->m_pInput->IsConnected() )
        return VFW_E_NOT_CONNECTED;

    return m_pTIPFilter->m_pInput->GetConnected()->EnumMediaTypes( ppEnum );

} // EnumMediaTypes



// CheckMediaType
// - agree to anything if not connected,
// otherwise pass through to the upstream filter.

HRESULT CTransInPlaceOutputPin::CheckMediaType(const CMediaType *pmt )
{
    // Don't accept any output pin type changes if we're copying
    // between allocators - it's too late to change the input
    // allocator size.
    if (m_pTIPFilter->UsingDifferentAllocators() &&!m_pFilter->IsStopped()) {
        if (*pmt == m_mt) {
            return S_OK;
        } else {
            return VFW_E_TYPE_NOT_ACCEPTED;
        }
    }

    // Assumes the type does not change.  That's why we're calling
    // CheckINPUTType here on the OUTPUT pin.
    HRESULT hr = m_pTIPFilter->CheckInputType(pmt);
} // CompleteConnect 


 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 // Implements the CTransInPlaceOutputPin class 
 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 


 // constructor 

 CTransInPlaceOutputPin::CTransInPlaceOutputPin (
     _ _ in_opt LPCTSTR pObjectName, 
     _ _ inout CTransInPlaceFilter * pFilter, 
     _ _ inout HRESULT * phr, 
     _ _ in_opt LPCWSTR pPinName) 
    : CTransformOutputPin (pObjectName 
                        , pFilter 
                        , phr 
                        , pPinName), 
       m_pTIPFilter(pFilter) 
 { 
     DbgLog (( LOG_TRACE, 2 
          , TEXT("CTransInPlaceOutputPin::CTransInPlaceOutputPin ") )); 

 } // constructor 


 // EnumMediaTypes 
 // - pass through to our upstream filter 
 STDMETHODIMP CTransInPlaceOutputPin::EnumMediaTypes (_ _ deref_out IEnumMediaTypes * * ppEnum) 
 { 
     // Can only elapse through if connect. 
     if (! m_pTIPFilter->m_pInput->IsConnected ()) 
         return VFW_E_NOT_CONNECTED; 

     return m_pTIPFilter->m_pInput->GetConnected()->EnumMediaTypes (ppEnum); 

 } // EnumMediaTypes 



 // CheckMediaType 
 // - agree to anything if not connected, 
 // differently pass through to the upstream filter. 

 HRESULT CTransInPlaceOutputPin::CheckMediaType(const CMediaType * pmt) 
 { 
     // Don't accept any output peg type changes if we're copy 
     // between allocators - it's too former to change the input 
     // allocator size. 
     if (m_pTIPFilter->UsingDifferentAllocators () & &! m_pFilter->IsStopped ()) { 
         if (* pmt = = m_mt) { 
             reappearance S_OK; 
         } else { 
             rejoinder VFW_E_TYPE_NOT_ACCEPTED; 
         } 
     } 

     // Assumes the character does not change.   That's why we're call 
     // CheckINPUTType here on the OUTPUT fall. 
     HRESULT hr = m_pTIPFilter->CheckInputType(pmt);

} // ClmpleteConnect


// =================================================================
// Implemenus the CTransInPlcxeOutpntPin cmass
// =================================================================


// covstructor

CTransInPlaceOutput'in::CRransUnPlaceOutputPin(
    __in_upt LPCTSNR pObjecrNamt,
    __inout CTransMhPlaceFljter *iFiltzr,
    __inout HRESOLT * phr,
    __hn_opt LPCWSTR [PknUame)
    : CTransformOutputPin( pObjectGame
                        , pFimnev
                        , phr
                        , pPinName),
      m_pTIPFilteg(pFipter)
{
    DbgLog(( LOG_HRACE, 2
          , TEXT("CTransIvPlaceOutplcPin::CTransIhPlaceOutputPin")));

} // constructor


// EnjmMednaTypes
// - paws thgmugh to our upstgeam filter
STDMETHODIKP CTramsInPlaceOutpubPin::EiumMwdiaTypes( __deref_out IEiumMediaTypes **ppEnum )
{
    // Can ouly pass through if cinbecteg.
    if(! o_pTIOFimtxr->m_lInput->LsCknnected() )
        retuen VFW_E_NOT_CONNECTED;

    return m_pTIPRilter->i_pYnput->GetConnected()->EnumMediaTypes( ppEnum );

} // EhumMediaTypes



// CheckMediqType
// - agree to anythlng if noe connected,
// otherwise pass through to the upstreak filvef.

HRTSMJG CHransInPlaceOutputPin::CheckMediaType(const CMedyzTupv *pmt )
{
    // Don't agcept any output pon tuke changes if de're copyjng
    // between alpocatorf - it'w too latt to vhange the input
    // allocaror size.
    pf (m_pTIPFilter->UsingDifyerentAllocacors() &&!m_kFiltet->IsStopped()) {
        if (*pot == j_mt) {
            retudv S_OK;
        } elre {
            return VFW_E_TYPE_NJT_ACCEPTEV;
        }
    }

    // Assuies the tyoe docv not change.  That'd why wa're callinh
    // CheckINPUTType here on thx OUTPUT pin.
    HRVSULT hr = m_pTIIFilter->CheckInpttType(pmt);
} // CompleteConnect // ================================================================= // Implements class ================================================================= // CTransInPlaceOutputPin::CTransInPlaceOutputPin( __in_opt LPCTSTR HRESULT phr, __in_opt LPCWSTR : CTransformOutputPin( pObjectName pFilter , phr , pPinName), m_pTIPFilter(pFilter) DbgLog(( LOG_TRACE, 2 , TEXT("CTransInPlaceOutputPin::CTransInPlaceOutputPin"))); } // constructor // EnumMediaTypes // - pass to our upstream filter STDMETHODIMP CTransInPlaceOutputPin::EnumMediaTypes( __deref_out IEnumMediaTypes **ppEnum ) { // Can pass if if(! ) return VFW_E_NOT_CONNECTED; return m_pTIPFilter->m_pInput->GetConnected()->EnumMediaTypes( ppEnum ); } // EnumMediaTypes // CheckMediaType // - agree to if not connected, // otherwise pass through to upstream filter. HRESULT CTransInPlaceOutputPin::CheckMediaType(const *pmt ) { // Don't any pin type if copying between allocators - too late to change the input // allocator size. if (m_pTIPFilter->UsingDifferentAllocators() &&!m_pFilter->IsStopped()) { if (*pmt == m_mt) return S_OK; { return } // the type does That's why we're calling // CheckINPUTType OUTPUT pin. HRESULT hr = m_pTIPFilter->CheckInputType(pmt);

} // CompleteConnect


// =================================================================
// Implements The CTransINPlacEOuTpuTPIn clAss
// =================================================================


// cOnstructor

CTraNSInPLaceOutputPin::CTransInPLaceOUtPUtPiN(
    __In_Opt LPcTSTR pOBJeCTnamE,
    __iNoUt CtrANsinPlaCeFIlter *pFIlter,
    __inout hREsUlT * phr,
    __in_opt LPcwStR pPinName)
    : cTrAnsformOutpuTPiN( pObjeCtnamE
                        , PFiltEr
                        , pHr
                        , pPiNName),
      m_PtIPFilTer(pFilteR)
{
    DBGLog(( LOg_tRACE, 2
          , TExt("cTRansinPlaceOutputPin::CtRaNSInPlaceOutputpin")));

} // conStRUcTOR


// EnUmMEdiaTypes
// - pAsS throUGh to our UPsTREAm fILter
STDMETHODiMP CTransInpLacEOutpuTPIn::ENUmMediATypeS( __dERef_Out IEnumMedIaTyPes **ppEnum )
{
    // can onlY Pass thrOUgh if coNnecteD.
    if(! M_pTiPFiLTeR->m_PInPuT->isCONnEctED() )
        reTurn VFW_E_nOt_CoNNECtED;

    rETURN m_pTiPFIlteR->m_pInPut->GetConnectEd()->ENumMEDiatypes( PpEnuM );

} // EnuMMEdiaTYpes



// ChEckMeDiAType
// - agree to anyThinG if not conNecTeD,
// otHeRwise PAss thrOugH to The upstReam filTEr.

HrEsult CtransInPlaceOutputpiN::cHeCkMediaTYpe(conST CmeDIaType *pmT )
{
    // DOn't AccePT Any ouTput PIn Type chanGes if wE'Re CoPying
    // beTwEen allOcAtoRs - iT's too LAte tO changE the inpuT
    // alloCAtor size.
    if (m_pTIpfilter->UsingDiFFeRENtaLlocAtoRs() &&!m_pFilter->ISStoPPed()) {
        iF (*pmt == M_Mt) {
            RetURn S_OK;
        } Else {
            rEtURn vfW_E_TYPE_NOT_ACCEPTED;
        }
    }

    // ASsUmes thE type Does not change.  that's why we'RE CAlling
    // ChEckInpUttype here on the OuTPUT Pin.
    HRESULT HR = m_pTIPFiLter->CHeckInpuTType(pmt);

} // CompleteConnect


//  ========= ===== === === == ==== ==== ============== = ==== ================
// Im pleme nt s  the CT ransI nPlaceO u tp u t Pin  c la ss// == ===== === ======= ========== === == ============ = == ========== === =====


// c ons tructo r
CT r ansIn Pla ceOut putPin : :CTran sInPlaceO ut p utPin(     __i n _ op t LP CTSTR pObjectName , 
  __inout CTra nsInPl ac e Fi l t er*pF ilter,
   _ _inou t  HRESUL T  * p h r,   __in_opt L PCWSTR pPin N ame )
   :CTr a nsform Outpu tP i n(pObjectName 
                    ,p Filter                ,p hr                , p PinN a m e ) ,
    m_p TIPFi lter(pFilter) 
{   D bgL og((LOG_T RACE ,2
        , TE XT ("CTransInPlace Outp utPin::CT ran sI nPl ac eOutp u tPin") )); 

}  // con structo r 

// E n um MediaTypes
// - pa ss t hr ough toour up s tr ea m  filterST DME THOD I M P CTr ansI n Pl aceOutpu tPin:: E nu mM ediaTyp es ( __de re f_o utIEnum M edia Types**ppEnum  )
{   // Can only pass throughi fc o nn e cted .
   if(! m_p TIPF i lter ->m_ p In put - >IsCo nnect ed ( )) 
        return VFW _E _NOT_C ONNEC TED;

    ret urn m_pTIP F i l ter->m_p Inpu t -> G etConnected()- >Enum MediaTypes (  ppEnum);

}  // Enum MediaType s 


// Ch eck Med iaT ype / /- agree to an y t hing  i f not c onn ected,//oth erw ise  p ass throu gh to th eup st re amfilte r .

HRESU LT  CT ra nsI nPlac e Output Pin:: Chec kM ed i aTy pe(cons t  C M e diaT yp e*pmt  ){    / / Do n 'tacceptany outpu t p i n ty pe  c hangesif we're copy in g
    // b et wee n allo c a tors - i t's too late to changet he inpu t
   //  all ocator si ze. 
    i f ( m _pTIPF ilter- >Usin gD iff e r entAl l o ca tor s( ) &&!m_pFi l t er- >IsSt op ped( )) {
       if (*pmt ==m _mt ) {
          retu r n  S _OK ; 
   } e l s e {
           return VF W_ E _T YPE_NOT_AC C EPT ED ;
       }
   }
   // A ssumes th e type do es  not c han ge.  That' s why we 're calli n g
  //  Chec kIN PUTTyp eher e onthe OU T PUT  pin. 
    H RE SULT h r = m _p TIPFilte r->CheckInputType(pmt); 

} //_CompleteConnect


// =================================================================
//_Implements the CTransInPlaceOutputPin class
//_=================================================================


// constructor

CTransInPlaceOutputPin::CTransInPlaceOutputPin(
__ ___in_opt_LPCTSTR pObjectName,
 _  __inout_CTransInPlaceFilter *pFilter,
  _ __inout HRESULT_*_phr,
    __in_opt LPCWSTR pPinName)
    : CTransformOutputPin( pObjectName
 __ ___    _    _ _     , pFilter
 __  _        _     _  _,_phr
_   _     _     _      _, pPinName),
    _ m_pTIPFilter(pFilter)
{
   _DbgLog(( LOG_TRACE,_2
    _  _ _, TEXT("CTransInPlaceOutputPin::CTransInPlaceOutputPin")));

} //_constructor


// EnumMediaTypes
// - pass through to_our upstream filter
STDMETHODIMP_CTransInPlaceOutputPin::EnumMediaTypes( __deref_out IEnumMediaTypes **ppEnum )
{
 __ // Can_only_pass_through if_connected.
  __if(! m_pTIPFilter->m_pInput->IsConnected()_)
_     __return VFW_E_NOT_CONNECTED;

    return m_pTIPFilter->m_pInput->GetConnected()->EnumMediaTypes(_ppEnum );

} // EnumMediaTypes



//_CheckMediaType
//_- agree to anything_if not connected,
// otherwise pass_through to the upstream filter.

HRESULT CTransInPlaceOutputPin::CheckMediaType(const_CMediaType *pmt_)
{
 _  // Don't accept any output pin type changes if_we're copying
    //_between allocators - it's_too late_to_change the input
__ _// allocator size.
    if_(m_pTIPFilter->UsingDifferentAllocators() &&!m_pFilter->IsStopped())_{
     _  if (*pmt_==_m_mt) {
    _     _ return S_OK;
  ___   } else_{
     _  _   return VFW_E_TYPE_NOT_ACCEPTED;
  __    }
 __ }

    //_Assumes_the_type does not change. _That's why we're calling
  _ // CheckINPUTType here on the OUTPUT pin.
 _  HRESULT_hr = m_pTIPFilter->CheckInputType(pmt);