STDMETHODIMP MFTransform::ProcessMessage(MFT_MESSAGE_TYPE eMessage, ULONG_PTR ulParam)
{
    Q_UNUSED(ulParam);

    HRESULT hr = S_OK;

    switch (eMessage)
    {
    case MFT_MESSAGE_COMMAND_FLUSH:
        hr = OnFlush();
        break;

    case MFT_MESSAGE_COMMAND_DRAIN:
        // Drain: Tells the MFT not to accept any more input until
        // all of the pending output has been processed. That is our
        // default behevior already, so there is nothing to do.
        break;

    case MFT_MESSAGE_SET_D3D_MANAGER:
        // The pipeline should never send this message unless the MFT
        // has the MF_SA_D3D_AWARE attribute set to TRUE. However, if we
        // do get this message, it's invalid and we don't implement it.
        hr = E_NOTIMPL;
        break;

    // The remaining messages do not require any action from this MFT.
    case MFT_MESSAGE_NOTIFY_BEGIN_STREAMING:
    case MFT_MESSAGE_NOTIFY_END_STREAMING:
    case MFT_MESSAGE_NOTIFY_END_OF_STREAM:
    case MFT_MESSAGE_NOTIFY_START_OF_STREAM:
        break;
    }

    return hr;
}
void ArdunityController::flush()
{
    started = true;
	if(canFlush && _enableUpdate && dirty)
	{
		ArdunityApp.select(_id);
		OnFlush();
		dirty = false;
		ArdunityApp.flush();
	}
}
HRESULT CHWMFT::ProcessMessage(
    MFT_MESSAGE_TYPE eMessage,
    ULONG_PTR ulParam)
{
    /*****************************************
    ** See http://msdn.microsoft.com/en-us/library/ms701863(v=VS.85).aspx
    *****************************************/

    HRESULT hr = S_OK;

    do
    {
        if(IsLocked() != FALSE)
        {
            hr = MF_E_TRANSFORM_ASYNC_LOCKED;
            break;
        }

        if((m_pInputMT == NULL) || (m_pOutputMT == NULL))
        {
            // Can't process messages until media types are set
            hr = MF_E_TRANSFORM_TYPE_NOT_SET;
            break;
        }

        switch(eMessage)
        {
        case MFT_MESSAGE_NOTIFY_START_OF_STREAM:
            {
                hr = OnStartOfStream();
                if(FAILED(hr))
                {
                    break;
                }
            }
            break;
        case MFT_MESSAGE_NOTIFY_END_OF_STREAM:
            {
                hr = OnEndOfStream();
                if(FAILED(hr))
                {
                    break;
                }
            }
            break;
        case MFT_MESSAGE_COMMAND_DRAIN:
            {
                hr = OnDrain((UINT32)ulParam);
                if(FAILED(hr))
                {
                    break;
                }
            }
            break;
        case MFT_MESSAGE_COMMAND_FLUSH:
            {
                hr = OnFlush();
                if(FAILED(hr))
                {
                    break;
                }
            }
            break;
        case MFT_MESSAGE_COMMAND_MARKER:
            {
                hr = OnMarker(ulParam);
                if(FAILED(hr))
                {
                    break;
                }
            }
            break;
        /************************************************
        ** Todo: Add any MFT Messages that are not already
        ** covered
        ************************************************/
        default:
            // Nothing to do, return S_OK
            break;
        };
    }while(false);

    return hr;
}