Ejemplo n.º 1
0
void CDXVADecoder::RemoveRefFrame(int nSurfaceIndex)
{
    //ASSERT ((nSurfaceIndex < m_nPicEntryNumber) && m_pPictureStore[nSurfaceIndex].bInUse);

    m_pPictureStore[nSurfaceIndex].bRefPicture = false;
    if (m_pPictureStore[nSurfaceIndex].bDisplayed) {
        FreePictureSlot(nSurfaceIndex);
    }
}
Ejemplo n.º 2
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;
}