www.webdeveloper.com
Results 1 to 2 of 2

Thread: a prb. related to DirectShow using VC++

  1. #1
    Join Date
    May 2004
    Location
    Pakistan
    Posts
    13

    a prb. related to DirectShow using VC++

    hi, I've copied some code (that plays .avi file) from DirectX SDK and can't run it. There is a metheod CoCreateInstance() that accepts a parameter CLSID_FilterGraph, and my compiler says, "Unresolved External". Along with the above mentioned, there are other externals
    IID_IGraphBuilder
    IID_IMediaControl
    IID_IMediaEvent

    what should I do ? ? ? ?

  2. #2
    Join Date
    May 2004
    Location
    Pakistan
    Posts
    13

    the prog. code

    well, I think I should place the code here, here it is

    void main()
    {
    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);
    }
    }
    pControl->Release();
    pEvent->Release();
    pGraph->Release();
    CoUninitialize();
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles