On 11/9/21 21:53, Nikolay Sivov wrote:
On 11/8/21 5:08 PM, Rémi Bernon wrote:
- static const struct media_type_desc audio_44100_s8_desc =
- {
.items =
{
{.key = &MF_MT_AUDIO_AVG_BYTES_PER_SECOND, .value = {.vt = VT_UI4, .ulVal = 44100}, .todo_missing = TRUE},
{.key = &MF_MT_AUDIO_BLOCK_ALIGNMENT, .value = {.vt = VT_UI4, .ulVal = 1}, .todo_missing = TRUE},
{.key = &MF_MT_AUDIO_NUM_CHANNELS, .value = {.vt = VT_UI4, .ulVal = 1}},
{.key = &MF_MT_MAJOR_TYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFMediaType_Audio}},
{.key = &MF_MT_AUDIO_SAMPLES_PER_SECOND, .value = {.vt = VT_UI4, .ulVal = 44100}},
{.key = &MF_MT_AUDIO_PREFER_WAVEFORMATEX, .value = {.vt = VT_UI4, .ulVal = 1}, .todo_missing = TRUE},
{.key = &MF_MT_ALL_SAMPLES_INDEPENDENT, .value = {.vt = VT_UI4, .ulVal = 1}},
{.key = &MF_MT_AUDIO_BITS_PER_SAMPLE, .value = {.vt = VT_UI4, .ulVal = 8}},
{.key = &MF_MT_SUBTYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFAudioFormat_PCM}},
},
.todo_spurious = 1,
- };
When you explicitly checking audio types, you can drop MAJOR_TYPE, PREFER_WAVEFORMATEX, ALL_SAMPLES_INDEPENDENT, or maybe even subtype from static data, because it will always be the same. You can check for these still right in the loop, for all data entries.
Sure but that would be a specific code path in the generic comparison method. I feel like it's just simpler to treat them the same way as the other items and not add any special case.