callback

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Dave (dbg_at_012.net.il)
Date: 08/10/04

  • Next message: Tim Roberts: "Re: Time code for frame"
    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();


  • Next message: Tim Roberts: "Re: Time code for frame"

    Relevant Pages

    • Re: Video snapshot is not captured with bitblt sometimes
      ... the paint window around the screen, the image was only an overlay and was not ... than one DV file and the others do seem to render, ... I don't know how other video hardware handle this situation, ... When you pause are you able to capture ...
      (microsoft.public.win32.programmer.gdi)
    • Hangs after clicking on "Capture from video device" + other probs
      ... video card, an Angel TV tuner card, and an SB Audigy 2ZS Audio ... problems with WMM right from the beginning. ... This time when I click on "Capture from video device", ... window appears, saying "The video device is currently in use. ...
      (microsoft.public.windowsxp.moviemaker)
    • Re: Two Video Windows
      ... > Window" that both show the video. ... Both the Video Renderer Filter and the Filter Graph Manager ...
      (microsoft.public.win32.programmer.directx.video)
    • Re: Video snapshot is not captured with bitblt sometimes
      ... window and the video is rendered using hardware acceleration. ... When you paused video it burns in the last frame rendered by the video, ... When you pause are you able to capture ...
      (microsoft.public.win32.programmer.gdi)
    • Re: Two IVideoWindow in a dialog
      ... Have you already queried each renderer to attach each Video Window? ... >> Both the Video Renderer Filter and the Filter Graph Manager expose this ...
      (microsoft.public.win32.programmer.directx.video)