注册
Filter
//
Creates registry entries for the DLL
The AMovieDllRegisterServer2 function creates registry entries for every component in the g_Templates array. However, this function has some limitations. First, it assigns every filter to the "DirectShow Filters" category (CLSID_LegacyAmFilterCategory), but not every filter belongs in this category. Capture filters and compression filters, for example, have their own categories. Second, if your filter supports a hardware device, you might need to register two additional pieces of information that AMovieDLLRegisterServer2 does not handle: the medium and the pin category. A medium defines a method of communication in a hardware device, such as a bus. The pin category defines the function of a pin. For information on mediums, see KSPIN_MEDIUM in the Microsoft Windows Driver Development Kit (DDK). For a list of pin categories, see Pin Property Set.
REGFILTER2 rf2FilterReg =
{
1,
// Version 1 (no pin mediums or pin category).
MERIT_NORMAL,
// Merit.
1,
// Number of pins.
&sudPins
// Pointer to pin information.
};
//Creates registry entries for the DLL
STDAPI DllRegisterServer(
void)
{
HRESULT hr = E_FAIL;
IFilterMapper2 *pFM2 = NULL;
hr = AMovieDllRegisterServer2(TRUE);
//
这个还是要调用的
if (FAILED(hr)) return hr;
hr =
CoCreateInstance(
CLSID_FilterMapper2, NULL,
CLSCTX_INPROC_SERVER,
IID_IFilterMapper2, (void **)&
pFM2);
if (FAILED(hr)) return hr;
hr =
pFM2->
RegisterFilter( CLSID_SomeFilter, // Filter CLSID.
g_wszName, //
Filter name.
NULL, // Device moniker.