Re: DirectShow Insanity

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Phil Taylor (phil_at_private-citizen.com)
Date: 01/20/05


Date: Thu, 20 Jan 2005 10:27:54 -0800

and what exactly is shown in the debug output window?

what is the return value from MediaControl->Run?

what happens if you wait for completion befor exiting the program?

some operations require the thread that started to remain alive until the
operation completes. the sample code does this, so perhaps thats the issue.

"Roulette" <Roulette@Roulette.com> wrote in message
news:%23UoVy5p$EHA.1408@TK2MSFTNGP10.phx.gbl...
> Can someone tell me why the following small snippet of DirectShow code
> causes a number of "First-chance exception"s to occur? The code actually
> seems to work fine - the music plays for a couple of seconds before
> exiting. In the full application, the music plays fine, I receive a
> callback (after setting it up) and reset the music to loop when its
> finished, etc..
>
> In other words...as far as I can tell on my machine, the code works
> exactly like it should, but those exceptions (that you can see in the
> Debug window when running the program from MSDEV) are making me worry that
> there might be a problem on some other machine.
>
> Thanks in advance for any help....
>
> - Roulette
>
>
>
> int WINAPI WinMain(HINSTANCE hinstance,HINSTANCE hprevinstance,LPSTR
> lpcmdline,int ncmdshow)
> {
> // No clean-up is done since this code is just demonstrating a problem.
>
> CoInitialize(NULL);
> IGraphBuilder *pGraph=NULL;
> IMediaControl *pMediaControl=NULL;
> const char *filename="Test.wma";
>
> HRESULT
> returnValue=CoCreateInstance(CLSID_FilterGraph,NULL,CLSCTX_INPROC_SERVER,IID_IGraphBuilder,(void
> **)&pGraph);
>
> if (FAILED(returnValue))
> return 0;
>
> if (pGraph)
> {
> pGraph->QueryInterface(IID_IMediaControl,(void **)&pMediaControl);
>
> if (pMediaControl)
> {
> WCHAR *wfile;
> int length;
> length=strlen(filename)+1;
> wfile=new WCHAR[length];
> MultiByteToWideChar(CP_ACP,0,filename,-1,wfile,length);
>
> returnValue=pGraph->RenderFile(wfile,NULL);
>
> if (FAILED(returnValue))
> return 0;
>
> pMediaControl->Run(); // This line causes several exceptions to
> occur - you can see the debug output when running in MSDEV.
>
> Sleep(2000); // Give the music a chance to play for a couple of
> seconds before exiting the program.
> }
> }
>
> return 0;
> }
>
>



Relevant Pages

  • DirectShow Insanity
    ... seems to work fine - the music plays for a couple of seconds before exiting. ... occur - you can see the debug output when running in MSDEV. ...
    (microsoft.public.win32.programmer.directx.audio)
  • Re: Writing to the Debug Window
    ... Debug.Writeline, it writes to the screen in DebugView, but not the debug output window in the enviroment. ... to the Immediate window" ...
    (microsoft.public.vsnet.debugging)
  • Re: Cant Get Debugger To Stop At A Breakpoint in VC++
    ... If you don't see OutputDebugStringoutput in Debug output window, ... Use this process ID to check the process the DLL ... try to set a breakpoint in DllMain() ...
    (microsoft.public.vc.debugger)
  • Re: Debug output cleared
    ... After builds and especially after executions, the debug output window ... After right clicking and clearing the debug output, ... and the scroll bar keeps changing its size. ...
    (microsoft.public.vc.mfc)
  • Debug output cleared
    ... my Debug Output window. ... Now, even after closing VCand reopening it, the ... Debug Output will not display anything. ...
    (microsoft.public.vc.mfc)