Question On Media Foundation RRS feed

  • Question

  • Hi,

    I am trying to develop an application based on media foundation to play mpeg-1 stream. I have registered the MPG-1 souce sample  available in msdn.

    here's code snippet from my application

    RESULT MYClass::CreateMediaSource(PCWSTR sURL)


        IMFSourceResolver* pSourceResolver = NULL;
        IUnknown* pSource = NULL;


        HRESULT hr = MFCreateSourceResolver(&pSourceResolver);
        if (FAILED(hr))
    printf(" MFCreateSourceResolver failed");
            goto done;

        hr = pSourceResolver->CreateObjectFromURL(
                    sURL,                       // URL of the source.
                    MF_RESOLUTION_MEDIASOURCE,// Create a source object.
                    NULL,                       // Optional property store.
                    &ObjectType,                // Receives the created object type.
                    &pSource                    // Receives a pointer to the media source.

        if (FAILED(hr))
            printf("CreateObjectFromURL failed");
            goto done;

        // Get the IMFMediaSource interface from the media source.
        hr = pSource->QueryInterface(IID_PPV_ARGS(&m_pSource));

    the createobjectfrom URL functions fails with error code MF_E_UNSUPPORTED_BYTESTREAM_TYPE.

    I tried by replacing MF_RESOLUTION_MEDIASOURCE in createobjectfromurl to MF_RESOLUTION_BYTESTREAM ,then the createobjectfromurl returns Success but the application is unable to play any other file and the query interface returns an error.

    please help

    Tuesday, April 17, 2012 8:34 AM

All replies