Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6932231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:40:47+00:00 2026-05-27T11:40:47+00:00

I have created a filter graph manually in a Directshow experiment. Here, I have

  • 0

I have created a filter graph manually in a Directshow experiment. Here, I have added a video source filter and a VMR-9 renderer. The Video Window of the Renderer does not move, minimize, close until the video reaches end of file. If I directly render the source filter, this does not occur. I need a solution to this.

while(1)
{

    IGraphBuilder *pGraph = NULL;
    IMediaControl *pControl = NULL;
    IMediaEvent   *pEvent = NULL;
    IBaseFilter   *pInputFileFilter = NULL;
    IBaseFilter   *pVideoRenderer = NULL;
    IPin          *pFileOut = NULL, *pVidIn = NULL;
    IVideoWindow *VidWindow=NULL;


    string s=openfilename();
    wstring ws;
    ws.assign (s.begin (), s.end ());



     // Initialize the COM library.
     HRESULT hr = CoInitialize(NULL);
     if (FAILED(hr))
     {
         printf("ERROR - Could not initialize COM library");
        return 1;
     }

    // Create the filter graph manager and query for interfaces.
     hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, 
                        IID_IGraphBuilder, (void **)&pGraph);
    if (FAILED(hr))
    {
       printf("ERROR - Could not create the Filter Graph Manager.");
       return 1;
    }

    hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
    hr = pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);
    // And add the filter to the filter graph
            // using the member function AddFilter.
    hr = pGraph->AddSourceFilter(ws.c_str(), ws.c_str(), &pInputFileFilter);
    if (SUCCEEDED(hr))
    {

        // Now create an instance of the video renderer
        // and obtain a pointer to its IBaseFilter interface.
        hr = CoCreateInstance(CLSID_VideoMixingRenderer9,NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, 
                          (void **)&pVideoRenderer);
        if (SUCCEEDED(hr)) 
        {
            hr = pGraph->AddFilter(pVideoRenderer, L"Video Renderer");
            //pVideoRenderer->QueryInterface(IID_IVideoWindow,(void**)&VidWindow);
            if (SUCCEEDED(hr)) 
            {
                // Now we need to connect the output pin of the source 
            // to the input pin of the renderer.
            // Obtain the output pin of the source filter.
            // The local function GetPin does this.
                 pFileOut = GetPin(pInputFileFilter, PINDIR_OUTPUT);

                 if (pFileOut != NULL) 
                {  // Is the pin good?

                      // Obtain the input pin of the WAV renderer.
                        // Obtain the input pin of the WAV renderer.
                        pVidIn = GetPin(pVideoRenderer, PINDIR_INPUT);
                        if (pVidIn != NULL) 
                        {  // Is the pin good?

                            // Connect the pins together:
                            // We use the Filter Graph Manager's
                    // member function Connect,
                    // which uses Intelligent Connect.
                    // If this fails, DirectShow couldn't 
                    // render the media file.
                             hr = pGraph->Connect(pFileOut, pVidIn);
                         }
                 }
            }
        }
    }





    if (SUCCEEDED(hr))
    {
        //VidWindow->put_FullScreenMode(OATRUE);
        //VidWindow->put_Owner(NULL);
      // Run the graph.
        hr = pControl->Run();

        if (SUCCEEDED(hr))
        {

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

            // Note: Do not use INFINITE in a real application, because it
         // can block indefinitely.
        }
        hr = pControl->Stop();

    }
     // Now release everything we instantiated--
    // that is, if it got instantiated.
    if(pFileOut) 
    {                // If it exists, non-NULL
        pFileOut->Release();    // Then release it
    }
    if (pVidIn) 
    {
        pVidIn->Release();
    }
    if (pInputFileFilter) 
    {
        pInputFileFilter->Release();
    }
    if (pVideoRenderer)
    {
        pVideoRenderer->Release();
    }

    //VidWindow->Release();
    pControl->Release();
    pEvent->Release();
    pGraph->Release();
    CoUninitialize();

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:40:48+00:00Added an answer on May 27, 2026 at 11:40 am

    Look into your code at the fragment:

    // Do not use INFINITE in a real application, because it
    // can block indefinitely.
    

    This is where you are expected to add a message loop and dispatch messages. This is going to bring some awaited life into your application. You can poll for completion or register your window to receive a message when such completion occurs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DirectShow filter created with Delphi Pro 6 and the DSPACK direct
I have a problem with connecting to remote graph from DirectShow Filter Graph Editor.
I just have simple filter graph whick takes media streams from rtsp source[ generally
Does python have the ability to create dynamic keywords? For example: qset.filter(min_price__usd__range=(min_price, max_price)) I
Some background: I am attempting to create a DirectShow source filter based on the
How do I create a simple video effect filter for DirectShow or DMO? What
Hello I have created a filter for my list. In a template named _search.gsp
I have created a filter toolbar based on this example . I have an
I just create a simple Graph Source Filter [ MPEG4 || H264 ] ---->
I have created a filter listview where user will enter input via edittext and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.