Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results


Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging

The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.

Check out The OSR Learning Library at:

Directshow Intelligent Connect

minhptaminhpta Member Posts: 23

Hi guys,

I am trying to create an image filter for Directshow and want it to be connected automatically in Intelligent Connect mechanism.

The Directshow document say that:

4. If the filter graph contains any filters with unconnected input pins, the Filter Graph Manager tries them next. You can force the Render method to try a particular filter by adding that filter to the graph before calling Render.

I've tried to follow above direction but my transform filter is not get connected in the graph (Directshow not call any method of the filter except Stop).

The code to force **Directshow ** try connecting to my transform filter is:

CMyTranformFilter* myFilter = new CMyTranformFilter(NULL, &hr);
    hr = g_pGraph->AddFilter(myFilter, L"My Transform filter");

    // Render the preview pin on the video capture filter
    // Use this instead of g_pGraph->RenderFile
    hr = g_pCapture->RenderStream(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Video,
        pSrcFilter, NULL, NULL);

Here is my transform filter:
Not any method below is getting called. Is my understanding is correct? What is the approach to get my filter involve in rendering process?

class CMyTranformFilter : public CTransformFilter
    CMyTranformFilter(__inout_opt LPUNKNOWN punk, HRESULT* hr) :
        CTransformFilter("My Transform filter", punk, CLSID_MYTRANFORMFILTER)

    ~CMyTranformFilter() {

    HRESULT Transform(IMediaSample * pIn, IMediaSample *pOut) {
        return E_NOTIMPL;

    // check if you can support mtIn
    HRESULT CheckInputType(const CMediaType* mtIn) {
        return E_NOTIMPL;

    // check if you can support the transform from this input to this output
    HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut) {
        return E_NOTIMPL;

    // this goes in the factory template table to create new instances
    // static CCOMObject * CreateInstance(__inout_opt LPUNKNOWN, HRESULT *);

    // call the SetProperties function with appropriate arguments
    HRESULT DecideBufferSize(
        IMemAllocator * pAllocator,
        __inout ALLOCATOR_PROPERTIES *pprop) {
        return E_NOTIMPL;

    // override to suggest OUTPUT pin media types
    HRESULT GetMediaType(int iPosition, __inout CMediaType *pMediaType) {
        return E_NOTIMPL;


  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,348

    Your filter doesn't get selected because you're returning an error for every CheckInputType ahd CheckTransform call. You are not allowed to return E_NOTIMPL for those. That's the way the intelligent connect process works: DirectShow loads every filter in the registry and tries to connect it to the graph. The first one that agrees to accept the format gets linked into the graph.

    The samples are very clear about what these have to return. Don't ignore them.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • minhptaminhpta Member Posts: 23
    edited November 2021

    @Tim_Roberts , Sorry for my explanation. It might make you misunderstood.
    I've just create a dump filter to check how Intelligent Connect work.
    The problem is Intelligent Connect does not call any my filter's method.
    (I set break points to all my filter's method but they are never get hit)

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,348

    I just inserted your exact code into one of my test apps, and CheckInputType gets called several dozen times before the connection is rejected. Perhaps you should use OutputDebugString instead of relying on breakpoints.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • minhptaminhpta Member Posts: 23

    Yes, you're are right. I missed setting the break point in CheckInputType function. I am sorry for my silly question.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Writing WDF Drivers 12 September 2022 Live, Online
Internals & Software Drivers 23 October 2022 Live, Online
Kernel Debugging 14 November 2022 Live, Online
Developing Minifilters 5 December 2022 Live, Online