Configuring a Media Source

When you use the Source Resolver to create a media source, you can specify a property store that contains configuration properties. These properties will be used to initialize the media source. The set of supported properties depends on the implementation of the media source. Not every media source defines configuration properties.

The following table lists the configuration properties for the media sources that are provided in Media Foundation. Third-party media sources can define their own custom properties.

Media sourceProperties
Network sourceSee Network Source Features.
ASF media source


To configure a source, perform the following steps.

  1. Call PSCreateMemoryPropertyStore to create a new property store. This function returns an IPropertyStore pointer.
  2. Call IPropertyStore::SetValue to set one or more configuration properties.
  3. Call one of the source resolver's creation functions, such as IMFSourceResolver::CreateObjectFromURL, and pass the IPropertyStore pointer in the pProps parameter.

// Creates a media source from a URL.

HRESULT CreateMediaSource(
    PCWSTR pszURL, 
    IPropertyStore *pConfig,    // Optional, can be NULL
    IMFMediaSource **ppSource
    IMFSourceResolver* pSourceResolver = NULL;
    IUnknown* pSource = NULL;

    // Create the source resolver.
    HRESULT hr = MFCreateSourceResolver(&pSourceResolver);

    // Use the source resolver to create the media source.
    if (SUCCEEDED(hr))
        MF_OBJECT_TYPE ObjectType;


        hr = pSourceResolver->CreateObjectFromURL(
            MF_RESOLUTION_MEDIASOURCE,  // Create a media source.
            pConfig,                    // Configuration properties.
            &ObjectType,                // Receives the object type. 

        DbgLog(L"CreateObjectFromURL - FINISHED");


    if (SUCCEEDED(hr))
        hr = pSource->QueryInterface(IID_PPV_ARGS(ppSource));

    return hr;

The source resolver passes the IPropertyStore pointer directly to the scheme handler or byte-stream handler that creates the source. The source resolver makes no attempt to validate the properties.

Generally, these properties are used for advanced settings. If you don't provide a property store, the media source should still function correctly with default settings.

Related topics

Source Resolver