sapi: Add stub SpStream object.
Needed by Assassin's Creed Valhalla. Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2793bdeb26
commit
04cf431735
|
@ -6,6 +6,7 @@ EXTRADLLFLAGS = -mno-cygwin
|
|||
C_SRCS = \
|
||||
automation.c \
|
||||
main.c \
|
||||
stream.c \
|
||||
token.c \
|
||||
tts.c
|
||||
|
||||
|
|
|
@ -107,6 +107,7 @@ static const struct IClassFactoryVtbl class_factory_vtbl =
|
|||
|
||||
static struct class_factory data_key_cf = { { &class_factory_vtbl }, data_key_create };
|
||||
static struct class_factory file_stream_cf = { { &class_factory_vtbl }, file_stream_create };
|
||||
static struct class_factory speech_stream_cf = { { &class_factory_vtbl }, speech_stream_create };
|
||||
static struct class_factory speech_voice_cf = { { &class_factory_vtbl }, speech_voice_create };
|
||||
static struct class_factory token_category_cf = { { &class_factory_vtbl }, token_category_create };
|
||||
static struct class_factory token_enum_cf = { { &class_factory_vtbl }, token_enum_create };
|
||||
|
@ -131,6 +132,8 @@ HRESULT WINAPI DllGetClassObject( REFCLSID clsid, REFIID iid, void **obj )
|
|||
cf = &token_enum_cf.IClassFactory_iface;
|
||||
else if (IsEqualCLSID( clsid, &CLSID_SpObjectToken ))
|
||||
cf = &token_cf.IClassFactory_iface;
|
||||
else if (IsEqualCLSID( clsid, &CLSID_SpStream ))
|
||||
cf = &speech_stream_cf.IClassFactory_iface;
|
||||
else if (IsEqualCLSID( clsid, &CLSID_SpVoice ))
|
||||
cf = &speech_voice_cf.IClassFactory_iface;
|
||||
|
||||
|
|
|
@ -64,6 +64,20 @@ coclass SpObjectToken
|
|||
[default] interface ISpDataKey;
|
||||
}
|
||||
|
||||
[
|
||||
uuid(715d9c59-4442-11d2-9605-00c04f8ee628),
|
||||
helpstring("Speech Stream"),
|
||||
progid("SAPI.SpStream.1"),
|
||||
vi_progid("SAPI.SpStream"),
|
||||
threading(both),
|
||||
restricted,
|
||||
hidden
|
||||
]
|
||||
coclass SpStream
|
||||
{
|
||||
interface ISpStream;
|
||||
}
|
||||
|
||||
[
|
||||
uuid(96749377-3391-11d2-9ee3-00c04f797396),
|
||||
helpstring("Speech Voice"),
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
HRESULT data_key_create( IUnknown *outer, REFIID iid, void **obj ) DECLSPEC_HIDDEN;
|
||||
HRESULT file_stream_create( IUnknown *outer, REFIID iid, void **obj ) DECLSPEC_HIDDEN;
|
||||
HRESULT speech_stream_create( IUnknown *outer, REFIID iid, void **obj ) DECLSPEC_HIDDEN;
|
||||
HRESULT speech_voice_create( IUnknown *outer, REFIID iid, void **obj ) DECLSPEC_HIDDEN;
|
||||
HRESULT token_category_create( IUnknown *outer, REFIID iid, void **obj ) DECLSPEC_HIDDEN;
|
||||
HRESULT token_enum_create( IUnknown *outer, REFIID iid, void **obj ) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -0,0 +1,249 @@
|
|||
/*
|
||||
* Speech API (SAPI) stream implementation.
|
||||
*
|
||||
* Copyright 2020 Gijs Vermeulen
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "objbase.h"
|
||||
|
||||
#include "sapiddk.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include "sapi_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(sapi);
|
||||
|
||||
struct spstream
|
||||
{
|
||||
ISpStream ISpStream_iface;
|
||||
LONG ref;
|
||||
};
|
||||
|
||||
static inline struct spstream *impl_from_ISpStream(ISpStream *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, struct spstream, ISpStream_iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI spstream_QueryInterface(ISpStream *iface, REFIID iid, void **obj)
|
||||
{
|
||||
struct spstream *This = impl_from_ISpStream(iface);
|
||||
|
||||
TRACE("(%p, %s, %p).\n", iface, debugstr_guid(iid), obj);
|
||||
|
||||
if (IsEqualIID(iid, &IID_IUnknown) ||
|
||||
IsEqualIID(iid, &IID_ISpStream))
|
||||
*obj = &This->ISpStream_iface;
|
||||
else
|
||||
{
|
||||
*obj = NULL;
|
||||
FIXME("interface %s not implemented.\n", debugstr_guid(iid));
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
IUnknown_AddRef((IUnknown *)*obj);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static ULONG WINAPI spstream_AddRef(ISpStream *iface)
|
||||
{
|
||||
struct spstream *This = impl_from_ISpStream(iface);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p): ref=%u.\n", iface, ref);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
static ULONG WINAPI spstream_Release(ISpStream *iface)
|
||||
{
|
||||
struct spstream *This = impl_from_ISpStream(iface);
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p): ref=%u.\n", iface, ref);
|
||||
|
||||
if (!ref)
|
||||
{
|
||||
heap_free(This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI spstream_Read(ISpStream *iface, void *pv, ULONG cb, ULONG *read)
|
||||
{
|
||||
FIXME("(%p, %p, %d, %p): stub.\n", iface, pv, cb, read);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI spstream_Write(ISpStream *iface, const void *pv, ULONG cb, ULONG *written)
|
||||
{
|
||||
FIXME("(%p, %p, %d, %p): stub.\n", iface, pv, cb, written);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI spstream_Seek(ISpStream *iface, LARGE_INTEGER mode, DWORD origin, ULARGE_INTEGER *position)
|
||||
{
|
||||
FIXME("(%p, %s, %d, %p): stub.\n", iface, wine_dbgstr_longlong(mode.QuadPart), origin, position);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI spstream_SetSize(ISpStream *iface, ULARGE_INTEGER size)
|
||||
{
|
||||
FIXME("(%p, %s): stub.\n", iface, wine_dbgstr_longlong(size.QuadPart));
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI spstream_CopyTo(ISpStream *iface, IStream *stream, ULARGE_INTEGER cb,
|
||||
ULARGE_INTEGER *read, ULARGE_INTEGER *written)
|
||||
{
|
||||
FIXME("(%p, %p, %s, %p, %p): stub.\n", iface, stream, wine_dbgstr_longlong(cb.QuadPart),
|
||||
read, written);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI spstream_Commit(ISpStream *iface, DWORD flag)
|
||||
{
|
||||
FIXME("(%p, %d): stub.\n", iface, flag);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI spstream_Revert(ISpStream *iface)
|
||||
{
|
||||
FIXME("(%p): stub.\n", iface);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI spstream_LockRegion(ISpStream *iface, ULARGE_INTEGER offset, ULARGE_INTEGER cb, DWORD type)
|
||||
{
|
||||
FIXME("(%p, %s, %s, %d): stub.\n", iface, wine_dbgstr_longlong(offset.QuadPart),
|
||||
wine_dbgstr_longlong(cb.QuadPart), type);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI spstream_UnlockRegion(ISpStream *iface, ULARGE_INTEGER offset, ULARGE_INTEGER cb, DWORD type)
|
||||
{
|
||||
FIXME("(%p, %s, %s, %d): stub.\n", iface, wine_dbgstr_longlong(offset.QuadPart),
|
||||
wine_dbgstr_longlong(cb.QuadPart), type);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI spstream_Stat(ISpStream *iface, STATSTG *statstg, DWORD flag)
|
||||
{
|
||||
FIXME("(%p, %p, %d): stub.\n", iface, statstg, flag);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI spstream_Clone(ISpStream *iface, IStream **stream)
|
||||
{
|
||||
FIXME("(%p, %p): stub.\n", iface, stream);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI spstream_GetFormat(ISpStream *iface, GUID *format, WAVEFORMATEX **wave)
|
||||
{
|
||||
FIXME("(%p, %p, %p): stub.\n", iface, format, wave);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI spstream_SetBaseStream(ISpStream *iface, IStream *stream, REFGUID format,
|
||||
const WAVEFORMATEX *wave)
|
||||
{
|
||||
FIXME("(%p, %p, %s, %p): stub.\n", iface, stream, debugstr_guid(format), wave);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI spstream_GetBaseStream(ISpStream *iface, IStream **stream)
|
||||
{
|
||||
FIXME("(%p, %p): stub.\n", iface, stream);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI spstream_BindToFile(ISpStream *iface, LPCWSTR filename, SPFILEMODE mode,
|
||||
const GUID *format, const WAVEFORMATEX* wave,
|
||||
ULONGLONG interest)
|
||||
{
|
||||
FIXME("(%p, %s, %d, %s, %p, %s): stub.\n", iface, debugstr_w(filename), mode, debugstr_guid(format),
|
||||
wave, wine_dbgstr_longlong(interest));
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI spstream_Close(ISpStream *iface)
|
||||
{
|
||||
FIXME("(%p): stub.\n", iface);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
const static ISpStreamVtbl spstream_vtbl =
|
||||
{
|
||||
spstream_QueryInterface,
|
||||
spstream_AddRef,
|
||||
spstream_Release,
|
||||
spstream_Read,
|
||||
spstream_Write,
|
||||
spstream_Seek,
|
||||
spstream_SetSize,
|
||||
spstream_CopyTo,
|
||||
spstream_Commit,
|
||||
spstream_Revert,
|
||||
spstream_LockRegion,
|
||||
spstream_UnlockRegion,
|
||||
spstream_Stat,
|
||||
spstream_Clone,
|
||||
spstream_GetFormat,
|
||||
spstream_SetBaseStream,
|
||||
spstream_GetBaseStream,
|
||||
spstream_BindToFile,
|
||||
spstream_Close
|
||||
};
|
||||
|
||||
HRESULT speech_stream_create(IUnknown *outer, REFIID iid, void **obj)
|
||||
{
|
||||
struct spstream *This = heap_alloc(sizeof(*This));
|
||||
HRESULT hr;
|
||||
|
||||
if (!This) return E_OUTOFMEMORY;
|
||||
This->ISpStream_iface.lpVtbl = &spstream_vtbl;
|
||||
This->ref = 1;
|
||||
|
||||
hr = ISpStream_QueryInterface(&This->ISpStream_iface, iid, obj);
|
||||
|
||||
ISpStream_Release(&This->ISpStream_iface);
|
||||
return hr;
|
||||
}
|
|
@ -3,5 +3,6 @@ IMPORTS = ole32 user32 advapi32
|
|||
|
||||
C_SRCS = \
|
||||
automation.c \
|
||||
stream.c \
|
||||
token.c \
|
||||
tts.c
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Speech API (SAPI) stream tests.
|
||||
*
|
||||
* Copyright 2020 Gijs Vermeulen
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "sapiddk.h"
|
||||
#include "sperror.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
#define EXPECT_REF(obj,ref) _expect_ref((IUnknown*)obj, ref, __LINE__)
|
||||
static void _expect_ref(IUnknown *obj, ULONG ref, int line)
|
||||
{
|
||||
ULONG rc;
|
||||
IUnknown_AddRef(obj);
|
||||
rc = IUnknown_Release(obj);
|
||||
ok_(__FILE__,line)(rc == ref, "Unexpected refcount %d, expected %d.\n", rc, ref);
|
||||
}
|
||||
|
||||
static void test_interfaces(void)
|
||||
{
|
||||
ISpStream *speech_stream;
|
||||
IDispatch *dispatch;
|
||||
IUnknown *unk;
|
||||
HRESULT hr;
|
||||
|
||||
hr = CoCreateInstance(&CLSID_SpStream, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_ISpStream, (void **)&speech_stream);
|
||||
ok(hr == S_OK, "Failed to create ISpeechVoice interface: %#x.\n", hr);
|
||||
EXPECT_REF(speech_stream, 1);
|
||||
|
||||
hr = CoCreateInstance(&CLSID_SpStream, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IUnknown, (void **)&unk);
|
||||
ok(hr == S_OK, "Failed to create IUnknown interface: %#x.\n", hr);
|
||||
EXPECT_REF(unk, 1);
|
||||
EXPECT_REF(speech_stream, 1);
|
||||
IUnknown_Release(unk);
|
||||
|
||||
hr = CoCreateInstance(&CLSID_SpStream, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IDispatch, (void **)&dispatch);
|
||||
ok(hr == E_NOINTERFACE, "Succeeded to create IDispatch interface: %#x.\n", hr);
|
||||
ok(!dispatch, "Expected NULL dispatch, got %p.", dispatch);
|
||||
|
||||
ISpStream_Release(speech_stream);
|
||||
}
|
||||
|
||||
START_TEST(stream)
|
||||
{
|
||||
CoInitialize(NULL);
|
||||
test_interfaces();
|
||||
CoUninitialize();
|
||||
}
|
|
@ -1086,6 +1086,20 @@ library SpeechLib
|
|||
interface ISpRecognizer;
|
||||
};
|
||||
|
||||
[
|
||||
uuid(715d9c59-4442-11d2-9605-00c04f8ee628),
|
||||
helpstring("Speech Stream"),
|
||||
progid("SAPI.SpStream.1"),
|
||||
vi_progid("SAPI.SpStream"),
|
||||
threading(both),
|
||||
restricted,
|
||||
hidden
|
||||
]
|
||||
coclass SpStream
|
||||
{
|
||||
interface ISpStream;
|
||||
};
|
||||
|
||||
[
|
||||
uuid(96749377-3391-11d2-9ee3-00c04f797396)
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue