Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


calling all directshow coders, i'm drivven crazy!

This topic is 5810 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Calling all coders in the world please tell me why on earth this fragment is not working, target is to play vedio mpeg1 on ddraw surface7 , using overlay. i''m in rush of time and i tried my best. this is the last chance i think.. thank you for advance. // the code. extern CDirectDrawIntApp theApp; extern LPDIRECTDRAW7 lpDD; extern LPDIRECTDRAWSURFACE7 lpDDSBack,lpDDSBack2; extern LPDIRECTDRAWSURFACE7 lpDDSPrimary; extern short scrW,scrH,scrD; ////////////////////////////////////////////////////////////////////// CProgram::CProgram() { // my classes dd = new DDObject(&dlg); sound = new CSound; di = new CDIObject; // for vedio IGraphBuilder *pGraph; IMediaControl *pMediaControl; IMediaEvent *pEvent; IBaseFilter** p_overlay; IBaseFilter* overlay; IBaseFilter* pVR; CoInitialize(NULL); hr=CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&pGraph); hr=CoCreateInstance(CLSID_OverlayMixer, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void **)p_overlay); overlay = *p_overlay; hr=pGraph->AddFilter(overlay,L"Overlay Mixer"); hr=pGraph->QueryInterface(IID_IMediaControl, (void **)&pMediaControl); hr=pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent); // settingthe full-screen mode.. dd->SetDisplayMode(true,32); dd->CreateSurfaces(); ::ShowCursor(false); // i used the old calsses then QuereyInterface IDDrawExclModeVideo *full; LPDIRECTDRAW lpDD1; LPDIRECTDRAWSURFACE lpDDSPrimary1; hr=lpDD->QueryInterface(IID_IDirectDraw, (void **)&lpDD1); hr=lpDDSPrimary->QueryInterface(IID_IDirectDrawSurface, (void **)&lpDDSPrimary1); hr=overlay->QueryInterface(IID_IDDrawExclModeVideo, (void **)&full); hr=full->SetDDrawObject(lpDD1); hr=full->SetDDrawSurface(lpDDSPrimary1); hr=pGraph->RenderFile(L"C:\\1.MPG", NULL); // some connections IEnumPins *pEnumPins ; IPin *pPinVR ; IPin *pPinConnectedTo ; IPin *pPinOvM ; ULONG ul ; PIN_DIRECTION pd ; hr==pGraph->FindFilterByName(L"Vedio Renderer", &pVR) ; // Get the video renderer''s (only) in pin { hr = pVR->EnumPins(&pEnumPins) ; } hr = pEnumPins->Next(1, &pPinVR, &ul) ; pPinVR->QueryDirection(&pd) ; pEnumPins->Release() ; // Disconnect VR from upstream filter and put OvMixer in between them hr = pPinVR->ConnectedTo(&pPinConnectedTo) ; hr = pGraph->Disconnect(pPinVR) ; hr = pGraph->Disconnect(pPinConnectedTo) ; // Now connect the upstream filter''s out pin to OvM''s in pin // (and remove Video Renderer from the graph). hr = overlay->EnumPins(&pEnumPins) ; int iInConns = 0 ; while (iInConns == 0 && // input pin not connected yet S_OK == pEnumPins->Next(1, &pPinOvM, &ul) && 1 == ul) // pin left to try { pPinOvM->QueryDirection(&pd) ; if (PINDIR_OUTPUT == pd) { pGraph->Render(pPinOvM); } if (PINDIR_INPUT == pd) // OvM''s in pin <- Upstream filter''s pin { if (0 == iInConns) // We want to connect only one input pin { hr = pGraph->Connect(pPinConnectedTo, pPinOvM) ; // , NULL) ; // direct?? if(FAILED(hr)); else { iInConns++ ; } } // else ignore } pPinOvM->Release() ; } pEnumPins->Release() ; pPinConnectedTo->Release() ; // done with upstream pin hr=pGraph->RemoveFilter(pVR) ; // by force remove the VR from graph

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!