1

I have a DirectShow filter written in Delphi 6 using the DSPACK component library. It is a push source video filter. The filter blocks on an event that is signaled in another thread that generates the video frames. When a frame is ready, it is written into a shared memory area that the FillBuffer() method accesses when it is unblocked. Is there a convenient DirectShow event that I can piggyback to unblock the FillBuffer() thread when the filter is being shutdown by DirectShow? If not, what is "standard practice" in this area?

Robert Oschler
  • 14,153
  • 18
  • 94
  • 227

1 Answers1

2

Standard practice is WaitForMultipleObjects function and friends. You are waiting for one of the events that unlock your FillBiffer: availability of new video frame from external source, stop request arriving to your filter etc.

Roman R.
  • 68,205
  • 6
  • 94
  • 158
  • So should I use the usual DLL Thread/Process detach Windows events to unlock FillBuffer() before shutting down, or do I need to worry about unblocking FillBuffer() at all when the DLL is shutting down? I thought there might be a dedicated DirectShow notification that filters get when a Filter is being unloaded but I guess not. – Robert Oschler Dec 25 '11 at 01:35
  • Filter graph would call filter's `Stop`, which would be forwarded to pin as pin's `Inactive`. You can override these methods in order to be able to set an event, which would be waited to in `FillBuffer` among other events, and this way you will be able to unlock on both new sample and request to stop. – Roman R. Dec 25 '11 at 09:16
  • Excellent. I'll use those methods to clean things up in the event of the filter being shut down. – Robert Oschler Dec 25 '11 at 17:04