title: What functions are called before the Receive method of a input pin in directshow filters?
body: <p>I have built a filter graph successfuly, e.g. all connections between the filters could be made.
  But when I run the graph it doesn't produces any output.<br>
  I used the SetLogFile method of the graph, but all it says is that there have been filters added and created, nothing else. The probelm seems to be that the Receive method of my inputpin is not called. Using debugging techniques I could determine that the following methods of my filter/pin have been called:</p>
  
  <ul>
  <li><p>Constructor of my filter</p></li>
  <li><p>Three times constructor of input pin (i have three instances of them)</p></li>
  <li><p>constructor or output pin</p></li>
  <li><p>Nondelegationqueryinterface</p></li>
  <li><p>2 times GetMediaType</p></li>
  <li><p>2 times pause of my filter (at the same second)</p></li>
  </ul>
  
  <p>The code of my receive function does not get called.
  I have also tried checking multiplReceive which was not called either.</p>
  
  <p>Here is my source code:</p>
  
  <pre><code>#include "MyFilter\MyFilter.h"
  #include &lt;dshow.h&gt;
  IPin *GetPin(IBaseFilter *pFilter, PIN_DIRECTION PinDir)
  {
      BOOL       bFound = FALSE;
      IEnumPins  *pEnum;
      IPin       *pPin;
  
      pFilter-&gt;EnumPins(&amp;pEnum);
      while (pEnum-&gt;Next(1, &amp;pPin, 0) == S_OK)
      {
          PIN_DIRECTION PinDirThis;
          pPin-&gt;QueryDirection(&amp;PinDirThis);
          if (bFound = (PinDir == PinDirThis))
              break;
          pPin-&gt;Release();
      }
      pEnum-&gt;Release();
      return (bFound ? pPin : 0);
  }
  
  int CALLBACK WinMain(
      _In_  HINSTANCE hInstance,  
      _In_  HINSTANCE hPrevInstance,
      _In_  LPSTR lpCmdLine,
      _In_  int nCmdShow
      )
  {
      //INIT GRAPH
      CoInitialize(NULL);
  
      IGraphBuilder* graphBuilder = NULL;
      IMediaControl* mediaControl = NULL;
      IMediaEvent* mediaEvent = NULL;
  
      HRESULT hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IFilterGraph, (void **)&amp;graphBuilder);
  
      HANDLE fileHandle = CreateFile(L"D:\\TEMP\\debug1.log", GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, NULL, NULL);
  
      graphBuilder-&gt;SetLogFile((DWORD_PTR)fileHandle);
      graphBuilder-&gt;QueryInterface(IID_IMediaControl, (void **)&amp;mediaControl);
      graphBuilder-&gt;QueryInterface(IID_IMediaEvent, (void **)&amp;mediaEvent);
  
      IBaseFilter* source;
  
      hr = graphBuilder-&gt;AddSourceFilter(L"D:\\TEMP\\drop.avi", NULL, &amp;source);
  
      if (FAILED(hr))
      {
          return hr;
      }
  
      IPin* sourceOUt = GetPin(source, PINDIR_OUTPUT);
  
      //END
  
      //SPLITTER
      IBaseFilter* splitter;
      hr = CoCreateInstance(CLSID_AviSplitter, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void **)&amp;splitter);
  
      if (FAILED(hr))
      {
          return hr;
      }
      graphBuilder-&gt;AddFilter(splitter, L"Splitter");
      IPin* pinSplitIN = GetPin(splitter, PINDIR_INPUT);
  
      hr = graphBuilder-&gt;Connect(sourceOUt, pinSplitIN);
      IPin* piSplitOut = GetPin(splitter, PINDIR_OUTPUT);
      if (FAILED(hr))
      {
          return hr;
      }
      //END
  
  
      //LAV Video Decoer
      IBaseFilter* decoder;
      // {EE30215D-164F-4A92-A4EB-9D4C13390F9F}
      static const GUID CLSID_LAV = 
      { 0xee30215d, 0x164f, 0x4a92, { 0xa4, 0xeb, 0x9d, 0x4C, 0x13, 0x39, 0x0F, 0x9F } };
  
      hr = CoCreateInstance(CLSID_LAV, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void **)&amp;decoder);
      if (FAILED(hr)) return hr;
  
      hr = graphBuilder-&gt;AddFilter(decoder, L"Decoder");
  
      if (FAILED(hr)) return hr;
  
  
      IPin* decoderIN = GetPin(decoder, PINDIR_INPUT);
  
      hr = graphBuilder-&gt;Connect(piSplitOut, decoderIN);
      IPin* decoderOUT = GetPin(decoder, PINDIR_OUTPUT);
  
      if (FAILED(hr)) return hr;
  
      //myfilter
  
      IBaseFilter *myfilter;
      IMyFilter* myInterface;
      hr = CoCreateInstance(CLSID_MyFilter64, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void **)&amp;myfilter);
  
      if (FAILED(hr))
      {
          return hr;
      }
  
      myfilter-&gt;QueryInterface(IID_IMyFilter64, (void **)&amp;myInterface);
  
      hr = graphBuilder-&gt;AddFilter(myfilter, L"MyFilter");
      if (FAILED(hr))
      {
          return hr;
      }
      IPin* mypin0 = myInterface-&gt;GetMyPin(0);
  
  
      IPin* myoutpin = myInterface-&gt;GetMyPin(3);
      hr = graphBuilder-&gt;Connect(decoderOUT, mypin0);
  
  
      if (FAILED(hr))
      {
          return hr;
      }
  
      //AVI MUX
  
      IBaseFilter* mux;
      // {F7F627FB-45C3-4F6F-B99A-71C0BFE3B5B7}
      //{E2510970-F137-11CE-8B67-00AA00A3F1A6}
      const GUID CLSID_MUX =
      { 0xE2510970, 0xF137, 0x11CE, { 0x8b, 0x67, 0x00, 0xAA, 0x00, 0xA3, 0xF1, 0xA6 } };
  
  
  
  
      hr = CoCreateInstance(CLSID_MUX, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void **)&amp; mux);
      if (FAILED(hr)) return hr;
  
      IPin* muxIn = GetPin(mux, PINDIR_INPUT);
      IPin* muxOut = GetPin(mux, PINDIR_OUTPUT);
      graphBuilder-&gt;AddFilter(mux, L"MUX");
  
      hr = graphBuilder-&gt;Connect(myoutpin, muxIn);
  
      if (FAILED(hr)) return hr;
  
  
      //FILEWRITER
      IBaseFilter* filewriter = NULL;
      IFileSinkFilter* fileSink = NULL;
      hr = CoCreateInstance(CLSID_FileWriter, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void **)&amp;filewriter);
      if (FAILED(hr)) return hr;
      hr = graphBuilder-&gt;AddFilter(filewriter, L"FIleWriter");
      IPin* fileIn = GetPin(filewriter, PINDIR_INPUT);
      if (FAILED(hr)) return hr;
      hr = graphBuilder-&gt;Connect(muxOut, fileIn);
      if (FAILED(hr)) return hr;
      hr = filewriter-&gt;QueryInterface(IID_IFileSinkFilter, (void **)&amp;fileSink);
  
      if (FAILED(hr)) return hr;
  
      fileSink-&gt;SetFileName(L"D:\\TEMP\\yc2.avi", NULL);
  
      /*myInterface-&gt;StartRecording()*/;
      hr = mediaControl-&gt;Run();
      if (SUCCEEDED(hr))
      {
          long evCode;
          mediaEvent-&gt;WaitForCompletion(INFINITE, &amp;evCode);
          mediaControl-&gt;Stop();   
          //myInterface-&gt;StopRecording();
          CoUninitialize();
          myfilter-&gt;Release();
  
          return 1;
  
      } 
      CoUninitialize();
      myfilter-&gt;Release();
  
  
      return hr;
  }
  </code></pre>
  
  <p>The problem is propably in my own filter. So what methods of a filter are called by the graphbuilder? If i know this i can implement this methods and place logging messages in.</p>