CFactoryTemplate class
[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]
Provides a template for creating class factories.
In DirectShow, class factories are specialized using the CFactoryTemplate class, also called the factory template. Each class factory holds a pointer to a factory template. The factory template contains information about a COM object, including the object's class identifier (CLSID) and a pointer to a function that creates the object.
In your DLL, declare a global array of factory templates named g_Templates. Include one factory template for each object in the DLL. When the DllGetClassObject function makes a new class factory, it searches the array for a template with a matching CLSID. Assuming it finds one, it creates a class factory that holds a pointer to the matching template. When the client calls IClassFactory::CreateInstance, the class factory calls the instantiation function defined in the template.
For more information, see How to Create a DirectShow Filter DLL.
Public Member Variables | Description |
---|---|
m_Name | Name of the filter. |
m_ClsID | Pointer to the CLSID of the object. |
m_lpfnNew | Pointer to a function that creates an instance of the object. |
m_lpfnInit | Pointer to a function that gets called from the DLL entry point. |
m_pAMovieSetup_Filter | Pointer to an AMOVIESETUP_FILTER structure. |
Public Methods | Description |
IsClassID | Determines whether a CLSID matches this class template. |
CreateInstance | Calls the object-creation function for the class. |
Requirements
Requirement | Value |
---|---|
Header |
|
Library |
|