Quantcast
Channel: Media Foundation Development for Windows Desktop forum
Viewing all articles
Browse latest Browse all 1079

Rate control in custom source

$
0
0

I am implementing a custom source to admit h264 files directly in the Media Foundation pipeline. The custom source works Ok using the MFPlayback2 sample to embed the custom source.

A step forward is to implement rate control and support for the custom control. To do that, the custom source implements the interfaces IMFGetService, IMFRateSupport, and IMFRateControl. I use the method QueryInterface of the custom media source to return an interface for IMFGetService. For getting an interface for IMFRateControl, I use the the method GetService, as follows:

IFACEMETHODIMP NVRSource::GetService(REFGUID guidService, REFIID riid, LPVOID *ppvObject)
{
    HRESULT hr = MF_E_UNSUPPORTED_SERVICE;

    if (guidService == MF_RATE_CONTROL_SERVICE)
    {
        if (riid == IID_IMFRateControl)
        {
            *ppvObject = static_cast<IMFRateControl*>(this);
            hr = S_OK;
        }
        if (riid == IID_IMFRateSupport)
        {
            *ppvObject = static_cast<IMFRateSupport*>(this);
            hr = S_OK;
        }
    }
    return hr;
}

The first time the application enters this method for getting an IMFRateSupport interface, it crashes because a stack problem. If I try to put the call to the IMFRateSupport interface in QueryInterface, the application doesn't crash, but no interface is returned.

Any idea of what is happening? Thanks a lot in advance.


Viewing all articles
Browse latest Browse all 1079

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>