IMediaControl DirectShow

A

anonymous

I recently purchased a new computer and with this started having an issue
with previously written software which works fine on XP suddenly crashing
when I close on Vista. Inside the dispose event for the class the first
think I do is stop the running graph and tear down existing filters. I am
receiving a "System.AccessViolationException" when I call the
lpMediaControl->Stop();. Just to make sure I wasnt missing anything I added
the Pause() and sleep before both of which succeed. Once it runs the stop
on the media control I get the error. Any ideas on what I might check?

IEnumFilters *lpEnumFilters;
IBaseFilter *lpBaseFilter;
ULONG lcFetched;
HRESULT hr = NOERROR;

IMediaControl *lpMediaControl = NULL;
if (gpGraphBuilder->QueryInterface(IID_IMediaControl, (void
**)&lpMediaControl) == S_OK && lpMediaControl)
{
OAFilterState lfilterState = NULL;
if(lpMediaControl->GetState(1000, &lfilterState) == S_OK && lfilterState)
if(lfilterState == State_Running)
{
hr = lpMediaControl->Pause();
System::Threading::Thread::Sleep(1000);
hr = lpMediaControl->Stop();
}
SAFE_RELEASE(lpMediaControl);
}
 
A

anonymous

Should anyone find this later the problem was actually with the ffdshow
filter being used in the graph for recording. This could be reproduced by
setting up the same filters inside graphedit and attempting to stop the
graph. No work around that I could find so I simply moved my encoder over
to 3ivx MPEG-4 Video Encoder and problem solved.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top