IPropertyStore_Commit method - is it needed and why isn't it implemented?

1

I'm trying to change the value of a flag in an IPropertyStore. However, my code seems to behave the same way, regardless of the value of the flag.

Is this because my code doesn't call IPropertyStore_Commit after changing the flag?

I did try to call the method, however I got an error code 0x80004001 which means "not implemented". Hence, the second part of my question: why isn't it implemented?


In more detail, I'm working on a Java softphone which makes use of WASAPI (via the JNI) for some of the audio processing. The native code is written in C.

Having recently enabled AES (Acoustic Echo Suppression), I've found that AGC (Automatic Gain Control) is also enabled. I'm trying to disable AGC by setting the MFPKEY_WMAAECMA_FEATR_AGC key on an IPropertyStore object. However, whatever I set the value to be makes no difference.

The relevant code snippets are as follows:

// Obtain the property store
void *pvObject;
HRESULT hr = IMediaObject_QueryInterface((IMediaObject *) thiz, &iid_, &pvObject);
// Do some checking that the store is valid...

// Set the value of the AGC key:
PROPVARIANT propvar = ...
IPropertyStore_SetValue((IPropertyStore *)pvObject, (REFPROPERTYKEY) key, &propvar);

// Call commit - fails, with 0x80004001:
HRESULT hr = IPropertyStore_Commit((IPropertyStore *)pvObject);
winapi
wasapi
ipropertystorage
asked on Stack Overflow Sep 24, 2013 by tjlprice

1 Answer

1

A couple of issues:

  1. I'm not sure what thiz actually is; I'm pretty sure it's not an IMediaObject interface.
  2. You can't just cast from IMediaObject to IPropertyStore; you have to QueryInterface the IMediaObject pointer for IPropertyStore.
  3. You shouldn't need to call IPropertyStore_Commit; at least, not for setting the AGC key.
  4. When you're calling IPropertyStore_SetValue, make sure the PROPVARIANT is initialized correctly. MFPKEY_WMAAECMA_FEATR_AGC is a BOOLEAN property, so your code needs to look something like this:

IMediaObject *pvObject;
HRESULT hr = IUnknown_QueryInterface((IUnknown*) thiz, IID_PPV_ARGS(&pvObject));
if (SUCCEEDED(hr))
{
     IPropertyStore* pvPropStore;
     hr = IMediaObject_QueryInterface(pvObject, IID_PPV_ARGS(&pvPropStore));
     if (SUCCEEDED(hr))
     {
         PROPVARIANT pvFeature;
         PropVariantInit(&pvFeature);
         pvFeature.vt = VT_BOOL;
         pvFeature.boolVal = fValue ? VBTRUE : VBFALSE;

         hr = IPropertyStore_SetValue(pvPropStore, MFPKEY_WMAAECMA_FEATR_AGC, pvFeature);
     }
}
answered on Stack Overflow Sep 24, 2013 by Eric Brown

User contributions licensed under CC BY-SA 3.0