MCPcopy Create free account
hub / github.com/Nevcairiel/LAVFilters / FindVideoServiceConversion

Method FindVideoServiceConversion

decoder/LAVVideo/decoders/dxva2dec.cpp:437–523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

435}
436
437HRESULT CDecDXVA2::FindVideoServiceConversion(AVCodecID codec, int profile, D3DFORMAT suggestedOutput, GUID *input, D3DFORMAT *output)
438{
439 HRESULT hr = S_OK;
440
441 UINT count = 0;
442 GUID *input_list = nullptr;
443
444 /* Gather the format supported by the decoder */
445 hr = m_pDXVADecoderService->GetDecoderDeviceGuids(&count, &input_list);
446 if (FAILED(hr))
447 {
448 DbgLog((LOG_TRACE, 10, L"-> GetDecoderDeviceGuids failed with hr: %X", hr));
449 goto done;
450 }
451
452 DbgLog((LOG_TRACE, 10, L"-> Enumerating supported DXVA2 modes (count: %d)", count));
453 for (unsigned i = 0; i < count; i++)
454 {
455 const GUID *g = &input_list[i];
456 const dxva_mode_t *mode = get_dxva_mode_from_guid(g);
457 if (mode)
458 {
459 DbgLog((LOG_TRACE, 10, L" -> %S", mode->name));
460 }
461 else
462 {
463 DbgLog((LOG_TRACE, 10, L" -> Unknown GUID (%s)", WStringFromGUID(*g).c_str()));
464 }
465 }
466
467 /* Iterate over our priority list */
468 for (unsigned i = 0; dxva_modes[i].name; i++)
469 {
470 const dxva_mode_t *mode = &dxva_modes[i];
471 if (!check_dxva_mode_compatibility(mode, codec, profile, 0, (suggestedOutput == FOURCC_NV12)))
472 continue;
473
474 BOOL supported = FALSE;
475 for (const GUID *g = &input_list[0]; !supported && g < &input_list[count]; g++)
476 {
477 supported = IsEqualGUID(*mode->guid, *g);
478 }
479 if (!supported)
480 continue;
481
482 DbgLog((LOG_TRACE, 10, L"-> Trying to use '%S'", mode->name));
483 UINT out_count = 0;
484 D3DFORMAT *out_list = nullptr;
485 hr = m_pDXVADecoderService->GetDecoderRenderTargets(*mode->guid, &out_count, &out_list);
486 if (FAILED(hr))
487 {
488 DbgLog((LOG_TRACE, 10, L"-> Retrieving render targets failed with hr: %X", hr));
489 continue;
490 }
491
492 BOOL matchingFormat = FALSE;
493 D3DFORMAT format = D3DFMT_UNKNOWN;
494 DbgLog((LOG_TRACE, 10, L"-> Enumerating render targets (count: %d)", out_count));

Callers

nothing calls this directly

Calls 3

get_dxva_mode_from_guidFunction · 0.85
WStringFromGUIDFunction · 0.85

Tested by

no test coverage detected