[PATCH 1/2] winegstreamer: Support block_alignment attribute mapping.

Zebediah Figura (she/her) zfigura at codeweavers.com
Wed Oct 27 16:32:14 CDT 2021


On 10/27/21 15:57, Rémi Bernon wrote:
> On 10/27/21 10:45 PM, Rémi Bernon wrote:
>> On 10/27/21 10:30 PM, Zebediah Figura (she/her) wrote:
>>> On 10/27/21 10:25, Rémi Bernon wrote:
>>>> Planet Coaster adds this attribute to its media type when loading user
>>>> music in some of the supported formats, and missing it will make media
>>>> type matching only partially succeed.
>>>>
>>>> This will also be useful for WMA/XMA compressed formats.
>>>>
>>>> Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
>>>
>>> Can you please describe what exactly it's doing, in terms of specific 
>>> Media Foundation APIs? As it is I can't tell why you're trying to 
>>> translate this to and from winegstreamer formats.
>>>
>>> Note also that "block_align" is not used by anything in GStreamer for 
>>> PCM formats.
>>>
>>
>> WMA/XMA formats caps need a block_align attribute, applications 
>> specify it in the input media type of the MF transform, and it will 
>> need to be passed to gstreamer decoder plugin input caps.
>>
>> Yes, mapping it in this direction is not very useful right now but I 
>> thought it was better to add the new attribute mapping support all in 
>> the same change. I can split it if that matters.
>>
>> FWIW most other attributes will have no use either in GStreamer for 
>> non-PCM formats, audio/x-wma only has bitrate and block_align for 
>> instance, does it really matters if we map them nonetheless here and 
>> even maps them unconditionally to gst caps?
> 
> Regarding why we need to add the attribute when converting from 
> winegstreamer format, well, like the commit message describes, the game 
> is adding the attribute to its desired media format.
> 
> If we don't add it to the source formats, media_type_is_equal will clear 
> the MF_MEDIATYPE_EQUAL_FORMAT_DATA flag, and 
> source_reader_set_compatible_media_type will never succeed finding an 
> exact match.
> 

Part of the reason I ask is that I'm not so intimately familiar with 
mfplat as to know what "adding the attribute to its desired media 
format" means.

I'm guessing that what happens is that the application either adds a 
MF_MT_AUDIO_BLOCK_ALIGNMENT attribute to the media type returned from 
IMFMediaTypeHandler::GetMediaTypeByIndex(), or constructs its own media 
type with that attribute, and then passes it to 
IMFMediaTypeHandler::SetCurrentMediaType(), and then that the 
mfreadwrite source reader requires this to exactly match one of the 
formats enumerated by the media source. In that case it seems like all 
we really need to do here is patch mf_media_type_from_wg_format(). I 
don't see any reason to do any extra translation or to pass this to the 
winegstreamer backend, since block alignment for PCM should be fully 
dependent on bit depth and channel count.



More information about the wine-devel mailing list