Microsoft DirectX 8.0

DLL Setup Functions

Declaration: Dllsetup.h.

AMovieDllRegisterServerObsolete.
AMovieDllRegisterServer2Registers and unregisters filters.
AMovieDllUnregisterServerObsolete.
AMovieSetupRegisterFilterObsolete.
AMovieSetupRegisterFilter2Registers a filter's merit, pins, and media types.

AMovieDllRegisterServer

DLL and Setup Functions

Obsolete. Use AMovieDllRegisterServer2 instead.

Syntax

HRESULT AMovieDllRegisterServer(void);

AMovieDllRegisterServer2

DLL and Setup Functions

Registers and unregisters filters.

Syntax

HRESULT AMovieDllRegisterServer2(
    BOOL bRegister
);

Parameters

bRegister
TRUE indicates register the filter, FALSE indicates unregister it.

Return Value

Returns an HRESULT value of NOERROR if the method succeeds. Otherwise an error code is returned.

Remarks

Use this function to set up your filters. For more information, see How to Register DirectShow Filters and the sample filters included with the SDK.

Note  The filter registration process is changing to allow filters to register by category. For example, capture filters and compression filters are enumerated together in their respective categories. The following functions demonstrate how filter registration and unregistration by category might work. The following function uses the IFilterMapper2 interface.

static const WCHAR *g_wszName = L"Sample Compressor Filter" ;

// register sample compressor filter
STDAPI
DllRegisterServer( void )
{

    // register the server
    HRESULT hr = AMovieDllRegisterServer2( TRUE );
    if( FAILED(hr) )
        return hr;

    IFilterMapper2 *pFm2 = 0;

    hr = CoCreateInstance( CLSID_FilterMapper2
                           , NULL
                           , CLSCTX_INPROC_SERVER
                           , IID_IFilterMapper2
                           , (void **)&pFm2 );
    
    if(FAILED(hr))
        return hr;

    static const AMOVIESETUP_MEDIATYPE sudAVICoTypeOut =  {
        &MEDIATYPE_Video,
        &MEDIASUBTYPE_SampleVideoType };

    static const AMOVIESETUP_MEDIATYPE sudAVICoTypeIn =  {
        &MEDIATYPE_Video,
        &GUID_NULL };

    static const AMOVIESETUP_PIN psudAVICoPins[] =
    {
        {
            L"Input"        // strName
            , FALSE         // bRendered
            , FALSE         // bOutput
            , FALSE         // bZero
            , FALSE         // bMany
            , &CLSID_NULL   // clsConnectsToFilter
            , 0             // strConnectsToPin
            , 1             // nTypes
            , &sudAVICoTypeIn } // lpTypes
        , { L"Output"       // strName
            , FALSE         // bRendered
            , TRUE          // bOutput
            , FALSE         // bZero
            , FALSE         // bMany
            , &CLSID_NULL   // clsConnectsToFilter
            , 0             // strConnectsToPin
            , 1             // nTypes
            , &sudAVICoTypeOut
        }
    };   // lpTypes     

    REGFILTER2 rf2;
    rf2.dwVersion = 1;
    rf2.dwMerit = MERIT_DO_NOT_USE;
    rf2.cPins = NUMELMS(psudAVICoPins);
    rf2.rgPins = psudAVICoPins;

    hr = pFm2->RegisterFilter(
        CLSID_SampleCompressorFilter,
        g_wszName,              // name shown to the user
        0,                      // device moniker
        &CLSID_VideoCompressorCategory,
        g_wszName,              // unique instance name
        &rf2);

    pFm2->Release();
 
    return hr;

}

// unregister sample compressor filter
STDAPI
DllUnregisterServer( void )
{

    HRESULT hr = AMovieDllRegisterServer2( FALSE );
    if( FAILED(hr) )
        return hr;

    IFilterMapper2 *pFm2 = 0;

    hr = CoCreateInstance( CLSID_FilterMapper2
                           , NULL
                           , CLSCTX_INPROC_SERVER
                           , IID_IFilterMapper2
                           , (void **)&pFm2       );
    
    if(FAILED(hr))
        return hr;

    hr = pFm2->UnregisterFilter(
        &CLSID_VideoCompressorCategory,
        g_wszName,
        CLSID_SampleCompressorFilter);

    pFm2->Release();
 
    return hr;
}

AMovieDllUnregisterServer

DLL and Setup Functions

Obsolete. Use AMovieDllRegisterServer2 instead.

Syntax

HRESULT AMovieDllUnregisterServer(void);

AMovieSetupRegisterFilter

DLL and Setup Functions

Obsolete. Use AMovieSetupRegisterFilter2 instead.

Syntax

HRESULT AMovieSetupRegisterFilter(
    const AMOVIESETUP_FILTER const *psetupdata,
    IFilterMapper *pIFM,
    BOOL bRegister
);

AMovieSetupRegisterFilter2

DLL and Setup Functions

Registers a filter's merit, pins, and media types in the registry using IFilterMapper2.

Syntax

HRESULT AMovieSetupRegisterFilter2(
    const AMOVIESETUP_FILTER const *psetupdata,
    IFilterMapper2 *pIFM2,
    BOOL bRegister
);

Parameters

psetupdata
Pointer to the AMOVIESETUP_FILTER data.
pIFM
Pointer to IFilterMapper2 interface.
bRegister
Value indicating whether to register the filter; TRUE indicates register the filter, FALSE indicates unregister it.

Return Value

Returns an HRESULT value of NOERROR if the method succeeds. Otherwise, returns an error code.

Remarks

AMovieDllRegisterServer2 uses this helper function to register a filter after the COM server has been registered.

Typically, a filter will use AMovieDllRegisterServer2 and will not call this function directly.