简体   繁体   中英

Getting display name of a DirectShow filter without a category

I want to get the display name of VMR-7 filter ( CLSID_VideoMixingRenderer, {B87BEB7B-8D29-423f-AE4D-6582C10175AC}). Normally, I would use CoCreateInstance (CLSID_SystemDeviceEnum) + CreateClassEnumerator (CLSID_ActiveMovieCategories) , then use moniker enumeration to find a moniker for the filter and use the moniker's GetDisplayName method. This works, for example, in case of "Video Renderer" ( CLSID_VideoRenderer, {70E102B0-5556-11CE-97C0-00AA0055595A}) --it returns a display name "@device:sw:{083863F1-70DE-11D0-BD40-00A0C911CE86}\{70E102B0-5556-11CE-97C0-00AA0055595A}" .
The problem is that, unlike "Video Renderer", VMR-7 is not assigned to any category. On Windows XP, CLSID_VideoMixingRenderer exists in the Registry only as a separate key that is neither a subkey of CLSID_LegacyAmFilterCategory, nor is included in any of the categories that are subkeys of CLSID_ActiveMovieCategories, nor is included in any other category I could think of, nor is linked to any other CLSID in the Registry. System Device Enumerator never returns any monikers for VMR-7. The filter itself exists and works (in fact, it is a principal video renderer under Windows XP). I can use

CoCreateInstance (CLSID_VideoMixingRenderer, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**) &VMR7IBaseFilterPointer);

to add VMR-7 to the filtergraph. But how can I get its display name if I can't get a moniker for it? I tried to get VMR-7's moniker through

hr = VMR7IBaseFilterPointer -> QueryInterface (IID_IMoniker, (void**) &pim);

and

hr = VMR7IBaseFilterPointer -> QueryInterface (IID_IUnknown, (void**) &punk);
hr = punk -> QueryInterface (IID_IMoniker, (void**) &pim);,

but got "No Interface" in response, as if IMoniker interface was not implemented. Another question is, aren't filters that allow monikers supposed to also provide an IMoniker interface?

DirectShow filter is a COM object without requirement or assumption to implement any self-descriptive interfaces. There is no DisplayName attached, promised or documented, so you don't have a method to retrieve it.

DisplayName is a string associated with registration information, and if a filter is not registered as in your example you mention, then there is no DisplayName in first place.

Moniker is a "shortcut" to instantiate a filter. Once you have an instance, there are no more monikers in the game.

The best you can do in the situation, is to attempt to recover CLSID for the instance you are holding (see, for example, Getting GUID of coclass object using pointer to interface it implements ), and then look the registry up for COM class description (optional too, but exists in most cases).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM