示例#1
0
// returns S_OK if successfully connected to an IAsyncReader interface
// from this object
// Optional allocator should be proposed as a preferred allocator if
// necessary
HRESULT
CPullPin::Connect(IUnknown* pUnk, IMemAllocator* pAlloc, BOOL bSync) {
    CAutoLock lock(&m_AccessLock);

    if(m_pReader) {
        return VFW_E_ALREADY_CONNECTED;
    }

    HRESULT hr = pUnk->QueryInterface(IID_IAsyncReader, (void**)&m_pReader);
    if(FAILED(hr)) {
        return(hr);
    }

    hr = DecideAllocator(pAlloc, NULL);
    if(FAILED(hr)) {
        Disconnect();
        return hr;
    }

    LONGLONG llTotal, llAvail;
    hr = m_pReader->Length(&llTotal, &llAvail);
    if(FAILED(hr)) {
        Disconnect();
        return hr;
    }

    // convert from file position to reference time
    m_tDuration = llTotal * UNITS;
    m_tStop = m_tDuration;
    m_tStart = 0;
    m_bSync = bSync;

    return S_OK;
}
示例#2
0
/*   This is called after a media type has been proposed

Try to complete the connection by agreeing the allocator
*/
HRESULT
CBaseOutputPin::CompleteConnect(IPin *pReceivePin)
{
	UNREFERENCED_PARAMETER(pReceivePin);
	return DecideAllocator(m_pInputPin, &m_pAllocator);
}