[PATCH 7/7] amstream: Get rid of *_stream_create_and_initialize functions and Use CoCreateInstance, Initialize, and JoinAMMultiMediaStream instead.

Zebediah Figura zfigura at codeweavers.com
Mon May 25 14:05:26 CDT 2020



On 5/23/20 8:57 AM, Anton Baskanov wrote:
> On Saturday, 23 May 2020 04:11:17 +07 you wrote:
>> On 5/22/20 10:40 AM, Anton Baskanov wrote:
>>> @@ -377,18 +379,26 @@ static HRESULT WINAPI
>>> multimedia_stream_AddMediaStream(IAMMultiMediaStream *ifac> 
>>>      }
>>>      
>>>      if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo))
>>>
>>> -        hr =
>>> ddraw_stream_create_and_initialize((IMultiMediaStream*)iface, PurposeId,
>>> stream_object, This->type, &pStream); +        clsid =
>>> &CLSID_AMDirectDrawStream;
>>>
>>>      else if (IsEqualGUID(PurposeId, &MSPID_PrimaryAudio))
>>>
>>> -        hr =
>>> audio_stream_create_and_initialize((IMultiMediaStream*)iface, PurposeId,
>>> stream_object, This->type, &pStream); +        clsid =
>>> &CLSID_AMAudioStream;
>>>
>>>      else
>>>      
>>>          return MS_E_PURPOSEID;
>>>
>>> -    if (SUCCEEDED(hr))
>>> +    hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER,
>>> &IID_IAMMediaStream, (void **)&pStream); +    if (FAILED(hr))
>>> +        return hr;
>>> +
>>> +    hr = IAMMediaStream_Initialize(pStream, stream_object, dwFlags,
>>> PurposeId, This->type); +    if (FAILED(hr))
>>>
>>>      {
>>>
>>> -        add_stream(This, pStream, ret_stream);
>>>
>>>          IAMMediaStream_Release(pStream);
>>>
>>> +        return hr;
>>>
>>>      }
>>>
>>> +    add_stream(This, pStream, ret_stream);
>>> +    IAMMediaStream_Release(pStream);
>>> +
>>>
>>>      return hr;
>>>  
>>>  }
>>
>> I guess I'm not very opposed to this, but it'd be nice to know at least
>> if there's an application that depends on this structure.
> 
> I don't know any such application, I just wanted to use this in my seeking 
> tests, so that I can add more than 2 streams. 
> 

Okay, thanks.

I don't think it makes a lot of sense to use CoCreateInstance()
internally—we'd just be introducing overhead by making COM look up a
class we already know the location of. But the rest of these patches are
reasonable enough.



More information about the wine-devel mailing list