X
Hallo @ all
ich versuche grade mit DirectShow und der VMR-9 ein avi im windowless mode azuspielen. Ich kanns zwar schon abspielen aber es sieht leider nicht ganz so toll aus, den wenn es angezeigt wird habe ich artefakteim Bild. Mit MPEG klappt es wird alles korrekt angezeigt nur beim avi macht er in der mitte so komische artefakte. Hier mal mein Code:
VMR9NormalizedRect *r;
IVMRWindowlessControl9 *pWC;
IVMRMixerControl9 *pMix;
IGraphBuilder *pGB;
IBaseFilter *pVmr;
IVMRFilterConfig9 *pConfig;
IMediaControl *pMC;
IMediaSeeking *pMS;
CoInitialize(NULL);
// initialize video coordinates with normal values
r = new VMR9NormalizedRect;
r->left = 0;
r->top = 0;
r->right = 1;
r->bottom = 1;
pWC = NULL;
pMix = NULL;
pGB = NULL;
pVmr = NULL;
pConfig = NULL;
pMC = NULL;
pMS = NULL;
ICaptureGraphBuilder2 *pCaptureGraphBuilder2;
// create an instance of the Filter Graph Manager
CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC,
IID_IGraphBuilder, (void **)&pGB);
// create an instance of the VMR9 filter
CoCreateInstance(CLSID_VideoMixingRenderer9, NULL, CLSCTX_INPROC_SERVER,
IID_IBaseFilter, (void**)&pVmr);
// add the VMR9 filter to the Graph Manager
pGB->AddFilter(pVmr, L"Video");
// get a pointer to the IVMRFilterConfig9 interface
pVmr->QueryInterface(IID_IVMRFilterConfig9, (void**)&pConfig);
// make sure VMR9 is in windowless mode
pConfig->SetRenderingMode(VMR9Mode_Windowless);
// get a pointer to the IVMRWindowlessControl9 interface
pVmr->QueryInterface(IID_IVMRWindowlessControl9, (void**)&pWC);
// explicitly convert System::Drawing::Rectangle type to RECT type
pWC->SetVideoClippingWindow(m_hWnd);
// set destination rectangle for the video
long lWidth, lHeight;
pWC->GetNativeVideoSize(&lWidth, &lHeight, NULL, NULL);
pWC->SetVideoPosition(CRect(0,0,lWidth,lHeight), CRect(10,10,200,200));
// specify the container window that the video should be clipped to
// IVMRMixerControl manipulates video streams
pVmr->QueryInterface(IID_IVMRMixerControl9, (void**)&pMix);
// IMediaSeeking seeks to a position in the video stream
pGB->QueryInterface(IID_IMediaSeeking, (void **)&pMS);
// IMediaControl controls flow of data through the graph
pGB->QueryInterface(IID_IMediaControl, (void **)&pMC);
IBaseFilter *pSource;
pGB->AddSourceFilter(L"c:\\test.avi", L"Source", &pSource);
// Create GraphBuilder, CaptureGraphBuilder2
CoCreateInstance(CLSID_CaptureGraphBuilder2, NULL, CLSCTX_INPROC_SERVER,
IID_ICaptureGraphBuilder2,
(LPVOID *)&pCaptureGraphBuilder2);
// Set FilterGraph for CaptureGraphBuilder2
pCaptureGraphBuilder2->SetFiltergraph(pGB);
// Build Graph
pCaptureGraphBuilder2->RenderStream(0, 0, pSource, 0, pVmr);
// Start playing
//
// pGB->RenderFile(L"C:\\Movie\\DRS\\DRS.MPG",0);
pMC->Run();
jemand von euch ne idee was los ist????