Metodo IKsPin::KsQueryMediums
[La funzionalità associata a questa pagina, DirectShow, è una funzionalità legacy. È stata sostituita da MediaPlayer, FMMediaEngine e Audio/Video Capture in Media Foundation. Queste funzionalità sono state ottimizzate per Windows 10 e Windows 11. Microsoft consiglia vivamente che il nuovo codice usi MediaPlayer, FMMediaEngine e Audio/Video Capture in Media Foundation anziché DirectShow, quando possibile. Microsoft suggerisce che il codice esistente che usa le API legacy venga riscritto per usare le nuove API, se possibile.
Il KsQueryMediums
metodo recupera i supporti supportati da un pin.
Sintassi
HRESULT KsQueryMediums(
[out] KSMULTIPLE_ITEM **ppmi
);
Parametri
-
ppmi [out]
-
Indirizzo di un puntatore a una struttura KSMULTIPLE_ITEM .
Valore restituito
Se il metodo ha esito positivo, viene restituito S_OK. Se ha esito negativo, restituisce un codice di errore HRESULT .
Commenti
Questo metodo restituisce una struttura KSMULTIPLE_ITEM allocata dall'attività, seguita da zero o più strutture REGPINMEDIUM . Il membro Count della struttura KSMULTIPLE_ITEM specifica il numero di strutture REGPINMEDIUM . Ogni struttura REGPINMEDIUM definisce un supporto supportato dal pin.
Il chiamante deve liberare le strutture restituite usando la funzione CoTaskMemFree .
È necessario includere Ks.h prima di Ksproxy.h.
Esempio
La funzione helper seguente tenta di corrispondere a un pin rispetto a un supporto specificato.
HRESULT FindMatchingMedium(
IPin *pPin,
REGPINMEDIUM *pMedium,
bool *pfMatch)
{
IKsPin* pKsPin = NULL;
KSMULTIPLE_ITEM *pmi;
*pfMatch = false;
HRESULT hr = pPin->QueryInterface(IID_IKsPin, (void **)&pKsPin);
if (FAILED(hr))
return hr; // Pin does not support IKsPin.
hr = pKsPin->KsQueryMediums(&pmi);
pKsPin->Release();
if (FAILED(hr))
return hr; // Pin does not support mediums.
if (pmi->Count)
{
// Use pointer arithmetic to reference the first medium structure.
REGPINMEDIUM *pTemp = (REGPINMEDIUM*)(pmi + 1);
for (ULONG i = 0; i < pmi->Count; i++, pTemp++)
{
if (pMedium->clsMedium == pTemp->clsMedium)
{
*pfMatch = true;
break;
}
}
}
CoTaskMemFree(pmi);
return S_OK;
}
Requisiti
Requisito | Valore |
---|---|
Client minimo supportato |
Windows 2000 Professional [solo app desktop] |
Server minimo supportato |
Windows 2000 Server [solo app desktop] |
Intestazione |
|
Libreria |
|
Vedi anche