Re: How to play sequentially several audio files with DirectShow ?

Tech-Archive recommends: Fix windows errors by optimizing your registry



On Sat, 10 Jun 2006 23:28:35 +0200, Mark Morrisson wrote:

Hi everyone,

I want to play A.mp3 then B.mp3. After initializing an instance of
DirectShow, here is the way I load a file :

HRESULT hr;

WCHAR wFile[MAX_PATH];

int nLen = MultiByteToWideChar(CP_ACP, 0, fileName, -1, NULL, NULL);

MultiByteToWideChar(CP_ACP, 0, fileName, -1, wFile, nLen);

if FAILED(hr = m_pigb->RenderFile(wFile, NULL))
throw DXException("RenderFile", hr);

with fileName being 'A.mp3' then 'B.mp3'. Once the first file has been
loaded, I play it with m_pimc->Run(); where m_pimc is a pointer to
IMediaControl interface. The file is playing fine. Then, after a certain
amount of seconds, I call m_pimc->Stop(); and I load the B.mp3 file with the
code above. Then I call m_pimc->Run(); again but it's still the first file
that is played (i.e. A.mp3) and not B.mp3 ! Isn't it possible to render
several files with the same graph filter ?

It's possible but you have to remove the existing filters from the graph.
If you know that the next file is going to be of the same type you could
locate and remove the source filter and insert the new source filter.
Basically though if you're using the RenderFile() technique it's easiest to
destroy the old graph completely and create a new one.

--
http://www.chrisnet.net/code.htm
http://www.avdevforum.com/AV
.



Relevant Pages

  • saving/loading a graph
    ... I have my own source filter and want to save/load the graph i build fro ... I have inhertied the CPersistStream class and overidden ... I save the length of my filename and the actual filename. ... HRESULT CAsfReader::WriteToStream ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: saving/loading a graph
    ... >I have my own source filter and want to save/load the graph i build fro ... I save the length of my filename and the actual filename. ... GraphEdit File Programmatically" in MSDN. ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: Custom source filter
    ... when I try to add it I'm getting an access violation error at runtime. ... HRESULT BuildDisplayGraph ... // Create the filter graph manager object. ... ErrMsg(TEXT("The source filter could not be instantiated!")); ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: Custom source filter
    ... when I try to add it I'm getting an access violation error at runtime. ... HRESULT BuildDisplayGraph ... // Create the filter graph manager object. ... ErrMsg(TEXT("The source filter could not be instantiated!")); ...
    (microsoft.public.win32.programmer.directx.video)
  • MPEG2 file source (growing files)
    ... I'm trying to develop a source filter based on the DX9 SDK's AsyncFilter ... The source filter will ultimately be connected to graph containing the ... Elecard (possibly Intervideo or Cyberlink) decoder for rendering the video ... point me at a sample that solves the sort of problem I'm looking at. ...
    (microsoft.public.win32.programmer.directx.video)