Subscribe to our RSS Feeds
The postings and links in this blog are provided "AS IS" with no warranties, and confer no rights. The opinions expressed here are solely those of the authors.

Registering DirectShow Filter in WinCE6

0 Comments »

We can register directshow filter in two ways
  1. Dynamically using regsvr tool
  2. statically at run-time image creation



1. Dynamically using regsvr tool

   If registry details for filter is not included in image then we go for dynamic registration.
It is same as window desktop DirectShow filter registration process. We use either regsvr32.exe or regsvrCE.exe for including filters registry information in WinCE registry. We need to register each time after image bootup before calling filter for any use.


Implementation Process
a.       Declare filter information in structures, DirectShow having a set of structures for describing filters, pins details, and media types details.
             AMOVIESETUP_FILTER - Describes a filter.
             AMOVIESETUP_PIN - Describes a pin.
             AMOVIESETUP_MEDIATYPE -Describes a media type.
Eg-
static const WCHAR g_wszName[] = L"Some Filter";
 
AMOVIESETUP_MEDIATYPE sudMediaTypes[] = {
    { &MEDIATYPE_Video, &MEDIASUBTYPE_RGB24 },
    { &MEDIATYPE_Video, &MEDIASUBTYPE_RGB32 },
};
 
AMOVIESETUP_PIN sudOutputPin = {
    L"Output",      // Pin string name.
    FALSE,          // Is this pin rendered?
    TRUE,           // Is it an output pin?
    FALSE,          // Can the filter create zero instances?
    FALSE,          // Does the filter create multiple instances?
    &GUID_NULL,     // Connects to filter.
    NULL,           // Connects to pin.
    2,              // Number of media types.
    sudMediaTypes   // Pointer to media types.
};
 
AMOVIESETUP_FILTER sudFilterReg = {
    &CLSID_SomeFilter,      // Filter CLSID.
    g_wszName,              // Filter name.
    MERIT_NORMAL,           // Merit.
    1,                      // Number of pin types.
    &sudPins                // Pointer to pin information.
};


b.      Declare a factory template which having a pointer for the filter information structure sudFilterReg. 

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


c.     Implementing the DllRegisterServer  and DllUnregister function. 

These function will get call when regsvr32 and regsvrCE is used to register or unregister filter. We need to export these function in def file.
These functions internally calls AMovieDllRegisterServer and AMovieDllUnregisterServer function for creating registry entries for every component declared in the factory template array.
AMovieDllRegisterServer2(BOOL ) currently don’t support Windows CE6.

While writing these functions don’t pass any argument to AMovieDllRegisterServer as mentioned in MSDN (Link) and be careful with exact letter case.
Eg :
STDAPI DllRegisterServer()
{
    return AMovieDllRegisterServer();
}


STDAPI DllUnregisterServer()
{
      return AMovieDllUnregisterServer();
}

Registration process.

Click Start -> Run
Then type regsvrCE filter.dll
If you get success msg then start using your filter else start debugging.





2. statically at run-time image creation

add your registry, So filter will get register while image bootup.
will update this soon.. 



9:32 PM

0 Responses to "Registering DirectShow Filter in WinCE6"

Post a Comment