Milivoje Stankovic
Milivoje Stankovic

Reputation: 1

How to get IDirectDrawSurface from IGraphBuilder

I pulled an all nighter trying to find the solution to this, but to no avail.

How do I get IDirectDraw, IDirectDrawSurface or even HDC handle from IGraphBuilder? Is that or something similar to that even possible ? I need to implement this so I can draw over video frames.

I tried to implement IVMRWindowlessControl and IDirectDrawVideo but none of those worked so i'm back at square one. I know about IBasicVideo::GetCurrentImage but that does not help. I do not use MFC, ATL etc... just pure win32.

Any help would be much appreciated. Thanks in advance!

Upvotes: 0

Views: 113

Answers (1)

Roman Ryltsov
Roman Ryltsov

Reputation: 69724

IGraphBuilder, or rather Filter Gragh Manager, represents a multimedia pipeline, which may or may not have video renderer in it. For example, if you play an MP3 file you have filter graph manager, but you don't have any video at all.

Then, even having video in your pipeline everything depends on what sort of video filters are in there. Specifically, if you have visual rendering, what video renderer is a part of multimedia pipeline.

With DirectShow, default is Video Renderer Filter.

Among interfaces you mentioned, the default video renderer implements IDirectDrawVideo, so you can query it from the filter, but first you need to locate the filter itself. Then you can use IDirectDrawVideo::GetDirectDraw.

The filter does not need to have own HDC and, generally speaking, video renderer does not need HDC and performance wise you are not interested in enabling mode with HDC. Depending on actual task you are trying to solve, you are probably interested in having the filter in windowed or windowless mode, which you need to set up first, and then the question of obtaining the filter to get IDirectDrawVideo from will be trivial.

Upvotes: 0

Related Questions