How should I correctly set the MFPKEY_WMRESAMP_CHANNELMTX property of the Audio Resampler DSP?
Neal Mayer
1
Reputation point
I am creating a Audio Resampler DSP transform node in a Media Foundation topology. When I try to set the MFPKEY_WMRESAMP_CHANNELMTX property I get an error: 0xc00d6d6b : The property value is out of range for this transform.
Here is my code:
HRESULT hr;
IMFTransform* pResamplerMFT = nullptr;
IPropertyStore* pResamplerProperties = nullptr;
CoCreateInstance(CLSID_CResamplerMediaObject, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown, (void**)&pResamplerMFT);
pResamplerMFT->QueryInterface(IID_PPV_ARGS(&pResamplerProperties));
SAFEARRAY* pMixMatrix = SafeArrayCreateVector(VT_I4, 0, 4); // VT_I4 is a signed integer, i.e. INT32
for (long i = 0; i < 4; i++)
{
INT32 temp = 65536;
hr = SafeArrayPutElement(pMixMatrix, &i, &temp);
}
PROPVARIANT propVar;
propVar.vt = VT_I4 | VT_ARRAY;
propVar.parray = pMixMatrix;
hr = pResamplerProperties->SetValue(MFPKEY_WMRESAMP_CHANNELMTX, propVar);
// hr = 0xc00d6d6b : The property value is out of range for this transform.
(Note: The INT32 values in the SAFEARRAY are just place holders for now until I can get this code working.)
I tried using IWMResamplerProps::SetUserChannelMtx but that returned E_FAIL.
I have spent 3 days searching the web for any code examples of using this transform and setting this property and have found nothing.