A
download amextra.cpp
Language: C++
Copyright: (c) 1992-2002 Microsoft Corporation. All rights reserved.
LOC: 71
Project Info
UNIMATRIX Fulda(unimatrix-fulda)
Server: BerliOS
Type: cvs
...fulda\RoboScan\BaseClasses\
   activex.rcv
   activex.ver
   amextra.cpp
   amextra.h
   amfilter.cpp
   amfilter.h
   amvideo.cpp
   baseclasses.sln
   baseclasses.vcproj
   cache.h
   combase.cpp
   combase.h
   cprop.cpp
   cprop.h
   ctlutil.cpp
   ctlutil.h
   ddmm.cpp
   ddmm.h
   dllentry.cpp
   dllsetup.cpp
   dllsetup.h
   dsschedule.h
   fourcc.h
   measure.h
   msgthrd.h
   mtype.cpp
   mtype.h
   outputq.cpp
   outputq.h
   pstream.cpp
   pstream.h
   pullpin.cpp
   pullpin.h
   refclock.cpp
   refclock.h
   reftime.h
   renbase.cpp
   renbase.h
   schedule.cpp
   seekpt.cpp
   seekpt.h
   source.cpp
   source.h
   streams.h
   strmctl.cpp
   strmctl.h
   sysclock.cpp
   sysclock.h
   transfrm.cpp
   transfrm.h
   transip.cpp
   transip.h
   videoctl.cpp
   videoctl.h
   vtrans.cpp
   vtrans.h
   winctrl.cpp
   winctrl.h
   winutil.cpp
   winutil.h
   wxdebug.cpp
   wxdebug.h
   wxlist.cpp
   wxlist.h
   wxutil.cpp
   wxutil.h

//------------------------------------------------------------------------------
// File: AMExtra.cpp
//
// Desc: DirectShow base classes - implements CRenderedInputPin class.
//
// Copyright (c) 1992-2002 Microsoft Corporation.  All rights reserved.
//------------------------------------------------------------------------------


#include <streams.h>        // DirectShow base class definitions
#include <mmsystem.h>       // Needed for definition of timeGetTime
#include <limits.h>         // Standard data type limit definitions
#include <measure.h>        // Used for time critical log functions

#include "amextra.h"

#pragma warning(disable:4355)

//  Implements CRenderedInputPin class

CRenderedInputPin::CRenderedInputPin(TCHAR *pObjectName,
                                     CBaseFilter *pFilter,
                                     CCritSec *pLock,
                                     HRESULT *phr,
                                     LPCWSTR pName) :
    CBaseInputPin(pObjectName, pFilter, pLock, phr, pName),
    m_bAtEndOfStream(FALSE),
    m_bCompleteNotified(FALSE)
{
}
#ifdef UNICODE
CRenderedInputPin::CRenderedInputPin(CHAR *pObjectName,
                                     CBaseFilter *pFilter,
                                     CCritSec *pLock,
                                     HRESULT *phr,
                                     LPCWSTR pName) :
    CBaseInputPin(pObjectName, pFilter, pLock, phr, pName),
    m_bAtEndOfStream(FALSE),
    m_bCompleteNotified(FALSE)
{
}
#endif

// Flush end of stream condition - caller should do any
// necessary stream level locking before calling this

STDMETHODIMP CRenderedInputPin::EndOfStream()
{
    HRESULT hr = CheckStreaming();

    //  Do EC_COMPLETE handling for rendered pins
    if (S_OK == hr  && !m_bAtEndOfStream) {
        m_bAtEndOfStream = TRUE;
        FILTER_STATE fs;
        EXECUTE_ASSERT(SUCCEEDED(m_pFilter->GetState(0, &fs)));
        if (fs == State_Running) {
            DoCompleteHandling();
        }
    }
    return hr;
}


// Called to complete the flush

STDMETHODIMP CRenderedInputPin::EndFlush()
{
    CAutoLock lck(m_pLock);

    // Clean up renderer state
    m_bAtEndOfStream = FALSE;
    m_bCompleteNotified = FALSE;

    return CBaseInputPin::EndFlush();
}


// Notify of Run() from filter

HRESULT CRenderedInputPin::Run(REFERENCE_TIME tStart)
{
    UNREFERENCED_PARAMETER(tStart);
    m_bCompleteNotified = FALSE;
    if (m_bAtEndOfStream) {
        DoCompleteHandling();
    }
    return S_OK;
}


//  Clear status on going into paused state

HRESULT CRenderedInputPin::Active()
{
    m_bAtEndOfStream = FALSE;
    m_bCompleteNotified = FALSE;
    return CBaseInputPin::Active();
}


//  Do stuff to deliver end of stream

void CRenderedInputPin::DoCompleteHandling()
{
    ASSERT(m_bAtEndOfStream);
    if (!m_bCompleteNotified) {
        m_bCompleteNotified = TRUE;
        m_pFilter->NotifyEvent(EC_COMPLETE, S_OK, (LONG_PTR)(IBaseFilter *)m_pFilter);
    }
}

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us