delphidirectshowdspack

How to initialize a TFilter with a known Video Capture source without using TSysDevEnum.GetMoniker?


Is it possible to create/initailize a TFilter object with a known Video Capture source without using TSysDevEnum.GetMoniker(...)?

The Video Capture Source's name and other details are already known and can be obtained by GraphEdit Filter Browser. The intention is to speed up the initialization of TFilter and attach it to the FilterGraph programmatically.


Solution

  • No, you need to do it via moniker. It depends on actual COM class backing the video source filter, however almost always there is no unique CLSID and it is impossible to instantiate it not via moniker.

    If you have moniker display name, you can use MkParseDisplayName to quickly obtain IMoniker bypassing enumeration. Or you can enumerate and compare moniker's display name to the one you already hold.

    To select an audio or video capture device, use the System Device Enumerator, described in the topic Using the System Device Enumerator. The System Device Enumerator returns a collection of device monikers, selected by device category. A moniker is a COM object that contains information about another object. Monikers enable the application to get information about an object without actually creating the object.