class CSampleGrabberCB : public ISampleGrabberCB
{
public:
// these will get set by the main thread below. We need to
// know this in order to write out the bmp
long lWidth;
long lHeight;
CCaptureToBitmap * pOwner;//这里是怎样解析的
//因为这里.h文件包括近来了
char m_szCapDir[MAX_PATH]; // the directory we want to capture to
char m_szSnappedName[MAX_PATH];
BOOL bFileWritten;
// fake out any COM ref counting
//
STDMETHODIMP_(ULONG) AddRef() { return 2; }
STDMETHODIMP_(ULONG) Release() { return 1; }
// fake out any COM QI'ing
//
STDMETHODIMP QueryInterface(REFIID riid, void ** ppv)
{
if( riid == IID_ISampleGrabberCB || riid == IID_IUnknown )
{
*ppv = (void *) static_cast<ISampleGrabberCB*> ( this );
return NOERROR;
}
return E_NOINTERFACE;
}
// we don't implement this interface for this example
//
STDMETHODIMP SampleCB( double SampleTime, IMediaSample * pSample )
{
return 0;
}
STDMETHODIMP BufferCB( double dblSampleTime, BYTE * pBuffer, long lBufferSize );
// This is the implementation function that writes the captured video
// data onto a bitmap on the user's disk.
//
BOOL CopyBitmap( double dblSampleTime, BYTE * pBuffer, long lBufferSize );