Bonjour,

J'utilise actuellement directshow afin d'utiliser ma webcam comme un camescope. Je souhaitera par ailleurs pouvoir changer les paramètres suivant:

- format vidéo c'est à dire passer du format RGB24 en I420 ou un autre format plus fluide.

- jouer sur les paramètres de saturation du capteur.

J'ai testé le code (ci-dessous) donné dans l'aide de directshow pour justement configurer ces paramètres. Mais à la fonction FindInterface(), le HRESULT retourné est E_NOINTERFACE, alors que j'arrive à configurer le format vidéo et les autres paramètres via GraphEdit.

Pourriez vous m'aiguillez sur le sujet, je suis un peu perdu j'ai peut etre oublié quelque chose ?

Merci d'avance pour votre aide.


g_pControl->Stop();
IAMStreamConfig *pConfig = NULL;
HRESULT hr = g_pCapture->FindInterface(
&PIN_CATEGORY_PREVIEW, // Preview pin.
0, // Any media type.
pCap, // Pointer to the capture filter.
IID_IAMStreamConfig, (void**)&pConfig);

int iCount = 0, iSize = 0;
hr = pConfig->GetNumberOfCapabilities(&iCount, &iSize);

// Check the size to make sure we pass in the correct structure.
if (iSize == sizeof(VIDEO_STREAM_CONFIG_CAPS))
{
// Use the video capabilities structure.

for (int iFormat = 0; iFormat < iCount; iFormat++)
{
VIDEO_STREAM_CONFIG_CAPS scc;
AM_MEDIA_TYPE *pmtConfig;
hr = pConfig->GetStreamCaps(iFormat, &pmtConfig, (BYTE*)&scc);
if (SUCCEEDED(hr))
{
/* Examine the format, and possibly use it. */
hr = pConfig->SetFormat(pmtConfig);
pmtConfig->subtype = MEDIASUBTYPE_RGB24;
// Delete the media type when you are done.
//DeleteMediaType(pmtConfig);
}
}
g_pControl->Run();