On Tue Feb 25 09:31:08 2025 +0000, Nikolay Sivov wrote:
Either commit message is confusing, or there is something else missing. The message says "allow attribute to be missing", but it was never checked before and its value is not used in your change. Is the the idea that we either have MT_USER_DATA or MT_AM_FORMAT_TYPE? Docs seem to imply that a little bit.
The function already has everything needed to support a `MT_AM_FORMAT_TYPE` value of `GUID_NULL`, but it is not being accepted. As you can see in the tests, it should be returning `S_OK` when `MT_AM_FORMAT_TYPE` is `GUID_NULL` (or missing, as `GUID_NULL` is the implied default), but instead it is returning an error (hence the `todo_wine` prior to the fix).
The issue is with the following `if` statement:
```c !IsEqualGUID(&subtype, &MFAudioFormat_PCM) && !IsEqualGUID(&subtype, &MFAudioFormat_Float) ```
it will return an error when subtype is neither PCM or Float. But it should also consider the value of `MT_AM_FORMAT_TYPE` and allow `GUID_NULL` (whether explicitly set or implied by not being set at all).
So the I've modified the if statement to allow `GUID_NULL` by saying in addition to subtype being neither PCM or Float, `MT_AM_FORMAT_TYPE` must be explicitly set and must be a value other than `GUID_NULL`. Otherwise we'll allow it. Hence I've modified `MFCreateWaveFormatExFromMFMediaType` to allow `MF_MT_AM_FORMAT_TYPE` to be missing or set to `GUID_NULL`.