From: Paul Gofman pgofman@codeweavers.com
--- dlls/windows.media.speech/synthesizer.c | 79 ++++++++++++++++++++++++ dlls/windows.media.speech/tests/speech.c | 9 +++ 2 files changed, 88 insertions(+)
diff --git a/dlls/windows.media.speech/synthesizer.c b/dlls/windows.media.speech/synthesizer.c index c2bed2e45b9..206b4007943 100644 --- a/dlls/windows.media.speech/synthesizer.c +++ b/dlls/windows.media.speech/synthesizer.c @@ -155,6 +155,7 @@ struct synthesis_stream { ISpeechSynthesisStream ISpeechSynthesisStream_iface; IRandomAccessStream IRandomAccessStream_iface; + IInputStream IInputStream_iface; LONG ref;
IVector_IMediaMarker *markers; @@ -187,6 +188,13 @@ HRESULT WINAPI synthesis_stream_QueryInterface( ISpeechSynthesisStream *iface, R return S_OK; }
+ if (IsEqualGUID(iid, &IID_IInputStream)) + { + IInputStream_AddRef(&impl->IInputStream_iface); + *out = &impl->IInputStream_iface; + return S_OK; + } + FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); *out = NULL; return E_NOINTERFACE; @@ -396,6 +404,76 @@ static const struct IRandomAccessStreamVtbl synthesis_stream_random_access_vtbl };
+static inline struct synthesis_stream *impl_from_IInputStream( IInputStream *iface ) +{ + return CONTAINING_RECORD(iface, struct synthesis_stream, IInputStream_iface); +} + +static HRESULT WINAPI synthesis_stream_input_QueryInterface( IInputStream *iface, REFIID iid, void **out ) +{ + struct synthesis_stream *impl = impl_from_IInputStream(iface); + + TRACE( "iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out ); + + return ISpeechSynthesisStream_QueryInterface( &impl->ISpeechSynthesisStream_iface, iid, out ); +} + +static ULONG WINAPI synthesis_stream_input_AddRef( IInputStream *iface ) +{ + struct synthesis_stream *impl = impl_from_IInputStream(iface); + + TRACE( "iface %p.\n", iface ); + return ISpeechSynthesisStream_AddRef( &impl->ISpeechSynthesisStream_iface ); +} + +static ULONG WINAPI synthesis_stream_input_Release( IInputStream *iface ) +{ + struct synthesis_stream *impl = impl_from_IInputStream(iface); + + TRACE( "iface %p.\n", iface ); + return ISpeechSynthesisStream_Release( &impl->ISpeechSynthesisStream_iface ); +} + +static HRESULT WINAPI synthesis_stream_input_GetIids( IInputStream *iface, ULONG *iid_count, IID **iids ) +{ + FIXME( "iface %p, iid_count %p, iids %p stub.\n", iface, iid_count, iids ); + return E_NOTIMPL; +} + +static HRESULT WINAPI synthesis_stream_input_GetRuntimeClassName( IInputStream *iface, HSTRING *class_name ) +{ + FIXME( "iface %p, class_name %p stub.\n", iface, class_name ); + return E_NOTIMPL; +} + +static HRESULT WINAPI synthesis_stream_input_GetTrustLevel( IInputStream *iface, TrustLevel *trust_level ) +{ + FIXME( "iface %p, trust_level %p stub.\n", iface, trust_level ); + return E_NOTIMPL; +} + +static HRESULT WINAPI synthesis_stream_input_ReadAsync( IInputStream *iface, IBuffer *buffer, UINT32 count, + InputStreamOptions options, IAsyncOperationWithProgress_IBuffer_UINT32 **operation) +{ + FIXME( "iface %p, buffer %p, count %u, options %d, operation %p stub.\n", iface, buffer, count, options, operation ); + return E_NOTIMPL; +} + +static const struct IInputStreamVtbl synthesis_stream_input_vtbl = +{ + /* IUnknown methods */ + synthesis_stream_input_QueryInterface, + synthesis_stream_input_AddRef, + synthesis_stream_input_Release, + /* IInspectable methods */ + synthesis_stream_input_GetIids, + synthesis_stream_input_GetRuntimeClassName, + synthesis_stream_input_GetTrustLevel, + /* IInputStream methods */ + synthesis_stream_input_ReadAsync +}; + + static HRESULT synthesis_stream_create( ISpeechSynthesisStream **out ) { struct synthesis_stream *impl; @@ -418,6 +496,7 @@ static HRESULT synthesis_stream_create( ISpeechSynthesisStream **out )
impl->ISpeechSynthesisStream_iface.lpVtbl = &synthesis_stream_vtbl; impl->IRandomAccessStream_iface.lpVtbl = &synthesis_stream_random_access_vtbl; + impl->IInputStream_iface.lpVtbl = &synthesis_stream_input_vtbl; impl->ref = 1; if (FAILED(hr = vector_inspectable_create(&markers_iids, (IVector_IInspectable**)&impl->markers))) goto error; diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c index 719c97a52e2..16e80dee036 100644 --- a/dlls/windows.media.speech/tests/speech.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -789,6 +789,7 @@ static void test_SpeechSynthesizer(void) IInstalledVoicesStatic *voices_static = NULL; ISpeechSynthesisStream *ss_stream = NULL, *tmp; IRandomAccessStream *ra_stream; + IInputStream *inp_stream; IVoiceInformation *voice; IInspectable *inspectable = NULL, *tmp_inspectable = NULL; IAgileObject *agile_object = NULL, *tmp_agile_object = NULL; @@ -798,6 +799,7 @@ static void test_SpeechSynthesizer(void) struct async_inspectable_handler async_inspectable_handler; HMODULE hdll; HSTRING str, str2; + UINT64 value; HRESULT hr; UINT32 size; ULONG ref; @@ -946,8 +948,15 @@ static void test_SpeechSynthesizer(void)
hr = ISpeechSynthesisStream_QueryInterface(ss_stream, &IID_IRandomAccessStream, (void **)&ra_stream); ok(hr == S_OK, "QueryInteface(&IID_IRandomAccessStream) failed, hr %#lx\n", hr); + hr = IRandomAccessStream_get_Size(ra_stream, &value); + ok(hr == S_OK, "_get_Size failed, hr %#lx\n", hr); + todo_wine ok(value, "got 0.\n"); IRandomAccessStream_Release(ra_stream);
+ hr = ISpeechSynthesisStream_QueryInterface(ss_stream, &IID_IInputStream, (void **)&inp_stream); + ok(hr == S_OK, "QueryInteface(&IID_IRandomAccessStream) failed, hr %#lx\n", hr); + IInputStream_Release(inp_stream); + tmp = (void *)0xdeadbeef; hr = IAsyncOperation_SpeechSynthesisStream_GetResults(operation_ss_stream, &tmp); ok(hr == S_OK, "IAsyncOperation_SpeechSynthesisStream_GetResults failed, hr %#lx\n", hr);