Controllo dei formati DXVA-HD supportati
Controllo dei formati di input supportati
Per ottenere un elenco dei formati di input supportati dal dispositivo MICROSOFT DirectX Video Acceleration High Definition (DXVA-HD), eseguire le operazioni seguenti:
- Chiamare IDXVAHD_Device::GetVideoProcessorDeviceCaps per ottenere le funzionalità del dispositivo.
- Controllare il membro InputFormatCount della struttura DXVAHD_VPDEVCAPS . Questo membro fornisce il numero di formati di input supportati.
- Allocare una matrice di valori D3DFORMAT , di dimensioni InputFormatCount.
- Passare questa matrice al metodo IDXVAHD_Device::GetVideoProcessorInputFormats . I metodi riempiono la matrice con un elenco di formati di input.
Il codice seguente illustra questi passaggi:
// Checks whether a DXVA-HD device supports a specified input format.
HRESULT CheckInputFormatSupport(
IDXVAHD_Device *pDXVAHD,
const DXVAHD_VPDEVCAPS& caps,
D3DFORMAT d3dformat
)
{
D3DFORMAT *pFormats = new (std::nothrow) D3DFORMAT[ caps.InputFormatCount ];
if (pFormats == NULL)
{
return E_OUTOFMEMORY;
}
HRESULT hr = pDXVAHD->GetVideoProcessorInputFormats(
caps.InputFormatCount,
pFormats
);
if (FAILED(hr))
{
goto done;
}
UINT index;
for (index = 0; index < caps.InputFormatCount; index++)
{
if (pFormats[index] == d3dformat)
{
break;
}
}
if (index == caps.InputFormatCount)
{
hr = E_FAIL;
}
done:
delete [] pFormats;
return hr;
}
Controllo dei formati di output supportati
Per ottenere un elenco dei formati di output supportati dal dispositivo DXVA-HD, eseguire le operazioni seguenti:
- Chiamare IDXVAHD_Device::GetVideoProcessorDeviceCaps per ottenere le funzionalità del dispositivo.
- Controllare il membro OutputFormatCount della struttura DXVAHD_VPDEVCAPS . Questo membro fornisce il numero di formati di input supportati.
- Allocare una matrice di valori D3DFORMAT , di dimensioni OutputFormatCount.
- Passare questa matrice al metodo IDXVAHD_Device::GetVideoProcessorOutputFormats . I metodi riempiono la matrice con un elenco di formati di output.
Il codice seguente illustra questi passaggi:
// Checks whether a DXVA-HD device supports a specified output format.
HRESULT CheckOutputFormatSupport(
IDXVAHD_Device *pDXVAHD,
const DXVAHD_VPDEVCAPS& caps,
D3DFORMAT d3dformat
)
{
D3DFORMAT *pFormats = new (std::nothrow) D3DFORMAT[caps.OutputFormatCount];
if (pFormats == NULL)
{
return E_OUTOFMEMORY;
}
HRESULT hr = pDXVAHD->GetVideoProcessorOutputFormats(
caps.OutputFormatCount,
pFormats
);
if (FAILED(hr))
{
goto done;
}
UINT index;
for (index = 0; index < caps.OutputFormatCount; index++)
{
if (pFormats[index] == d3dformat)
{
break;
}
}
if (index == caps.OutputFormatCount)
{
hr = E_FAIL;
}
done:
delete [] pFormats;
return hr;
}
Argomenti correlati