The GraphEdit is hung when I try to connect my custom filter to upstream source filter.

Answered The GraphEdit is hung when I try to connect my custom filter to upstream source filter.

  • Wednesday, April 18, 2012 1:47 PM
     
     

    Hi there,

    I write a trans-In-place filter. I want my filter connected to upstream source filter. 

    My code snippet is below:

    HRESULT CMyFilter::Transform(IMediaSample* pSample)
    {
        return S_OK;
    }

    HRESULT CMyFilter::CheckInputType(const CMediaType* pmt)
    {
        CheckPointer(pmt, E_POINTER);

        if(pmt->majortype != MEDIATYPE_Stream) {
            return VFW_E_TYPE_NOT_ACCEPTED;
        }
       
        if((pmt->subtype != MEDIASUBTYPE_MPEG2_TRANSPORT)){
            return VFW_E_TYPE_NOT_ACCEPTED;
        }

        return S_OK;
    }

    Then, I open the GraphEdit and add the File Source (Async.) filter to the graph.

    And, I select a .mpg file and connect the File Source (Async.) filter to my trans-In-place filter.

    The GraphEdit is hung! Why? What's wrong with my code?

    Thanks in advance.

All Replies

  • Thursday, April 19, 2012 6:08 AM
     
     Answered
    JupiterLee wrote:
    >
    >I write a trans-In-place filter. I want my filter connected to upstream source filter. 
    >...
    >Then, I open the GraphEdit and add the File Source (Async.) filter to the graph.
    >
    >And, I select a .mpg file and connect the File Source (Async.) filter to my trans-In-place filter.
    >
    >The GraphEdit is hung! Why? What's wrong with my code?
     
    It is unusual for a file filter to produce MEDIATYPE_Stream /
    MEDIASUBTYPE_MPEG2_TRANSPORT.  Transport streams don't usually come from a
    file.  Have you verified that's what the file filter's output pin produces?
    --
    Tim Roberts, timr@probo.com
    Providenza & Boekelheide, Inc.
     

    Tim Roberts, VC++ MVP Providenza & Boekelheide, Inc.
    • Marked As Answer by JupiterLee Friday, April 27, 2012 9:09 AM
    •  
  • Friday, April 27, 2012 9:14 AM
     
     

    Hi Tim,

    Thanks.

    I set the wrong media type and media subtype.