callback
From: Dave (dbg_at_012.net.il)
Date: 08/10/04
- Previous message: The March Hare (MVP): "Re: Resizing video in preproccessing"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 10 Aug 2004 06:48:44 +0200
Hi,
I an writing an application that capture live video and display it to a
window i am using monikor and it work fine.
I try to derived a class from ISampleGrabberCB and catch the event callback
BufferCB function but it didnt work why??
How can i catch the BufferCB function???
Here is my code plesh tell me what i need to do to chact this event function
(i need every step)
//----------------For cam-----------------//
IVideoWindow* m_pVWMoniker ;
IMediaControl* m_pMCMoniker ;
IMediaEventEx* m_pMEMoniker ;
ICaptureGraphBuilder2* m_pCaptureMoniker ;
IFilterGraph2* m_pFilterGraph ;// IFilterGraph2 provides
AddSourceFileForMoniker()
//------------------------------------
class SampleGrabberCallback : public ISampleGrabberCB{// Fake referance
counting.... STDMETHODIMP SampleCB(double Time, IMediaSample *pSample) {
return E_NOTIMPL; } STDMETHODIMP BufferCB(double Time, BYTE *pBuffer,
long BufferLen) { ... }}//--------------------------
SampleGrabberCallback m_callBack;
where should i use m_callBack in the code below????
HRESULT hr;
IMoniker *pMoniker =NULL;
// Create the filter graph
hr = CoCreateInstance (CLSID_FilterGraph, NULL, CLSCTX_INPROC,
IID_IFilterGraph2, (void **)
&m_pFilterGraph);
// Create the capture graph builder
hr = CoCreateInstance (CLSID_CaptureGraphBuilder2 , NULL, CLSCTX_INPROC,
IID_ICaptureGraphBuilder2, (void **)
&m_pCaptureMoniker);
// Obtain interfaces for media control and Video Window
hr = m_pFilterGraph->QueryInterface(IID_IMediaControl,(LPVOID *)
_pMCMoniker);
hr = m_pFilterGraph->QueryInterface(IID_IVideoWindow, (LPVOID *)
pVWMoniker);
hr = m_pFilterGraph->QueryInterface(IID_IMediaEvent, (LPVOID *)
m_pMEMoniker);
hr = m_pMEMoniker->SetNotifyWindow((OAHWND)m_hApp, M_GRAPHNOTIFY,0);
FindCaptureDeviceMoniker(IMoniker **ppMoniker)
{. while ((pClassEnum->Next (1.))..}//Get the capture device
IBaseFilter *pBaseFilter=0;
hr = m_pFilterGraph->AddSourceFilterForMoniker(pMoniker, pContext,
strMonikerName, &pBaseFilter);
// Attach the filter graph to the capture graph
hr = m_pCaptureMoniker->SetFiltergraph(m_pFilterGraph);
// Render the preview pin on the video capture filter
// Use this instead of m_pGraph->RenderFile
hr = m_pCaptureMoniker->RenderStream (&PIN_CATEGORY_PREVIEW,
&MEDIATYPE_Video,pBaseFilter, NULL, NULL);
SAFE_RELEASE(pContext);
SAFE_RELEASE(pBaseFilter);
// Release the IMoniker interface for the capture source filter
pMoniker->Release();
// Set video window style and position
hr = SetupVideoWindowMoniker();
// Start previewing video data
hr = m_pMCMoniker->Run();
- Previous message: The March Hare (MVP): "Re: Resizing video in preproccessing"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|