コード例 #1
0
HRESULT CDXVADecoder::DisplayNextFrame()
{
	HRESULT					hr = S_FALSE;
	CComPtr<IMediaSample>	pSampleToDeliver;
	int						nPicIndex;

	nPicIndex = FindOldestFrame();
	if (nPicIndex != -1) {
		if (m_pPictureStore[nPicIndex].rtStart >= 0) {
			switch (m_nEngine) {
				case ENGINE_DXVA1 :
					// For DXVA1, query a media sample at the last time (only one in the allocator)
					hr = GetDeliveryBuffer (m_pPictureStore[nPicIndex].rtStart, m_pPictureStore[nPicIndex].rtStop, &pSampleToDeliver);
					SetTypeSpecificFlags(&m_pPictureStore[nPicIndex], pSampleToDeliver);
					if (SUCCEEDED (hr)) {
						hr = m_pAMVideoAccelerator->DisplayFrame(nPicIndex, pSampleToDeliver);
					}
					break;
				case ENGINE_DXVA2 :
					// For DXVA2 media sample is in the picture store
					m_pPictureStore[nPicIndex].pSample->SetTime (&m_pPictureStore[nPicIndex].rtStart, &m_pPictureStore[nPicIndex].rtStop);
					SetTypeSpecificFlags(&m_pPictureStore[nPicIndex], m_pPictureStore[nPicIndex].pSample);
					hr = m_pFilter->GetOutputPin()->Deliver(m_pPictureStore[nPicIndex].pSample);
					break;
			}

#if defined(_DEBUG) && 0
			static REFERENCE_TIME	rtLast = 0;
			TRACE ("Deliver : %10I64d - %10I64d   (Dur = %10I64d) {Delta = %10I64d}   Ind = %02d  Codec=%d  Ref=%d\n",
				   m_pPictureStore[nPicIndex].rtStart,
				   m_pPictureStore[nPicIndex].rtStop,
				   m_pPictureStore[nPicIndex].rtStop - m_pPictureStore[nPicIndex].rtStart,
				   m_pPictureStore[nPicIndex].rtStart - rtLast, nPicIndex,
				   m_pPictureStore[nPicIndex].nCodecSpecific,
				   m_pPictureStore[nPicIndex].bRefPicture);
			rtLast = m_pPictureStore[nPicIndex].rtStart;
#endif
		}
		m_bNeedChangeAspect = false;

		m_pPictureStore[nPicIndex].bDisplayed = true;
		if (!m_pPictureStore[nPicIndex].bRefPicture) {
			FreePictureSlot (nPicIndex);
		}
	}

	return hr;
}
コード例 #2
0
ファイル: DXVADecoder.cpp プロジェクト: Samangan/mpc-hc
void CDXVADecoder::EndOfStream()
{
	CComPtr<IMediaSample>	pSampleToDeliver;

	for (int nPicIndex=0; nPicIndex<m_nPicEntryNumber; nPicIndex++) {
		if (m_pPictureStore[nPicIndex].bInUse && !m_pPictureStore[nPicIndex].bDisplayed) {
			switch (m_nEngine) {
				// TODO - need check under WinXP on DXVA1
				/*
				case ENGINE_DXVA1 :
					if (SUCCEEDED (GetDeliveryBuffer (m_pPictureStore[nPicIndex].rtStart, m_pPictureStore[nPicIndex].rtStop, &pSampleToDeliver)) && pSampleToDeliver) {
						m_pAMVideoAccelerator->DisplayFrame(nPicIndex, pSampleToDeliver);
					}
					break;
				*/
				case ENGINE_DXVA2 :
					SetTypeSpecificFlags(&m_pPictureStore[nPicIndex], m_pPictureStore[nPicIndex].pSample);
					m_pFilter->GetOutputPin()->Deliver(m_pPictureStore[nPicIndex].pSample);
					break;
			}
		}
	}
}