1

Directshow can't play mp4 default.

I found GDCL MPEG-4 and it seems to decode mp4 file.

But sample is not found.

Could anyone tell me how to play mp4 with directshow using GDCL MPEG-4.

I have simple directshow sample below.

#include <iostream>
#include <dshow.h>


int 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 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);

    // Build the graph. IMPORTANT: Change this string to a file on your system.
    hr = pGraph->RenderFile(L"..\\BigBuckBunny360.wmv", 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.
        }
        else 
        {
            std::cout << std::system_category().message(hr) << std::endl;
        }
    }
    else
    {
        std::cout << std::system_category().message(hr) << std::endl;
    }
    pControl->Release();
    pEvent->Release();
    pGraph->Release();
    CoUninitialize();

    return 0;
}

I want to know usage of GDCL MPEG-4 with upper sample.

BigRiver
  • 11
  • 1

0 Answers0