c++ - DirectShow IGraphBuilder Render error 0x80040218 (VFW_E_CANNOT_RENDER) -


i have following problem:

on windows 7, try loading contents of *.mp3 file in memory , play using igraphbuilder. works if don't have applications running. if, however, have bsplayer open *.avi file or game open, igraphbuilder won't render *.mp3 memory anymore. not happen if have winamp running, though.

i don't understand why happening, i'm suspecting input pins directshow used? when run graphedt or similar applications together, work (play *.avi files or *.mp3 files in parallel), there must i'm doing wrong in program. please me out?

i have 2 classes: cmemstream , cmemreader, based on ms windows 7.1 sdk's samples.

class cmemreader: public casyncreader 

cmemreader doesn't much, initializes base class casyncreader.

class cmemstream: public casyncstream 

cmemstream implements setpointer, read, size, alignment, lock, unlock methods.

here's code (simplified):

igraphbuilder *m_pgraphbuilder; cmemstream *m_pmemstream; cmemreader *m_pmemreader;  byte *m_pmemdata = new byte[lsize]; // ... fill in m_pmemdata contents of *.mp3 file // lsize size of file  m_pmemstream = new cmemstream(m_pmemdata, lsize);  cmediatype mediatype; mediatype.majortype = mediatype_stream; mediatype.subtype = mediasubtype_mpeg1audio;  hresult hresult; m_pmemreader = new cmemreader(m_pmemstream, &mediatype, &hresult);  cocreateinstance(clsid_filtergraph, null, clsctx_inproc_server, iid_igraphbuilder, (void**)&m_pgraphbuilder);  m_pgraphbuilder->addfilter(m_pmemreader, null); m_pmemreader->addref(); m_pgraphbuilder->render(m_pmemreader->getpin(0)); // fails! // error 0x80040218 (vfw_e_cannot_render): no combination of filters found render stream. 

i've tried connecting pins together, so:

ibasefilter *pfilter; cocreateinstance(clsid_dsoundrender, null, clsctx_inproc_server, iid_ibasefilter, (void**)&pfilter);  m_pgraphbuilder->addfilter(pfilter, null);  ienumpins *penumpins; ipin *ppin; pfilter->enumpins(&penumpins); penumpins->next(1, &ppin, 0);  m_pgraphbuilder->connect(m_pmemreader->getpin(0), ppin); // fails! // error 0x80040217 (vfw_e_cannot_connect): no combination of intermediate filters found make connection. 

i've tried different combinations type , subtype of cmediatype, none work.

if have idea or suggestion, if spot problem, please let me know. thank you!


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -