DirectShow: Help me debug please

This is a discussion on DirectShow: Help me debug please within the C++ Programming forums, part of the General Programming Boards category; The code below is from Microsoft MSDN example for DirectShow: CODE Code: #include <dshow.h> void main(void) { IGraphBuilder *pGraph = ...

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    1

    DirectShow: Help me debug please

    The code below is from Microsoft MSDN example for DirectShow:



    CODE


    Code:
    #include <dshow.h>
    void main(void)
    {
       IGraphBuilder *pGraph = NULL;
       IMediaControl *pControl = NULL;
       IMediaEvent   *pEvent = NULL;
    
       // Initialize the COM library.
       HRESULT hr = CoInitialize(NULL);
       if (FAILED(hr))
       {
           printf("ERROR - Could not initialize COM library");
           return;
       }
    
       // 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;
       }
    
       hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
       hr = pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);
    
       // Build the graph. IMPORTANT: Change this string to a file on your system.
       hr = pGraph->RenderFile(L"C:\\Example.avi", NULL);
       if (SUCCEEDED(hr))
       {
           // 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.
           }
       }
       pControl->Release();
       pEvent->Release();
       pGraph->Release();
       CoUninitialize();
    }

    I have install Directx 9.0 SDK, Platform SDK and include the library needed into project setting (Strmiids.lib and Quartz.lib) Link and Directory (Microsoft DirectX 9.0 SDK (December 2004)\Include).

    This code is run perfectly when playing video file.


    BUT, when i try to add the ICaptureGraphBuilder2 interface to receives the pointer to capture Video:

    ICaptureGraphBuilder2 **ppBuild // Receives the pointer

    It generate errors about some headers file.

    Any1 can help me?

    Is there any header file needed, or i do something wrong with the setting?
    Last edited by newbievn; 02-14-2005 at 01:53 AM.

  2. #2
    Registered User
    Join Date
    Dec 2004
    Location
    The Netherlands
    Posts
    91
    [CODE] tags

  3. #3
    Registered User Micko's Avatar
    Join Date
    Nov 2003
    Posts
    712

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Debugging DirectShow
    By Elysia in forum Windows Programming
    Replies: 0
    Last Post: 10-28-2007, 12:01 PM
  2. makefiles - debug & release?
    By cpjust in forum C Programming
    Replies: 6
    Last Post: 10-26-2007, 05:00 PM
  3. Debug --> Exceptions in Visual Studio 2005
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 08-10-2007, 03:12 AM
  4. Results in Debug and Release mode are different
    By jaro in forum C Programming
    Replies: 11
    Last Post: 05-27-2006, 12:08 PM
  5. Ask about Debug Assert Failed
    By ooosawaddee3 in forum C++ Programming
    Replies: 0
    Last Post: 04-25-2002, 12:07 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21