rgalgon

I'm working on modifying Marcus Perryman's TimedCameraCapture system for Windows Mobile: http://blogs.msdn.com/marcpe/archive/2006/05/23/604771.aspx.

I need to be able to change the resolution of something being captured. All my research has told me that I need to use IAMStreamConfig to essentially enumerate the supported resolutions and then use SetFormat on them. However I have not been able to get this to work at all.
After adding a Still Image Filter I then try and change the resolution and then call RenderStream.

Here's what I'm trying:

IAMStreamConfig *pConfig;
CHK( m_pCaptureGraphBuilder->FindInterface(&PIN_CATEGORY_CAPTURE,&MEDIATYPE_Video,m_pVideoCaptureFilter, IID_IAMStreamConfig, (void**)&pConfig));
int iCount, iSize;
VIDEO_STREAM_CONFIG_CAPS caps;
pConfig->GetNumberOfCapabilities(&iCount, &iSize);
if( sizeof(caps) != iSize ) {
// not what I was expecting
return E_FAIL;
}

//Get the formats
for(int i=0; i < iCount; i++) {
AM_MEDIA_TYPE *pmt;
if( pConfig->GetStreamCaps(0, &pmt, reinterpret_cast<BYTE*>(&caps)) == S_OK ) {
//Successfully loaded a config into pmt
if(caps.MaxOutputSize.cx > 600 ) {
if(FAILED(pConfig->SetFormat(pmt))) {
//Shucks
}
DeleteMediaType(pmt);
break;
}
DeleteMediaType(pmt);
}}

For this case I'm just trying to get anything above 600. Currently capturing at 160x120.

Any ideas


Re: DirectShow Development Proper use of IAMStreamConfig to Change Resolution

LGS

Are you doing this before or after you connect the pins

Also, does your device *support* anything above 600 What error are you getting





Re: DirectShow Development Proper use of IAMStreamConfig to Change Resolution

rgalgon

Its a SmartPhone running WM 5.0.
It has a 1+ megapixel camera
This is immediately before I use RenderStream to tie everything together

I'm just using a modified version of that article I linked to above, basically I just set a timer and every x seconds it takes a picture. There's no error message it just simply doesn't work, ie the application never takes any pictures just hangs there pretending to run.




Re: DirectShow Development Proper use of IAMStreamConfig to Change Resolution

rgalgon

Resolutions supported, according the phone's camera software, are:
  • 160x120 (what I can currently capture)
  • 320x240
  • 640x480
  • 1280x1024





Re: DirectShow Development Proper use of IAMStreamConfig to Change Resolution

LGS

Can you build your graph in GraphEdt (using property pages to set the desired values)





Re: DirectShow Development Proper use of IAMStreamConfig to Change Resolution

rgalgon

Not really sure how to use Graphedt, I've been playing around with it but can't seem to find some of the filters, such as the camera driver and such. However I managed to combine Perryman's code with the WiMoBot's Camera code and now I have figured out how to use it and modify it to my needs.




Re: DirectShow Development Proper use of IAMStreamConfig to Change Resolution

Bartheq

Hi,

To set the frame size of the video you have to add following lines before pConfig->SetFormat(pmt):

VIDEOINFOHEADER *pVih = (VIDEOINFOHEADER*)pmt.pbFormat;
pVih->bmiHeader.biWidth = 640; //Or any other valid width
pVih->bmiHeader.biHeight = 480;
pVih->bmiHeader.biSizeImage = DIBSIZE(pVih->bmiHeader);



Best Regards,
Bartek Wlodarczyk
DirectShow Freelance Developer