I have developed virtual webcam (DShow filter) and now I want to make it 1st in the list of webcams in开发者_开发知识库 applications. I know that applications use DirectShow or VFW to enumerate video devices but how can I force them to show my webcam as "default" one?
Thanks in advance!
You could try using filter merit. This does not achieve "default" (not sure this can be achieved) but at least could bring your filter to the top of the list, depending upon how the client app sorts its capture list (e.g. alphabetically, or by priority).
Filter merit allows filter vendors to ascribe a "priority" level to their filter. This filter merit is registered with the filter, as described in your filter's registry descriptor. For example:
AMOVIESETUP_FILTER sudFilterReg = {
&CLSID_SomeFilter, // Filter CLSID.
g_wszName, // Filter name.
MERIT_PREFERRED, // Merit.
1, // Number of pin types.
&sudPins // Pointer to pin information.
};
This is typically used with encoder/decoder filters. For example in a situation where DirectShow uses auto-connect to select an MJPEG decoder filter from a list of multiple MJPEG codecs registered on a user's sytem, it should select the filter with the highest merit value.
This approach also gives end-user's a chance to see/adjust the filter merit values for all filters registered on their system ( check out Filmerit http://paul.glagla.free.fr/filmerit_en.htm ) which is a great free tool for doing this.
精彩评论