[PATCH v2 1/4] winegstreamer: Introduce audio conversion transform.

Zebediah Figura (she/her) zfigura at codeweavers.com
Wed Dec 2 11:07:29 CST 2020


On 12/1/20 3:57 PM, Derek Lesho wrote:
> 
> On 12/1/20 3:00 PM, Zebediah Figura (she/her) wrote:
>>
>>> +HRESULT mfplat_DllRegisterServer(void)
>>> +{
>>> +    unsigned int i;
>>> +    HRESULT hr;
>>> +
>>> +    for (i = 0; i < ARRAY_SIZE(mfts); i++)
>>> +    {
>>> +        const struct mft *cur = &mfts[i];
>>> +
>>> +        MFT_REGISTER_TYPE_INFO *input_types, *output_types;
>>> +        input_types = heap_alloc(cur->input_types_count *
>>> sizeof(input_types[0]));
>>> +        output_types = heap_alloc(cur->output_types_count *
>>> sizeof(output_types[0]));
>> Separately, I think it'd be better just to use MFT_REGISTER_TYPE_INFO
>> directly in your "struct mft", and avoid allocation. It'd have to be
>> non-const (or duplicate GUID definitions), but I think that's less
>> awkward on the whole.
> I'm trying to implement this now, but I'm having trouble with it.
> MFT_REGISTER_TYPE_INFO consists of GUID value fields, not GUID pointer
> fields.  I'm not sure if there's a clean way to fill GUID fields of a
> struct in an initialization list, even when the array is not const.  I
> definitely don't want to duplicate the GUID definitions, that would be
> ugly.  Also, I'm not sure I necessarily I agree this solution is better
> than just having some heap allocations in DllRegisterServer, it's not in
> what I would call a hotpath.

Performance isn't really the concern—it's more code, and you really
should be handling allocation failure.

Another solution could be to just use a fixed-size stack buffer.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x0D9D358A07A17840.asc
Type: application/pgp-keys
Size: 1769 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20201202/b914bcc1/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20201202/b914bcc1/attachment.sig>


More information about the wine-devel mailing list