Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 839041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:24:08+00:00 2026-05-15T05:24:08+00:00

I have a sample grabber hooked into my directshow graph, based on this example

  • 0

I have a sample grabber hooked into my directshow graph, based on this example http://msdn.microsoft.com/en-us/library/dd407288(VS.85).aspx the problem is that it uses one shot and buffers. I want to continuously grab samples, and i’d rather have a callback than i guess polling for the samples.

How do use the SetCallback method?

SetCallback(ISampleGrabberCB *pCallback, long WhichMethodToCallback)

how do I point pCallback to my own method?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T05:24:09+00:00Added an answer on May 15, 2026 at 5:24 am

    I come from a c# background, and thought that at some level i could just pass a reference to a method. This doesn’t seem to be case. Instead it requires you create a class the implements its interface that defines the method that it will call. You then pass an instance of the class to the filter in the SetCallback method. Certainly seems long winded in comparison to a delegate or lambda expression

    Here is an example of a class implementing ISampleGrabberCB

    class SampleGrabberCallback : public ISampleGrabberCB
    {
    public:
        // Fake referance counting.
        STDMETHODIMP_(ULONG) AddRef() { return 1; }
        STDMETHODIMP_(ULONG) Release() { return 2; }
    
        STDMETHODIMP QueryInterface(REFIID riid, void **ppvObject)
        {
            if (NULL == ppvObject) return E_POINTER;
            if (riid == __uuidof(IUnknown))
            {
                *ppvObject = static_cast<IUnknown*>(this);
                 return S_OK;
            }
            if (riid == __uuidof(ISampleGrabberCB))
            {
                *ppvObject = static_cast<ISampleGrabberCB*>(this);
                 return S_OK;
            }
            return E_NOTIMPL;
        }
    
        STDMETHODIMP SampleCB(double Time, IMediaSample *pSample)
        {
            return E_NOTIMPL;
        }
    
        STDMETHODIMP BufferCB(double Time, BYTE *pBuffer, long BufferLen)
        {
            return E_NOTIMPL;    
        }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have sample text like this: Nytimes.com One of the biggest news portals, have
I have developed sample api as jar file. This jar file contains the code
I have a DirectShow filter graph in my Delphi 6 application built with the
I have sample code like this: <div class=cart> <a onclick=addToCart('@Model.productId'); class=button><span>Add to Cart</span></a> </div>
Does anyone have sample VBS code that creates a switch statement based on whether
I have a DirectShow graph with the SampleGrabber filter doing some processing. The processing
I have sample data like this df <- data.frame(name = rep(letters[1:7], each = 24),
I have a DirectShow application written in Delphi 6 using the DSPACK component library.
I have a DirectShow application written in Delphi 6 using the DSPACK component library.
I have sample vector like this: v <- c(1, 2, 1, 3, 2, 3,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.