![]() |
| | #1 |
| Rampaging 35 Stone Welsh Join Date: Apr 2007
Posts: 2,924
| Problem with settgin a callback under directshow Code: this->pGrabber->SetCallback(this->BufferCB , 1); Code: HRESULT CDirectShowCamera::BufferCB(double SampleTime , BYTE* pImage , long BufferLen){
// snip irrelevant guts
return S_OK;
}
Code: this->pGrabber->SetCallback(&CDirectShowCamera::BufferCB , 1); which makes even less sense. Obviously I need to be able to call this callback function, but I need it to know what instance of CDIrectShowCamera it is handling, so that it can add the sampels to the appropriate buffer. There will be more than one instance of the class operating simultaneously. I know im probably missing somethign realyl obvious.
__________________ He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet |
| abachler is online now | |
| | #2 |
| int x = *((int *) NULL); Join Date: Jul 2003 Location: Banks of the River Styx
Posts: 891
| Never worked with these, but: "You can't convert a member-function pointer to a ISampleGrabberCB *" -- is what that error says... where are you getting lost? Seems to me you should derive from ISampleGrabberCB, and implement that interface, instantiate it, and pass the instance. The derived class could hold whatever data you needed it to, such as a pointer to your CDIrectShowCamera. No different than predicates to C++'s standard functions, such as sort(), really.
__________________ long time; /* know C? */ Unprecedented performance: Nothing ever ran this slow before. Any sufficiently advanced bug is indistinguishable from a feature. Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31. The best way to accelerate an IBM is at 9.8 m/s/s. recursion (re - cur' - zhun) n. 1. (see recursion) |
| Cactus_Hugger is offline | |
| | #3 |
| Guest Join Date: Aug 2001
Posts: 4,922
| Right, assuming you've derived the class from ISampleGrabberCB and overloaded the BufferCB or SampleCB functions, you'll just need to pass a pointer to the object itself, ie: Code: this->pGrabber->SetCallback(this, 1); |
| Sebastiani is offline | |
| | #4 |
| Rampaging 35 Stone Welsh Join Date: Apr 2007
Posts: 2,924
| I tried making a derived class but the compiler pukes because there is no appropriate constructor type in the base class, and when I tried overloading the constructor it puked again saying constructors are not allowed a return type, which didnt make sense since the constructor had no return type. I think im starting to see why pointers to member functions are not used very often. I'm rethinking my strategy to possibly avoid pointers to member functions. It late and I think im messing up on implimenting the ISampleGrabberCB interface, so ill get soem sleep adn try again tomorrow.
__________________ He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet |
| abachler is online now | |
| | #5 |
| Guest Join Date: Aug 2001
Posts: 4,922
| >> I tried making a derived class but the compiler pukes because there is no appropriate constructor type in the base class, and when I tried overloading the constructor it puked again Well, you can't override a constructor. Can you post a compilable example? Last edited by Sebastiani; 06-23-2009 at 10:40 PM. |
| Sebastiani is offline | |
| | #6 | |
| C++ Witch Join Date: Oct 2003 Location: Singapore
Posts: 10,352
| Quote:
__________________ C + C++ Compiler: MinGW port of GCC Build + Version Control System: SCons + Bazaar Look up a C/C++ Reference and learn How To Ask Questions The Smart Way | |
| laserlight is offline | |
| | #7 | |
| Rampaging 35 Stone Welsh Join Date: Apr 2007
Posts: 2,924
| Quote:
Code: this->pGrabber->SetCallback(NULL , 1); this->pGrabber->SetBufferSamples(TRUE); this->Stage = 17; hr = this->pControl->Run(); if(FAILED(hr)) return; this->Stage = 0xffffffff; this->Initialized = TRUE; return;
__________________ He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet | |
| abachler is online now | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| WS_POPUP, continuation of old problem | blurrymadness | Windows Programming | 1 | 04-20-2007 06:54 PM |
| Laptop Problem | Boomba | Tech Board | 1 | 03-07-2006 06:24 PM |
| Sorting problem.. well actually more of a string problem | fatdunky | C Programming | 5 | 11-07-2005 11:34 PM |
| searching problem | DaMenge | C Programming | 9 | 09-12-2005 01:04 AM |
| half ADT (nested struct) problem... | CyC|OpS | C Programming | 1 | 10-26-2002 08:37 AM |