Author Topic: DirectShow transform  (Read 706 times)

adeyblue

  • Member
  • **
  • Posts: 89
    • Airesoft
Re: DirectShow transform
« Reply #30 on: July 05, 2017, 08:27:18 AM »
You can setup a callback so you don't have to poll for when the data is available (ISampleGrabberCB). You can also (if supported) step the graph one video frame at a time which can help if you just want to process without necessarily displaying the video (IVideoFrameStep).

There's an example here that uses both with code (C++), video & exe that rotates each frame of the video 90 degrees with both GDI & GDI+ and writes them out (it'll create 92 bmp files), or just the code here.

It works here but as this thread's proved, with this stuff YMMV.

Siekmanski

  • Member
  • *****
  • Posts: 1088
Re: DirectShow transform
« Reply #31 on: July 05, 2017, 09:06:27 AM »
Nice example. I'll have a closer look at the source code.

There are many ways in directshow to accomplish the same goal.
I'm trying to get a direct pointer to the bitmap data, the SampleGrabber needs an extra copy of the frame data and is just a waste of time.

The TextureRenderer filter seems to be what I'm looking for....

jj2007

  • Member
  • *****
  • Posts: 7539
  • Assembler is fun ;-)
    • MasmBasic
Re: DirectShow transform
« Reply #32 on: July 05, 2017, 09:18:11 AM »
You can setup a callback

That was our intention in the end - in windowless mode, get a pointer to the pixels, rotate as necessary, pass the pointer back to COM.

Do you have an idea if that is possible speed-wise? At 20 fps for example, only 50ms are available for the whole display, of which x may be needed for doing rotation, flipping etc.

Another option to investigate: grab the sample (which seems to be kind of a DIB ?), then BitBlt or stretchblt or whatever to the DC, and instead of letting the COM interface continue, discard the sample by passing it to the null renderer. Afterwards, Gdi+ can also do the rotation and other transformations. We could even add subtitles etc :P