Hi:
I was not experience with dshow filter.
I had register the dshow filter which inheritates from
CBaseRenderer,and the code is from Gary Daniel
The only thing I know that is if I want to get the sample from the
camera,then implement the code of Dorendersample function.
as I know dorendersamle will be called automatically when the graph
from pause to run.
I have add the following code to the dorendersample function to test:
if(pMediaSample==NULL)
return S_FALSE;
else
{
pMediaSample->GetPointer(&pbData);
int l =pMediaSample->GetActualDataLength();
int *m_pCopyBuffer = new int[l];
if(pbData!=NULL)
{
pMediaSample->GetMediaType(&mt);
m_pCopyBuffer[0]=2;
FILE *fp;
fopen("\\618.txt","w");
fwrite(m_pCopyBuffer,1,1,fp);
fclose(fp);
return S_OK;
}
else
return S_FALSE;
}
after the graph run, I can get a 618.txt in my folder.but when I open
the .txt
there is nothing.
the reason of the code above is that I want to test if I get the
pointer.
I want to use CopyMemory(buffer,pbData,l),
then I can use the data in buffer to do some image processing works.
is there something wrong?

and I have add the code to the
CGraphManager::CreateCaptureGraphInternal in the CameraCapture.sln

CHK( pFilterGraph->AddFilter( gr,L"SampleGrabber"));
CHK( m_pCaptureGraphBuilder->RenderStream( &PIN_CATEGORY_STILL,
&MEDIATYPE_Video, m_pVideoCaptureFilter, NULL, gr ));
IEnumPins *pEnum = NULL;
IPin *pPin = 0;
AM_MEDIA_TYPE pmt;
m_pVideoCaptureFilter->EnumPins(&pEnum);

while (pEnum->Next(1, &pPin, NULL) == S_OK)
{
PIN_DIRECTION ThisPinDir;
pPin->QueryDirection(&ThisPinDir);
if (ThisPinDir == PINDIR_OUTPUT)
{
IPin *pTmp = 0;
hr = pPin->ConnectedTo(&pTmp);
if (SUCCEEDED(hr))
{
pTmp->Release();
pPin->ConnectionMediaType(&pmt);
}
}
}
I can get the mediatype:
major type:Video, subtype:RGB565,formattype:video_info and fix size
with 38400 and 50688
38400=160*120*2
50688 = 176*144*2
is there anyone could give me some advise.