STDMETHODIMP CStreamSwitcherAllocator::GetBuffer( IMediaSample** ppBuffer, REFERENCE_TIME* pStartTime, REFERENCE_TIME* pEndTime, DWORD dwFlags) { HRESULT hr = VFW_E_NOT_COMMITTED; if (!m_bCommitted) { return hr; } /* TRACE(_T("CStreamSwitcherAllocator::GetBuffer m_pPin->m_evBlock.Wait() + %x\n"), this); m_pPin->m_evBlock.Wait(); TRACE(_T("CStreamSwitcherAllocator::GetBuffer m_pPin->m_evBlock.Wait() - %x\n"), this); */ if (m_fMediaTypeChanged) { if (!m_pPin || !m_pPin->m_pFilter) { return hr; } CStreamSwitcherOutputPin* pOut = (static_cast<CStreamSwitcherFilter*>(m_pPin->m_pFilter))->GetOutputPin(); if (!pOut || !pOut->CurrentAllocator()) { return hr; } ALLOCATOR_PROPERTIES Properties, Actual; if (FAILED(pOut->CurrentAllocator()->GetProperties(&Actual))) { return hr; } if (FAILED(GetProperties(&Properties))) { return hr; } if (!m_bCommitted || Properties.cbBuffer < Actual.cbBuffer) { Properties.cbBuffer = Actual.cbBuffer; if (FAILED(Decommit())) { return hr; } if (FAILED(SetProperties(&Properties, &Actual))) { return hr; } if (FAILED(Commit())) { return hr; } ASSERT(Actual.cbBuffer >= Properties.cbBuffer); if (Actual.cbBuffer < Properties.cbBuffer) { return hr; } } } hr = CMemAllocator::GetBuffer(ppBuffer, pStartTime, pEndTime, dwFlags); if (m_fMediaTypeChanged && SUCCEEDED(hr)) { (*ppBuffer)->SetMediaType(&m_mt); m_fMediaTypeChanged = false; } return hr; }
//------------------------------------------------------------------------------ // Destructor // CCustomAllocator::~CCustomAllocator(void) { Decommit(); ReallyFree(); if (m_hSemFree) { EXECUTE_ASSERT(CloseHandle(m_hSemFree)); } }
//---------------------------------------------------------------------------- //! @brief CBaseAllocator::Decommitをコールしなければならないので、コールする。 //---------------------------------------------------------------------------- TBufferRendererAllocator::~TBufferRendererAllocator() { Decommit(); ASSERT(m_lAllocated == m_lFree.GetCount()); // Free up all the CMediaSamples CMediaSample *pSample; for(;;) { pSample = m_lFree.RemoveHead(); if( pSample != NULL ) delete pSample; else break; } m_lAllocated = 0; }
CDXVA2Allocator::~CDXVA2Allocator() { Decommit(); }
CPacketAllocator::~CPacketAllocator(void) { Decommit(); ReallyFree(); }