Youkoulele

Hello,

My webcam provide the I420 and IYUV. When doing this :

if(m_pmtConfig->formattype == FORMAT_VideoInfo)
{//here I enumerate the resolution availability

}
it return me the right resolution for each format, vut if I use the repective subtype GUID (MEDIASUBTYPE_IYUV) and I cannot find the I420 Mediasubtype...
I do not get any return of it.

How can I retrieve the IYUV/I420 format only

Cheers




Re: DirectShow Development IUYV

Youkoulele

Hello,

For more information, when I use in my code

Code Snippet

hr = m_pConfig->GetStreamCaps(i, &pType, reinterpret_cast<BYTE*>(&m_VideoStreamConfig));
if(hr == S_OK)
{
if((pType->majortype == MEDIATYPE_Video))
{
VIDEOINFOHEADER *pVih = reinterpret_cast<VIDEOINFOHEADER*>(pType->pbFormat);
//CComboBox *pResolution = (CComboBox*) GetDlgItem(IDC_RESOLUTION);
LONG width[20];
width[i]= m_VideoStreamConfig.MaxOutputSize.cx;
LONG height[20];
height[i] = m_VideoStreamConfig.MaxOutputSize.cy;

//Convert Long to string
int radix = 10; // base (2,8,10,16, whatever)
wchar_t bufferW[32], bufferH[32]; // temp buffer
wchar_t *Width, *Height;// pointer to an aray of //characters (string)
Width = _ltow(width[i],bufferW,radix);
Height = _ltow(height[i],bufferH,radix);

//Display the listed resolution supported by the device
CString item;
item.Format(_T("%s x %s"), Width, Height);
m_Resolution.InsertString(i, item);
}

}


The combobox list all the available resolution available for my webcam, which support I420 & IYUV.

But I want to display only the IYUV into the comboBox. So instead of

Code Snippet

if((pType->majortype == MEDIATYPE_Video))

I used
Code Snippet

if((pType->formatype == MEDIASUBTYPE_IYUV))


But the combobox display nothing!

After checking throught a debug it appears that the guid for the IYUV format is:
3032449-0000-0010-8000-00AA00389B71

How can I get this guid from the directshow library

Please reply if you have an idea. I need help

Cheers






Re: DirectShow Development IUYV

Geraint Davies

the pixel format is specified by the subtype GUID, not the format GUID. The format GUID specifies the format of the pbFormat block (ie it will normally be FORMAT_VideoInfo or similar).

G





Re: DirectShow Development IUYV

Youkoulele

Ok
thanks for the answer but how do I apply that





Re: DirectShow Development IUYV

Youkoulele

Ok I made it works,

thanks for the tips guys.

Below is my code, in case if someone is in the same trouble:
Code Snippet

if((pType->majortype == MEDIATYPE_Video) && ((pType->subtype == MEDIASUBTYPE_IYUV) || (pType->subtype == MEDIASUBTYPE_RGB24))
&& (pType->formattype == FORMAT_VideoInfo) && (pType->cbFormat >= sizeof(VIDEOINFOHEADER))
&& (pType->pbFormat != NULL))
{
VIDEOINFOHEADER *pVih = (VIDEOINFOHEADER*)pType->pbFormat;
LONG width;
LONG height;

SIZE MaxOutSize = m_VideoStreamConfig.MaxOutputSize;
width = pVih->bmiHeader.biWidth = m_VideoStreamConfig.MaxOutputSize.cx;
height = pVih->bmiHeader.biHeight = m_VideoStreamConfig.MaxOutputSize.cy;

//Convert Long to string
int radix = 10; // base (2,8,10,16, whatever)
wchar_t bufferW[32], bufferH[32]; // temp buffer
wchar_t *Width, *Height; // pointer to an array of characters (string)
Width = _ltow(width,bufferW,radix);
Height = _ltow(height,bufferH,radix);

//Display the listed resolution supported by the device
CString item;
item.Format(_T("%s x %s"), Width, Height);
m_Resolution.AddString(item);
}