首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > 多媒体 >

IMediaControl的stop方法运行出错,帮忙看上

2013-01-05 
IMediaControl的stop方法运行出错,帮忙看下Data Abort: Thread9d3e2240 Proc800974e0 QRAPP2.exeAKY0

IMediaControl的stop方法运行出错,帮忙看下
Data Abort: Thread=9d3e2240 Proc=800974e0 'QRAPP2.exe'
AKY=00100001 PC=02f80f94(quartz.dll+0x00037f94) RA=02f80f90(quartz.dll+0x00037f90) BVA=f800fb70 FSR=00000405
First-chance exception at 0x02f80f94 in QRAPP2.exe: 0xC0000005: 读取位置 0xf800fb70 时发生访问冲突.

我filter连接感觉没错:


CHK( CoCreateInstance(CLSID_FilterGraph, NULL,
CLSCTX_INPROC_SERVER, IID_IGraphBuilder,
(void **)&m_pFilterGraph));

CHK( CoCreateInstance(CLSID_CaptureGraphBuilder, NULL,
CLSCTX_INPROC_SERVER, IID_ICaptureGraphBuilder2, 
(void **)&m_pCaptureGraphBuilder));

CHK( m_pCaptureGraphBuilder->SetFiltergraph(m_pFilterGraph));

CHK( m_pSampleGrabFilter.CoCreateInstance(CLSID_GrabberSample));//CLSID_CSampleGrabber

IGrabberSample *pGrabber = NULL;
CHK( m_pSampleGrabFilter->QueryInterface(IID_IGrabberSample, (void**)&pGrabber));
CHK( pGrabber->SetCallback(&GrabSampleCallback));
if (pGrabber!=NULL)
{
pGrabber->Release();
pGrabber = NULL;
}

CHK( InitCapFilter());

CHK( CoCreateInstance(CLSID_VideoRenderer, NULL,
CLSCTX_INPROC_SERVER, IID_IBaseFilter, 
(void **)&m_pRenderP));

CHK( CoCreateInstance(CLSID_VideoRenderer, NULL,
CLSCTX_INPROC_SERVER, IID_IBaseFilter, 
(void **)&m_pRenderS));

CHK( m_pFilterGraph->AddFilter(m_pVideoCaptureFilter,L"Video Capture Source"));

CHK( m_pFilterGraph->AddFilter(m_pRenderP,L"Video Render1"));

CHK( m_pFilterGraph->AddFilter(m_pRenderS,L"Video Render2"));

CHK( m_pFilterGraph->AddFilter(m_pSampleGrabFilter,L"Grabber"));

CHK( m_pTransformFilter.CoCreateInstance(CLSID_MyVideoMosaic));///CLSID_MyVideoMosaic 

CHK( m_pFilterGraph->AddFilter(m_pTransformFilter,L"Video Mosaic"));///

CHK (SetFormat());


///   hr = m_pCaptureGraphBuilder->RenderStream( &PIN_CATEGORY_STILL, &MEDIATYPE_Video, m_pVideoCaptureFilter, NULL, pImageSinkFilter );
///hr =  pImageSinkFilter.QueryInterface( &m_pImageSinkFilter );

//CHK (ConnectFilters(m_pFilterGraph,m_pVideoCaptureFilter,1,m_pSampleGrabFilter,0,NULL)); // 1 is still pin    NULL ? &pPin  0104

//CHK (ConnectFilters(m_pFilterGraph,m_pSampleGrabFilter,1,m_pRenderS,0,NULL)); // 1 is grab's output pin   0104

CHK(m_pCaptureGraphBuilder->RenderStream(&PIN_CATEGORY_STILL,&MEDIATYPE_Video,m_pVideoCaptureFilter, m_pSampleGrabFilter, m_pRenderS));
///hr = m_pFilterGraph->Render(pPin);

///IPin             *pStillPin = NULL;
///hr = m_pCaptureGraphBuilder->FindPin(m_pVideoCaptureFilter, PINDIR_OUTPUT, &PIN_CATEGORY_PREVIEW, 0,FALSE, 0, &pPin);

CHK (m_pCaptureGraphBuilder->RenderStream(&PIN_CATEGORY_PREVIEW,&MEDIATYPE_Video,m_pVideoCaptureFilter, m_pTransformFilter,m_pRenderP));//m_pTransformFilter m_pRenderP

CHK (m_pRenderP->QueryInterface(IID_IVideoWindow, (void**)&m_pVWP));// 0104

SetupVideoWindow(m_pVWP);

CHK( m_pFilterGraph->QueryInterface(IID_IMediaControl, (void **)&m_pMediaControl));



if(SUCCEEDED(hr))
{
hr = m_pMediaControl->Run();
DWORD dError = GetLastError();
if(FAILED(hr))
{
// stop parts that ran
DWORD dError = GetLastError();
m_pMediaControl->Stop();
return FALSE;
}
///SetupVideoWindow(m_pVWP);

}


[解决办法]
去掉这两名试试:
m_pMediaControl.Release();
m_pMediaControl = NULL;
[解决办法]
各个指针都实例化没有
[解决办法]
看不懂,帮顶~~

热点排行