On Sat Mar 22 04:38:27 2025 +0000, Ziqing Hui wrote:
Basically, I do this because we are already doing this in reader, see [reader.c](https://gitlab.winehq.org/wine/wine/-/blob/master/dlls/mfreadwrite/reader.c?...). But like you said, the only situation we need an encoder is that the input type is uncompressed and stream type is compressed, it should be ok to check that. Do you think we should check the type rather than try creating it? Maybe with something like this:
uncompressed_types = {...}; bool is_type_compressed(GUID *subtype) { for (i : uncompressed_types) if is equal guid, return false; return true; } sink_writer_SetInputMediaType { use_encoder = !input_compressed && stream_compressed; ... if (!(flags & MF_MEDIATYPE_EQUAL_FORMAT_DATA)) hr = stream_create_transforms(stream, type, stream_type, use_encoder); }
I don't find any api that can check if a subtype is compressed or not.
When I was implementing the code that check whether a type is compressed or not, I changed my mind. In our situation here, the best way to check if a subtype is compressed is to use MFEnumEx to enumrate encoder for it, so try calling `stream_create_transforms()` is the correct way I think, because it will enum encoder for it first. Having a type list, and checking the list to decide if a type is compressed is urly.