From: Paul Gofman pgofman@codeweavers.com
--- dlls/windows.media.speech/private.h | 1 + dlls/windows.media.speech/synthesizer.c | 153 ++++++++++++++++++++++- dlls/windows.media.speech/tests/speech.c | 7 +- 3 files changed, 159 insertions(+), 2 deletions(-)
diff --git a/dlls/windows.media.speech/private.h b/dlls/windows.media.speech/private.h index fb5b936fb01..e7921370f11 100644 --- a/dlls/windows.media.speech/private.h +++ b/dlls/windows.media.speech/private.h @@ -33,6 +33,7 @@
#define WIDL_using_Windows_Foundation #define WIDL_using_Windows_Foundation_Collections +#define WIDL_using_Windows_Storage_Streams #include "windows.foundation.h" #define WIDL_using_Windows_Globalization #include "windows.globalization.h" diff --git a/dlls/windows.media.speech/synthesizer.c b/dlls/windows.media.speech/synthesizer.c index 80968333c8a..c2bed2e45b9 100644 --- a/dlls/windows.media.speech/synthesizer.c +++ b/dlls/windows.media.speech/synthesizer.c @@ -151,10 +151,10 @@ static struct voice_information_vector all_voices = * ISpeechSynthesisStream * */ - struct synthesis_stream { ISpeechSynthesisStream ISpeechSynthesisStream_iface; + IRandomAccessStream IRandomAccessStream_iface; LONG ref;
IVector_IMediaMarker *markers; @@ -180,6 +180,13 @@ HRESULT WINAPI synthesis_stream_QueryInterface( ISpeechSynthesisStream *iface, R return S_OK; }
+ if (IsEqualGUID(iid, &IID_IRandomAccessStream)) + { + IRandomAccessStream_AddRef(&impl->IRandomAccessStream_iface); + *out = &impl->IRandomAccessStream_iface; + return S_OK; + } + FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); *out = NULL; return E_NOINTERFACE; @@ -246,6 +253,149 @@ static const struct ISpeechSynthesisStreamVtbl synthesis_stream_vtbl = };
+static inline struct synthesis_stream *impl_from_IRandomAccessStream( IRandomAccessStream *iface ) +{ + return CONTAINING_RECORD(iface, struct synthesis_stream, IRandomAccessStream_iface); +} + +static HRESULT WINAPI synthesis_stream_random_access_QueryInterface( IRandomAccessStream *iface, REFIID iid, void **out ) +{ + struct synthesis_stream *impl = impl_from_IRandomAccessStream(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_random_access_AddRef( IRandomAccessStream *iface ) +{ + struct synthesis_stream *impl = impl_from_IRandomAccessStream(iface); + + TRACE( "iface %p.\n", iface ); + return ISpeechSynthesisStream_AddRef( &impl->ISpeechSynthesisStream_iface ); +} + +static ULONG WINAPI synthesis_stream_random_access_Release( IRandomAccessStream *iface ) +{ + struct synthesis_stream *impl = impl_from_IRandomAccessStream(iface); + + TRACE( "iface %p.\n", iface ); + return ISpeechSynthesisStream_Release( &impl->ISpeechSynthesisStream_iface ); +} + +static HRESULT WINAPI synthesis_stream_random_access_GetIids( IRandomAccessStream *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_random_access_GetRuntimeClassName( IRandomAccessStream *iface, HSTRING *class_name ) +{ + FIXME( "iface %p, class_name %p stub.\n", iface, class_name ); + return E_NOTIMPL; +} + +static HRESULT WINAPI synthesis_stream_random_access_GetTrustLevel( IRandomAccessStream *iface, TrustLevel *trust_level ) +{ + FIXME( "iface %p, trust_level %p stub.\n", iface, trust_level ); + return E_NOTIMPL; +} + +static HRESULT WINAPI synthesis_stream_random_access_get_Size( IRandomAccessStream *iface, UINT64 *value ) +{ + FIXME( "iface %p, value %p stub.\n", iface, value ); + + *value = 0; + return S_OK; +} + +static HRESULT WINAPI synthesis_stream_random_access_put_Size( IRandomAccessStream *iface, UINT64 value ) +{ + FIXME( "iface %p, value %I64u stub.\n", iface, value ); + + return E_NOTIMPL; +} + +static HRESULT WINAPI synthesis_stream_random_access_GetInputStreamAt( IRandomAccessStream *iface, UINT64 position, + IInputStream **stream ) +{ + FIXME( "iface %p, position %I64u, stream %p stub.\n", iface, position, stream ); + + *stream = NULL; + return E_NOTIMPL; +} + +static HRESULT WINAPI synthesis_stream_random_access_GetOutputStreamAt( IRandomAccessStream *iface, UINT64 position, + IOutputStream **stream ) +{ + FIXME( "iface %p, position %I64u, stream %p stub.\n", iface, position, stream ); + + *stream = NULL; + return E_NOTIMPL; +} + +static HRESULT WINAPI synthesis_stream_random_access_get_Position( IRandomAccessStream *iface, UINT64 *value ) +{ + FIXME( "iface %p, value %p stub.\n", iface, value ); + + *value = 0; + return E_NOTIMPL; +} + +static HRESULT WINAPI synthesis_stream_random_access_Seek( IRandomAccessStream *iface, UINT64 position ) +{ + FIXME( "iface %p, position %I64u stub.\n", iface, position ); + + return E_NOTIMPL; +} + +static HRESULT WINAPI synthesis_stream_random_access_CloneStream( IRandomAccessStream *iface, IRandomAccessStream **stream ) +{ + FIXME( "iface %p, stream %p stub.\n", iface, stream ); + + *stream = NULL; + return E_NOTIMPL; +} + +static HRESULT WINAPI synthesis_stream_random_access_get_CanRead( IRandomAccessStream *iface, BOOLEAN *value ) +{ + FIXME( "iface %p, value %p stub.\n", iface, value ); + + *value = FALSE; + return E_NOTIMPL; +} + +static HRESULT WINAPI synthesis_stream_random_access_get_CanWrite( IRandomAccessStream *iface, BOOLEAN *value ) +{ + FIXME( "iface %p, value %p stub.\n", iface, value ); + + *value = FALSE; + return E_NOTIMPL; +} + +static const struct IRandomAccessStreamVtbl synthesis_stream_random_access_vtbl = +{ + /* IUnknown methods */ + synthesis_stream_random_access_QueryInterface, + synthesis_stream_random_access_AddRef, + synthesis_stream_random_access_Release, + /* IInspectable methods */ + synthesis_stream_random_access_GetIids, + synthesis_stream_random_access_GetRuntimeClassName, + synthesis_stream_random_access_GetTrustLevel, + /* IRandomAccessStream methods */ + synthesis_stream_random_access_get_Size, + synthesis_stream_random_access_put_Size, + synthesis_stream_random_access_GetInputStreamAt, + synthesis_stream_random_access_GetOutputStreamAt, + synthesis_stream_random_access_get_Position, + synthesis_stream_random_access_Seek, + synthesis_stream_random_access_CloneStream, + synthesis_stream_random_access_get_CanRead, + synthesis_stream_random_access_get_CanWrite, +}; + + static HRESULT synthesis_stream_create( ISpeechSynthesisStream **out ) { struct synthesis_stream *impl; @@ -267,6 +417,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->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 422df544d59..719c97a52e2 100644 --- a/dlls/windows.media.speech/tests/speech.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -29,6 +29,7 @@
#define WIDL_using_Windows_Foundation #define WIDL_using_Windows_Foundation_Collections +#define WIDL_using_Windows_Storage_Streams #include "windows.foundation.h" #define WIDL_using_Windows_Globalization #include "windows.globalization.h" @@ -36,7 +37,6 @@ #include "windows.media.speechrecognition.h" #define WIDL_using_Windows_Media_SpeechSynthesis #include "windows.media.speechsynthesis.h" - #include "wine/test.h"
#define AsyncStatus_Closed 4 @@ -788,6 +788,7 @@ static void test_SpeechSynthesizer(void) IVectorView_VoiceInformation *voices = NULL; IInstalledVoicesStatic *voices_static = NULL; ISpeechSynthesisStream *ss_stream = NULL, *tmp; + IRandomAccessStream *ra_stream; IVoiceInformation *voice; IInspectable *inspectable = NULL, *tmp_inspectable = NULL; IAgileObject *agile_object = NULL, *tmp_agile_object = NULL; @@ -943,6 +944,10 @@ static void test_SpeechSynthesizer(void) hr = IAsyncOperation_SpeechSynthesisStream_GetResults(operation_ss_stream, &ss_stream); ok(hr == S_OK, "IAsyncOperation_SpeechSynthesisStream_GetResults failed, hr %#lx\n", hr);
+ hr = ISpeechSynthesisStream_QueryInterface(ss_stream, &IID_IRandomAccessStream, (void **)&ra_stream); + ok(hr == S_OK, "QueryInteface(&IID_IRandomAccessStream) failed, hr %#lx\n", hr); + IRandomAccessStream_Release(ra_stream); + tmp = (void *)0xdeadbeef; hr = IAsyncOperation_SpeechSynthesisStream_GetResults(operation_ss_stream, &tmp); ok(hr == S_OK, "IAsyncOperation_SpeechSynthesisStream_GetResults failed, hr %#lx\n", hr);