| 460 | } |
| 461 | |
| 462 | void CD3D11VP::SetInputVideoData(ID3D11Texture2D* pTexture, IMediaSample* pSample, UINT ArraySlice, const D3D11_VIDEO_FRAME_FORMAT vframeFormat) |
| 463 | { |
| 464 | if (m_VideoTextures.Size()) { |
| 465 | m_VideoTextures.Clear(); |
| 466 | } |
| 467 | |
| 468 | if (m_VideoInputData.Size()) { |
| 469 | if (vframeFormat == D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE) { |
| 470 | m_nInputFrameOrField++; |
| 471 | } |
| 472 | else { |
| 473 | m_nInputFrameOrField += 2; |
| 474 | } |
| 475 | if (!m_bPresentFrame) { |
| 476 | m_bPresentFrame = true; |
| 477 | } |
| 478 | else if (m_bUseFutureFrames && m_nFutureFrames < m_RateConvCaps.FutureFrames) { |
| 479 | m_nFutureFrames++; |
| 480 | } |
| 481 | else if (m_nPastFrames < m_RateConvCaps.PastFrames) { |
| 482 | m_nPastFrames++; |
| 483 | } |
| 484 | |
| 485 | m_VideoInputData.Rotate(); |
| 486 | } |
| 487 | |
| 488 | auto& texture = m_VideoInputData.GetTexture(); |
| 489 | if (texture.p != pTexture) { |
| 490 | texture = pTexture; |
| 491 | m_VideoInputData.ClearInputDecoderViews(); |
| 492 | } |
| 493 | |
| 494 | auto& inputDecoderView = m_VideoInputData.GetInputDecoderView(ArraySlice); |
| 495 | if (!inputDecoderView) { |
| 496 | D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC inputViewDesc = {}; |
| 497 | inputViewDesc.ViewDimension = D3D11_VPIV_DIMENSION_TEXTURE2D; |
| 498 | inputViewDesc.Texture2D.ArraySlice = ArraySlice; |
| 499 | auto hr = m_pVideoDevice->CreateVideoProcessorInputView(texture, m_pVideoProcessorEnum, &inputViewDesc, &inputDecoderView); |
| 500 | DLogIf(FAILED(hr), L"CD3D11VP::SetInputVideoData() : CreateVideoProcessorInputView() failed with error {}", HR2Str(hr)); |
| 501 | } |
| 502 | |
| 503 | m_VideoInputData.PushSample(pSample); |
| 504 | m_VideoInputData.SetInputView(inputDecoderView.p); |
| 505 | } |
| 506 | |
| 507 | void CD3D11VP::ResetFrameOrder() |
| 508 | { |
no test coverage detected