// !!! What if changing output formats couldn't reconnect // and the graph is broken? Shouldn't be possible
if(gcap.pVSC) { AM_MEDIA_TYPE *pmt; // get format being used NOW hr = gcap.pVSC->GetFormat(&pmt);
// DV capture does not use a VIDEOINFOHEADER if(hr == NOERROR) { if(pmt->formattype == FORMAT_VideoInfo) { // resize our window to the new capture size ResizeWindow(HEADER(pmt->pbFormat)->biWidth, abs(HEADER(pmt->pbFormat)->biHeight)); } DeleteMediaType(pmt); } }
1.首先要清楚一个图像处理的基本算法
2.对MFC框架有一定的了解
3.多看代码先了解自己缺什么,先补补,然后再研究。
MFC,还是自己看一点基本的书籍吧!
hr = gcap.pBuilder->FindInterface(&PIN_CATEGORY_CAPTURE,
&MEDIATYPE_Interleaved, gcap.pVCap,
IID_IAMStreamConfig, (void **)&pSC);
if(hr != NOERROR)
hr = gcap.pBuilder->FindInterface(&PIN_CATEGORY_CAPTURE,
&MEDIATYPE_Video, gcap.pVCap,
IID_IAMStreamConfig, (void **)&pSC);
ISpecifyPropertyPages *pSpec;
CAUUID cauuid;
hr = pSC->QueryInterface(IID_ISpecifyPropertyPages,
(void **)&pSpec);
if(hr == S_OK)
{
hr = pSpec->GetPages(&cauuid);
hr = OleCreatePropertyFrame(ghwndApp, 30, 30, NULL, 1,
(IUnknown **)&pSC, cauuid.cElems,
(GUID *)cauuid.pElems, 0, 0, NULL);
// !!! What if changing output formats couldn't reconnect
// and the graph is broken? Shouldn't be possible
if(gcap.pVSC)
{
AM_MEDIA_TYPE *pmt;
// get format being used NOW
hr = gcap.pVSC->GetFormat(&pmt);
// DV capture does not use a VIDEOINFOHEADER
if(hr == NOERROR)
{
if(pmt->formattype == FORMAT_VideoInfo)
{
// resize our window to the new capture size
ResizeWindow(HEADER(pmt->pbFormat)->biWidth,
abs(HEADER(pmt->pbFormat)->biHeight));
}
DeleteMediaType(pmt);
}
}
CoTaskMemFree(cauuid.pElems);
pSpec->Release();
}
pSC->Release(); 能大概解释一下这个代码吗
至于算法你关键要找到主处理函数那里。
9.0以后的版本就没有directshow了
btw,可以找相关的群,有不少高手在里面的
directshow方面的看陆其明的书,有两本,里面有不少的代码例子qq群自己google吧