Imediaobject::ProcessOutput() return error.

Hi,
I am developmenting an app that will invoke the interface of mp3 decoder DMO to render mp3 file on smartphone. While invoking Imediaobject::ProcessOutput() , there is an error, it return 0x8000FFFF(E_UNEXPECTED). But if I invoke Imediaobject::AllocateStreamingResources() before Imediaobject::ProcessInput() and Imediaobject::ProcessOutput(), Imediaobject::ProcessOutput() just return S_FALSE and pBufferStruct.dwStatus = 0x01000005. What is the reason? Is the allocated buffer too small? The size of buffer is from Imediaobject::GetInputSizeInfo() and GetOutputSizeInfo(). The following is my code:

hr = m_pObject->ProcessInput (0, m_pBuffer, DMO_INPUT_DATA_BUFFERF_TIMELENGTH, rtStart, rtStop - rtStart);
if (FAILED(hr))
{
DEBUGMSG(TRUE, (TEXT("ProcessInput() error!\n")));
goto Error;
}

//release input buffer
SAFE_RELEASE (m_pBuffer);

LONG outSize;
// retrieve the output data from DMO and put into pOut
if(S_FALSE == hr)
{
DEBUGMSG(TRUE, (TEXT("ProcessInput() return S_FALSE!\n")));
hr = E_FAIL;
goto Error;
}
else
{
hr = m_pObject->GetOutputSizeInfo (0, &dwSize, &dwAlign);

hr = CreateBuffer (dwSize, &pOutputBuffer);
if (FAILED(hr))
{
return hr;
}

dataBufferStruct.pBuffer = pOutputBuffer;
dataBufferStruct.dwStatus = 0; // No flag is set
dataBufferStruct.rtTimestamp = 0; // not used in ProcessOutput()
dataBufferStruct.rtTimelength = 0; // not used in ProcessOutput()

*pOutSize = dwSize;
*ppbOutData = new BYTE[dwSize];
if (*ppbOutData == 0)
{
return E_OUTOFMEMORY;
}

//process until no more data
if (SUCCEEDED(hr))
{
do
{
hr = m_pObject->ProcessOutput (DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER, 1, &dataBufferStruct, &dwStatus );
/*if (FAILED(hr))
{
return hr;
}*/

// if (SUCCEEDED(hr) && (hr != S_FALSE))
// {
hr = dataBufferStruct.pBuffer->GetBufferAndLength(&pOut, &ulSize);
if (FAILED(hr))
{
return hr;
}

CopyMemory(*ppbOutData, pOut, dwSize);

hr = dataBufferStruct.pBuffer->SetLength( 0 );
// }

} while (dataBufferStruct.dwStatus & DMO_OUTPUT_DATA_BUFFERF_INCOMPLETE);
}
if (FAILED(hr))
{
DEBUGMSG(TRUE, (TEXT("ProcessOutputs() error!\n")));
goto Error;
}
}

[2505 byte] By [yaxixi] at [2007-12-22]
# 1

IMediaObjects (otherwise known as DMOs) are part of the DirectShow multimedia API, which isn't covered on this forum. I might try posting this question to the DirectShow forum (http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=129&SiteID=1) or the Windows Media SDKs newsgroup (http://www.microsoft.com/windows/windowsmedia/community/newsgroups/WindowsMedia/default.mspx?dg=microsoft.public.windowsmedia.sdk&lang=en&cr=US)

That said, I'll just throw out a guess as to what your problem might be -- Have you made sure to negotiate the input and output media types to your DMO? ProcessInput/ProcessOutput won't work without those.

Good luck,

Becky

BeckyWeiss-MSFT at 2007-8-30 > top of Msdn Tech,Audio and Video Development,Media Foundation Development...