Declaring the Factory Template

The next step is to declare the factory template for your filter. A factory template is a C++ class that contains information for the class factory. In your DLL, declare a global array of CFactoryTemplate objects, one for each filter or COM component in your DLL. The array must be named g_Templates. For more information about factory templates, see How to Create a DirectShow Filter DLL.

The m_pAMovieSetup_Filter member of the factory template is a pointer to the AMOVIESETUP_FILTER structure described previously. The following example shows a factory template, using the structure given in the previous example:

CFactoryTemplate g_Templates[] = {
        g_wszName,                      // Name.
        &CLSID_SomeFilter,              // CLSID.
        CSomeFilter::CreateInstance,    // Creation function.
        &sudFilterReg                   // Pointer to filter information.
int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);

If you did not declare any filter information, m_pAMoveSetup_Filter can be NULL.

Related topics

How to Register DirectShow Filters