Archived

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

DShow problem when playing FMV

This topic is 5576 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

Sometimes my media/movie won't show on the screen if I use Fullscreen Mode, but it worked fine if I used windowed mode. can somebody tell me why ?? This is the code that I use to play my media file :
void PlayFMV(const unsigned short *fname)
{	IGraphBuilder *pGraph;
    IMediaControl *pMediaControl;
    IMediaEvent   *pEvent;
	IVideoWindow    *pVidWin = NULL;

    CoInitialize(NULL);
    ShowWindow( m_hWnd, SW_SHOWDEFAULT );
	HRESULT hr;		
    UpdateWindow( m_hWnd );
    // Create the filter graph manager and query for interfaces.
    hr=CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, 
                        IID_IGraphBuilder, (void **)&pGraph);
	if(SUCCEEDED(hr))
	{
    pGraph->QueryInterface(IID_IMediaControl, (void **)&pMediaControl);
    pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);
	pGraph->QueryInterface(IID_IVideoWindow, (void **)&pVidWin);

    // Build the graph. IMPORTANT: Change string to a file on your system.
    pGraph->RenderFile((const unsigned short*)fname, NULL);
	
	//Set the video window.
    pVidWin->put_Owner((OAHWND)m_hWnd);
    pVidWin->put_WindowStyle(WS_CHILD);

	pVidWin->put_Visible(OAFALSE);
    RECT grc;
    GetClientRect(m_hWnd, &grc);
    pVidWin->SetWindowPosition(0, 0, grc.right, grc.bottom);

	long lEventCode=0x0000;
    long lParam1;
	long lParam2;

    // Run the graph.
    while(!(m_pDInput->GetAction()&BESCAPE)&&(lEventCode!=EC_COMPLETE))
	{
		
		pMediaControl->Run();
		pVidWin->put_Visible(OATRUE);
		pEvent->GetEvent(&lEventCode,&lParam1,&lParam2,100);
		
		pEvent->FreeEventParams(lEventCode,lParam1,lParam2);
	}

	pMediaControl->Stop();
    // Wait for completion. 
   // long evCode;
    //pEvent->WaitForCompletion(INFINITE, &evCode);

    // Clean up.
    pVidWin->put_Visible(OATRUE);
    pVidWin->put_Owner((OAHWND)m_hWnd);  
	pEvent->Release();
    pMediaControl->Release();
    pVidWin->Release();
    pGraph->Release();
	};
} 
  
I hope it;s not too long, but it's basically ripped from the docs. [edited by - yanuart on September 10, 2002 9:44:42 AM]

Share this post


Link to post
Share on other sites
I''m sorry - I know search is disabled, but this question has been asked over half a dozen times this last week. Please up your new message scan # of days and take a peek at the other messages to look for some possible solutions.

Just to not leave you in the blank, are you setting a proper fullscreen video resolution that uses 24 or 32-bit color depth?



Jim Adams
home.att.net/~rpgbook
Author, Programming Role-Playing Games with DirectX
and Focus On: Advanced Animation with DirectX

Share this post


Link to post
Share on other sites

This topic is 5576 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.

Guest
This topic is now closed to further replies.