title: Implementing Directshow IFileSourceFilter interface in a CSource based Filter
body: <p>I implement simple Directshow Filter which derived from  CSource  filter. It work fine.
  What i want is to add the filter IFileSourceFilter. So what i do for this is:</p>
  <p>I implement FileSourceFilter interface with two methods:</p>
  <pre><code>HRESULT Load(LPCOLESTR lpwszFileName, const AM_MEDIA_TYPE *pmt)
  HRESULT GetCurFile(LPOLESTR * ppszFileName, AM_MEDIA_TYPE *pmt)
  </code></pre>
  <p>For now [ Just for test purposses] They do nothing</p>
  <pre><code>// Required by  IFileSourceFilter 
  
  STDMETHODIMP Load(LPCOLESTR lpwszFileName, const AM_MEDIA_TYPE *pmt)
  {
           // do nothing for now...Just for test
           return S_OK;
  }
  STDMETHODIMP GetCurFile(LPOLESTR * ppszFileName, AM_MEDIA_TYPE *pmt)
  {
           // do nothing for now...Just for test
            return S_OK;
  }
  </code></pre>
  <p>And also add the IFileSourceFilter  interface to NonDelegatingQueryInterface method of my source filter.</p>
  <pre><code> STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv)
  {
       if (riid == IID_IFileSourceFilter) 
       {
             return GetInterface((IFileSourceFilter *)this, ppv);
       }
       else
       {
       return CSource::NonDelegatingQueryInterface(riid, ppv);
       }
  }
  </code></pre>
  <p>When i insert my SourceFilter into the grapgEdit it nicely ask me file location...I give a random file[ <strong>for test porposes IFileSourceFilter interfcae DO nothing for now</strong>)...</p>
  <p><strong>AndThen  my SourceFilter Crash at the grah edit tool suddenly...</strong> .</p>
  <p>Whay may be wrong?Do i missing something while implementing IFileSourceFilter interface?
  Any suggestion ideas for which may cause this?</p>
  <p>Best Wishes</p>
  <p>My SourceFilter Structure:</p>
  <pre><code> class MySourceFilter : public CSource,public IFileSourceFilter 
  {
  public:
  
  ....
  DECLARE_IUNKNOWN;
  
  STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv)
  {
       if (riid == IID_IFileSourceFilter) 
       {
             return GetInterface((IFileSourceFilter *)this, ppv);
       }
       else
       {
       return CSource::NonDelegatingQueryInterface(riid, ppv);
       }
  }
  
  // Required by  IFileSourceFilter 
  
  STDMETHODIMP Load(LPCOLESTR lpwszFileName, const AM_MEDIA_TYPE *pmt)
  {
           // do nothing for now...Just for test
           return S_OK;
  }
  STDMETHODIMP GetCurFile(LPOLESTR * ppszFileName, AM_MEDIA_TYPE *pmt)
  {
           // do nothing for now...Just for test
            return S_OK;
  }
  
  }
  </code></pre>