Ejemplo n.º 1
0
CWavDestFilter::CWavDestFilter(LPUNKNOWN pUnk, HRESULT* phr)
    : CTransformFilter(NAME("WavDest filter"), pUnk, __uuidof(this))
{
    if (SUCCEEDED(*phr)) {
        if (CWavDestOutputPin* pOut = DEBUG_NEW CWavDestOutputPin(this, phr)) {
            if (SUCCEEDED(*phr)) {
                m_pOutput = pOut;
            } else {
                delete pOut;
            }
        } else {
            *phr = E_OUTOFMEMORY;
            return;
        }

        if (CTransformInputPin* pIn = DEBUG_NEW CTransformInputPin(NAME("Transform input pin"), this, phr, L"In")) {
            if (SUCCEEDED(*phr)) {
                m_pInput = pIn;
            } else {
                delete pIn;
            }
        } else {
            *phr = E_OUTOFMEMORY;
            return;
        }
    }
}
CBufferFilter::CBufferFilter(LPUNKNOWN lpunk, HRESULT* phr)
	: CTransformFilter(NAME("CBufferFilter"), lpunk, __uuidof(this))
	, m_nSamplesToBuffer(2)
{
	HRESULT hr = S_OK;

	do {
		m_pInput = DNew CTransformInputPin(NAME("Transform input pin"), this, &hr, L"In");
		if (!m_pInput) {
			hr = E_OUTOFMEMORY;
		}
		if (FAILED(hr)) {
			break;
		}

		m_pOutput = DNew CBufferFilterOutputPin(this, &hr);
		if (!m_pOutput) {
			hr = E_OUTOFMEMORY;
		}
		if (FAILED(hr)) {
			delete m_pInput, m_pInput = NULL;
			break;
		}
	} while (false);

	if (phr) {
		*phr = hr;
	}
}