c++ - What functions are called before the Receive method of a input pin in directshow filters? -


i have built filter graph successfuly, e.g. connections between filters made. when run graph doesn't produces output.
used setlogfile method of graph, says there have been filters added , created, nothing else. probelm seems receive method of inputpin not called. using debugging techniques determine following methods of filter/pin have been called:

  • constructor of filter

  • three times constructor of input pin (i have 3 instances of them)

  • constructor or output pin

  • nondelegationqueryinterface

  • 2 times getmediatype

  • 2 times pause of filter (at same second)

the code of receive function not called. have tried checking multiplreceive not called either.

here source code:

#include "myfilter\myfilter.h" #include <dshow.h> ipin *getpin(ibasefilter *pfilter, pin_direction pindir) {     bool       bfound = false;     ienumpins  *penum;     ipin       *ppin;      pfilter->enumpins(&penum);     while (penum->next(1, &ppin, 0) == s_ok)     {         pin_direction pindirthis;         ppin->querydirection(&pindirthis);         if (bfound = (pindir == pindirthis))             break;         ppin->release();     }     penum->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 **)&graphbuilder);      handle filehandle = createfile(l"d:\\temp\\debug1.log", generic_write, file_share_read, null, create_always, null, null);      graphbuilder->setlogfile((dword_ptr)filehandle);     graphbuilder->queryinterface(iid_imediacontrol, (void **)&mediacontrol);     graphbuilder->queryinterface(iid_imediaevent, (void **)&mediaevent);      ibasefilter* source;      hr = graphbuilder->addsourcefilter(l"d:\\temp\\drop.avi", null, &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 **)&splitter);      if (failed(hr))     {         return hr;     }     graphbuilder->addfilter(splitter, l"splitter");     ipin* pinsplitin = getpin(splitter, pindir_input);      hr = graphbuilder->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 **)&decoder);     if (failed(hr)) return hr;      hr = graphbuilder->addfilter(decoder, l"decoder");      if (failed(hr)) return hr;       ipin* decoderin = getpin(decoder, pindir_input);      hr = graphbuilder->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 **)&myfilter);      if (failed(hr))     {         return hr;     }      myfilter->queryinterface(iid_imyfilter64, (void **)&myinterface);      hr = graphbuilder->addfilter(myfilter, l"myfilter");     if (failed(hr))     {         return hr;     }     ipin* mypin0 = myinterface->getmypin(0);       ipin* myoutpin = myinterface->getmypin(3);     hr = graphbuilder->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 **)& mux);     if (failed(hr)) return hr;      ipin* muxin = getpin(mux, pindir_input);     ipin* muxout = getpin(mux, pindir_output);     graphbuilder->addfilter(mux, l"mux");      hr = graphbuilder->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 **)&filewriter);     if (failed(hr)) return hr;     hr = graphbuilder->addfilter(filewriter, l"filewriter");     ipin* filein = getpin(filewriter, pindir_input);     if (failed(hr)) return hr;     hr = graphbuilder->connect(muxout, filein);     if (failed(hr)) return hr;     hr = filewriter->queryinterface(iid_ifilesinkfilter, (void **)&filesink);      if (failed(hr)) return hr;      filesink->setfilename(l"d:\\temp\\yc2.avi", null);      /*myinterface->startrecording()*/;     hr = mediacontrol->run();     if (succeeded(hr))     {         long evcode;         mediaevent->waitforcompletion(infinite, &evcode);         mediacontrol->stop();            //myinterface->stoprecording();         couninitialize();         myfilter->release();          return 1;      }      couninitialize();     myfilter->release();       return hr; } 

the problem propably in own filter. methods of filter called graphbuilder? if know can implement methods , place logging messages in.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -