[PATCH 4/6] winegstreamer: Implement WMA decoder SetOutputType.

Rémi Bernon rbernon at codeweavers.com
Wed Feb 2 17:05:12 CST 2022


On 2/2/22 23:14, Zebediah Figura wrote:
> On 2/2/22 06:28, Rémi Bernon wrote:
>> +    if (IsEqualGUID(&subtype, &MFAudioFormat_Float))
>> +        sample_size = 32;
>> +    else if (IsEqualGUID(&subtype, &MFAudioFormat_PCM))
>> +        sample_size = 16;
>> +    else
>> +    {
>> +        FIXME("Subtype %s not implemented!\n", debugstr_guid(&subtype));
>> +        hr = E_NOTIMPL;
>> +        return hr;
>> +    }
> 
> This seems a bit redundant :-)
> 

A bit indeed, though one could add a new element to 
wma_decoder_output_types and miss this corner case.

>> +
>> +    if (FAILED(IMFMediaType_SetUINT32(decoder->input_type, 
>> &MF_MT_AUDIO_BITS_PER_SAMPLE, sample_size)))
>> +        return MF_E_INVALIDMEDIATYPE;
>> +
>> +    if (FAILED(IMFMediaType_GetItemType(type, 
>> &MF_MT_AUDIO_AVG_BYTES_PER_SECOND, &item_type)) ||
>> +        item_type != MF_ATTRIBUTE_UINT32)
>> +        return MF_E_INVALIDMEDIATYPE;
>> +    if (FAILED(IMFMediaType_GetItemType(type, 
>> &MF_MT_AUDIO_BITS_PER_SAMPLE, &item_type)) ||
>> +        item_type != MF_ATTRIBUTE_UINT32)
>> +        return MF_E_INVALIDMEDIATYPE;
>> +    if (FAILED(IMFMediaType_GetItemType(type, 
>> &MF_MT_AUDIO_NUM_CHANNELS, &item_type)) ||
>> +        item_type != MF_ATTRIBUTE_UINT32)
>> +        return MF_E_INVALIDMEDIATYPE;
>> +    if (FAILED(IMFMediaType_GetItemType(type, 
>> &MF_MT_AUDIO_SAMPLES_PER_SECOND, &item_type)) ||
>> +        item_type != MF_ATTRIBUTE_UINT32)
>> +        return MF_E_INVALIDMEDIATYPE;
>> +    if (FAILED(IMFMediaType_GetItemType(type, 
>> &MF_MT_AUDIO_BLOCK_ALIGNMENT, &item_type)) ||
>> +        item_type != MF_ATTRIBUTE_UINT32)
>> +        return MF_E_INVALIDMEDIATYPE;
>> +
>> +    if (!decoder->output_type && FAILED(hr = 
>> MFCreateMediaType(&decoder->output_type)))
>> +        return hr;
>> +
>> +    if (FAILED(hr = IMFMediaType_CopyAllItems(type, (IMFAttributes 
>> *)decoder->output_type)))
>> +        goto failed;
> 
> This also seems redundant, being the only user of this label.
> 

There's going to be a second failure path later when it will need to 
create the unixlib object. Although both could probably be combined, it 
felt nicer to have two separate ifs + goto failed.

-- 
Rémi Bernon <rbernon at codeweavers.com>



More information about the wine-devel mailing list